Book description
Discover 100 useful recipes that will bring the best out of the Yii2 framework and be on the bleeding edge of web development today
About This Book
- Learn how to use Yii2 efficiently through clear examples and core features, and see how to use tests, create reusable code snippets, core widgets, deployment, and more
- This book provides you with a wide space for practice approaches and helps you to learn about the new Yii2 framework.
- Understand the difference between the Yii 1.x.x versions using useful examples from real web applications
Who This Book Is For
This book is for developers with good PHP5 knowledge and MVC-frameworks who have tried to develop applications using the Yii 1.x.x version. This book will very useful for all those who would like to try Yii2, or those who are afraid to move from Yii 1.x.x. to Yii2. If you have still not tried Yii2, this book is definitely for you!
What You Will Learn
- See the new version of the Yii2 framework and application development practices
- Write your applications more efficiently using shortcuts, Yii's core functionality, and the best practices in Web 2.0
- Get data from a database, and deal with Active Record, migrations, widgets, and core features
- Easily update your skills from the previous version of the framework
- Explore how to use Yii with different JavaScript frameworks and libraries such as WebSockets, Angular, Ember, Backbone and React
- Learn how to keep your application secure according to the general web application security principle "filter input, escape output.
- Write RESTfull Web Services using Yii2 and built-in features
- Correctly install and use official extensions in your projects
- Effectively create and implement your own Yii extension, and also ensure your extension is reusable and useful for the community
In Detail
Yii is a free, open source web application development framework written in PHP5 that promotes clean DRY design and encourages rapid development. It works to streamline your application development time and helps to ensure an extremely efficient, extensible, and maintainable end product. Being extremely performance optimized, Yii is a perfect choice for any size project. However, it has been built with sophisticated, enterprise applications in mind. You have full control over the configuration from head-to-toe (presentation-to-persistence) to conform to your enterprise development guidelines. It comes packaged with tools to help test and debug your application, and has clear and comprehensive documentation.
This book is a collection of Yii2 recipes. Each recipe is represented as a full and independent item, which showcases solutions from real web-applications. So you can easily reproduce them in your environment and learn Yii2 fast and without tears. All recipes are explained with step-by-step code examples and clear screenshots.
Yii2 is like a suit that looks great off the rack, but is also very easy to tailor to fit your needs. Virtually every component of the framework is extensible. This book will show how to use official extensions, extend any component, or write a new one.
This book will help you create modern web applications quickly, and make sure they perform well using examples and business logic from real life. You will deal with the Yii command line, migrations, and assets. You will learn about role-based access, security, and deployment. We'll show you how to easily get started, configure your environment, and be ready to write web applications efficiently and quickly.
Style and approach
The chapters of this book are independent and offer a practical approach to Yii development. You can start reading from the chapter you need most, be it Ajax and jQuery, RESTful Web Services, Database, Active Record, or Official Extensions
Table of contents
-
Yii2 Application Development Cookbook Third Edition
- Table of Contents
- Yii2 Application Development Cookbook Third Edition
- Credits
- About the Authors
- About the Reviewer
- www.PacktPub.com
- Preface
- 1. Fundamentals
-
2. Routing, Controllers, and Views
- Introduction
- Configuring URL rules
- Generating URLs
- Using regular expressions in URL rules
- Using a base controller
- Using standalone actions
- Creating a custom filter
- Displaying static pages
- Using flash messages
- Using the controller context in a view
- Reusing views with partials
- Using blocks
- Using decorators
- Defining multiple layouts
- Pagination and sorting data
-
3. ActiveRecord, Model, and Database
- Introduction
- Getting data from a database
- Defining and using multiple DB connections
- Customizing the ActiveQuery class
- Processing model fields with AR event-like methods
- Automating timestamps
- Setting up an author automatically
- Setting up a slug automatically
- Transactions
- Replication and read-write splitting
- Implementing single table inheritance
-
4. Forms
- Introduction
- Writing your own validators
- Uploading files
- Adding and customizing CaptchaWidget
- Customizing Captcha
- Creating a custom input widget
- Tabular input
- Conditional validation
- Complex forms with multiple models
- AJAX-dependent drop-down list
- AJAX validation
- Creating a custom client-side validation
- 5. Security
- 6. RESTful Web Services
- 7. Official Extensions
-
8. Extending Yii
- Introduction
- Creating helpers
- Creating model behaviors
- Creating components
- Creating reusable controller actions
- Creating reusable controllers
- Creating a widget
- Creating CLI commands
- Creating filters
- Creating modules
- Creating a custom view renderer
- Creating a multilanguage application
- Making extensions distribution-ready
- 9. Performance Tuning
- 10. Deployment
- 11. Testing
- 12. Debugging, Logging, and Error Handling
- Index
Product information
- Title: Yii2 Application Development Cookbook - Third Edition
- Author(s):
- Release date: November 2016
- Publisher(s): Packt Publishing
- ISBN: 9781785281761
You might also like
book
Yii2 By Example
Develop complete web applications from scratch through practical examples and tips for beginners and more advanced …
book
Object-Oriented PHP
Object-Oriented PHP shows developers how to take advantage of the new object-oriented features of PHP. Working …
book
Web Application Development with PHP 4.0
As Web sites and intranets become larger and more complex, static HTML files hit their limits. …
book
PHP 7: Real World Application Development
Use new features of PHP 7 to solve practical, real-world problems faced by PHP developers like …