万本电子书0元读

万本电子书0元读

顶部广告

Mastering Yii电子书

售       价:¥

5人正在读 | 0人评论 9.8

作       者:Charles R. Portwood II

出  版  社:Packt Publishing

出版时间:2016-01-28

字       数:296.8万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Advance your modern web application development skills with Yii Framework 2About This BookLearn to work with the key aspects of Yii Framework 2Explore how to create RESTful APIs with YiiIncorporate codeception with Yii2 to test your code thoroughlyWho This Book Is ForThis book is for Yii Framework developers who want to quickly master Yii2. This book assumes some familiarity with Yii2, PHP 5, and HTML5.What You Will LearnExplore Yii2’s conventions and learn how to properly configure Yii2Create both web and console applicationsReduce development time by learning to create classes automatically with Gii, Yii2’s automatic code generation toolUse Yii2’s database migration toolManage and access databases with Active Record, DAO, and Query BuilderHandle user authentication and authorization within Yii2Create RESTful APIs with Yii Framework 2Test applications automatically with codeceptionIn DetailThe successor of Yii Framework 1.1, Yii2 is a complete rewrite of Yii Framework, one of the most popular PHP 5 frameworks for making modern web applications. The update embraces the best practices and protocols established with newer versions of PHP, while still maintaining the simple, fast, and extendable behavior found in its predecessor.This book has been written to enhance your skills and knowledge with Yii Framework 2. Starting with configuration and how to initialize new projects, you’ll learn how to configure, manage, and use every aspect of Yii2 from Gii, DAO, Query Builder, Active Record, and migrations, to asset manager. You'll also discover how to automatically test your code using codeception.With this book by your side, you’ll have all the skills you need to quickly create rich modern web and console applications with Yii2.Style and approach This book is a step-by-step guide to mastering every aspect of Yii Framework 2. Each chapter outlines a new set of tools along with code that can be used to efficiently create modern web and console applications
目录展开

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

累计评论(0条) 1个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部