售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Mastering Yii
Table of Contents
Mastering Yii
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Composer, Configuration, Classes, and Path Aliases
Composer
Configuration
Requirements checker
Entry scripts
Web entry script
Configuration files
Web and console configuration files
Database configuration
Parameter configuration
Environment configuration
Setting up our application environment
Setting the web environment for NGINX
Setting the web environment for Apache
Components and objects
Components
Objects
Path aliases
Summary
2. Console Commands and Applications
Configuration and usage
Entry script
Configuration
Setting the console environment
Running console commands
Built-in console commands
The help command
The asset command
The cache command
The fixture command
The Gii command
The message command
The migration command
Creating console commands
Generating help information
Passing command-line arguments
Exit codes
Formatting
Summary
3. Migrations, DAO, and Query Building
Connecting to databases
Additional configuration options
Writing database migrations
An overview of schema
Writing migrations
Running migrations
Altering a database schema
Database access objects
Querying for data
Quoting table and column names
Executing queries
Parameter binding
Transactions
Query Builder
Query construction methods
The select method
The from method
The where method
The string format
The hash format
The operator format
Ordering results
Limiting and offsetting data
Grouping and having
Joins and unions
Executing queries
Examining queries
Iterating over query results
Data providers and data widgets
Data replication and load balancing
Summary
4. Active Record, Models, and Forms
Configuring Gii
Gii for web applications
Gii for console applications
Active Record
The Active Record pattern
Creating Active Record classes
Creating active record classes with Gii
Using Gii's web interface
Using Gii's console interface
Working with Active Record
Model validation rules
Adding custom validators
Customizing validator error messages
Working with validation errors
Manually executing validation rules
Model attribute labels
Active Record relationships
Using multiple database connections with Active Record
Behaviors in Active Record
Working with Active Record
Querying data
Data access
Saving data
Creating new records
Deleting data
Active Record events
Models
Model attributes
Scenarios
Forms
Generating forms with Gii
Generating forms with Gii's web interface
Generating forms with Gii's console interface
Using forms
ActiveForm and input types
Summary
5. Modules, Widgets, and Helpers
Modules
Module components
The module class structure
Controllers
Views and layouts
Registering modules
Dynamically registering modules
Bootstrapping modules
Accessing modules
Managing modules with Composer
Modules in summary
Widgets
Using widgets
Commonly used built-in widgets
Bootstrap widgets
jQuery UI widgets
Yii-specific widgets
Creating custom widgets
A summary of widgets
Helpers
The URL helper
The HTML helper
The JSON helper
The Markdown helper
Variable dumping
Inflector
FileHelper
Summary
6. Asset Management
Asset bundles
Using asset bundles
Configuration
Asset mapping
Asset types and locations
Asset options
Asset publication
Client cache management with asset bundles
Using preprocessor with asset bundles
The asset command line tool
Third-party asset tools
NodeJS
Bower
Grunt
Summary
7. Authenticating and Authorizing Users
Authentication of users
Implementing the user identity interface
Cookie-based authentication
Working with user identities
Authenticating users with forms
Authorization
Access control filters
Role-based access control
Configuring RBAC
Creating permissions and permission relationships
Custom authorization rules
Checking if a user has access to a role
Flash messages
Hashing and encryption
Hashing and verifying passwords
Data encryption and decryption
Data hashing
Summary
8. Routing, Responses, and Events
Routing
Default and catch all routes
Custom routes and URL rules
Parameterizing routes
URL suffixes
HTTP method-specific URL rules
Custom URL rule classes
Dynamic rule generation
Requests
Retrieving request parameters and data
Request headers and cookies
Retrieving client and URL information
Responses
Setting status codes
Web exceptions
Setting response headers
The response body
Redirection
The file output
Events
Event handlers
Triggering events
Class-level events
Global events
Summary
9. RESTful APIs
ActiveController
Configuring ActiveController display fields
Data serialization within responses
Disabling ActiveController actions
Customizing ActiveController actions
Authentication filters
HTTP basic authentication
Query parameter authentication
OAuth2 authentication
Composite authentication
Custom authentication filters
Action-specific authentication
Checking access
Verb filters
Cross-origin resource headers
Rate Limiting
Error handling
Custom API controllers
Returning data
Response Formatting
Summary
10. Testing with Codeception
Reasons for testing
How to approach testing
Testing manually
Testing a few core components
Test-driven development
Configuring Codeception with Yii2
Unit testing
Generating unit tests
Unit test examples
Testing User model methods
Functional testing
Setting up functional tests
Generating functional tests
Examples of functional tests
Acceptance testing
Setting up acceptance testing
Examples of acceptance tests
Fixtures
Creating fixtures
Defining fixtures
Using fixtures in unit tests
Automatic change testing
Summary
11. Internationalization and Localization
Configuring Yii2 and PHP
The intl extension
The application language
Programmatically setting the application language
Dynamically setting the application language
Message translations
Message sources
Default translations
Framework messages
Handling missing translations
Generating message files
Message formatting
Viewing file translations
Module translations
Widget translations
Summary
12. Performance and Security
Caching
Caching data
Caching dependencies
Database query caching
Fragment caching
Page caching
HTTP caching
Caching database schema
General performance enhancements
Enabling OPCache
Optimizing Composer dependencies
Upgrading to PHP 7
Switch to Facebook's HHVM
Security considerations
Certificates
Cookies
Protecting against cross-site scripting
Enabling cross-site request forgery protection
Summary
13. Debugging and Deploying
Debugging
Logging
Benchmarking
Error handling
Handling errors within non HTML responses
Debugging with the Yii2 debug extension
Deploying
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜