What is Yii2
- What is yii2 best for?
- How does Yii2 Compare with Other Frameworks?
- Yii2 Versions
- Requirements and Prerequisites
Yii2 is a high performance, component-based PHP framework for rapidly developing modern Web applications. The name Yii2 (pronounced
[ji:]) means “simple and evolutionary” in Chinese. It can also be thought of as an acronym for Yes It Is!
What is Yii2 Best for?
Yii2 is a generic Web programming framework, meaning that it can be used for developing all kinds of Web applications using PHP. Because of its component-based architecture and sophisticated caching support, it is especially suitable for developing large-scale applications such as portals, forums, content management systems (CMS), e-commerce projects, RESTful Web services, and so on.
How does Yii2 Compare with Other Frameworks?
If you’re already familiar with another framework, you may appreciate knowing how Yii compares:
- Like most PHP frameworks, Yii2 implements the MVC (Model-View-Controller) architectural pattern and promotes code organization based on that pattern.
- Yii takes the philosophy that code should be written in a simple yet elegant way. Yii will never try to over-design things mainly for the purpose of strictly following some design pattern.
- Yii is a full-stack framework providing many proven and ready-to-use features: query builders and ActiveRecord for both relational and NoSQL databases; RESTful API development support; multi-tier caching support; and more.
- Yii is extremely extensible. You can customize or replace nearly every piece of the core’s code. You can also take advantage of Yii’s solid extension architecture to use or develop redistributable extensions.
- High performance is always a primary goal of Yii.
Yii is not a one-man show, it is backed up by a strong core developer team, as well as a large community of professionals constantly contributing to Yii’s development. The Yii developer team keeps a close eye on the latest Web development trends and on the best practices and features found in other frameworks and projects. The most relevant best practices and features found elsewhere are regularly incorporated into the core framework and exposed via simple and elegant interfaces.
Yii currently has two major versions available: 1.1 and 2.0. Version 1.1 is the old generation and is now in maintenance mode. Version 2.0 is a complete rewrite of Yii, adopting the latest technologies and protocols, including Composer, PSR, namespaces, traits, and so forth. Version 2.0 represents the current generation of the framework and will receive the main development efforts over the next few years. This guide is mainly about version 2.0.
Requirements and Prerequisites
Yii 2.0 requires PHP 5.4.0 or above. You can find more detailed requirements for individual features by running the requirement checker included in every Yii release.
Using Yii requires basic knowledge of object-oriented programming (OOP), as Yii is a pure OOP-based framework. Yii 2.0 also makes use of the latest features of PHP, such as namespaces and traits. Understanding these concepts will help you more easily pick up Yii 2.0.
- Installing Yii
- Running Applications
- Saying Hello
- Working with Forms
- Working with Databases
- Generating Code with Gii
- Looking Ahead
- Entry Scripts
- Application Components
- Routing and URL Creation
- Sessions and Cookies
- Handling Errors
- Class Autoloading
- Service Locator
- Dependency Injection Container
Working with Databases
- Data Access Objects: Connecting to a database, basic queries, transactions, and schema manipulation
- Query Builder: Querying the database using a simple abstraction layer
- Active Record: The Active Record ORM, retrieving and manipulating records, and defining relations
- Migrations: Apply version control to your databases in a team development environment
Getting Data from Users
- Creating Forms
- Validating Input
- Uploading Files
- Collecting Tabular Input
- Getting Data for Multiple Models
- Working with Passwords
- Views security
- Auth Clients
- Best Practices
RESTful Web Services
- Quick Start
- Response Formatting
- Rate Limiting
- Error Handling
- Advanced Project Template
- Building Application from Scratch
- Console Commands
- Core Validators
- Performance Tuning
- Shared Hosting Environment
- Template Engines
- Working with Third-Party Code
Yii2 – Popular Extensions
SEO Friendly URLs in Yii2
Yii2 provides some insights into Apache configuration and Yii2 configuration in order to achieve user friendly and search engine friendly URLs for your web app.
There are 3 way to achieve user friendly and search engine friendly URLs for your web application.
- First hide frontend/web and backend/web
- Second enable pretty URL
- Rewrite URL
Click here to read more.