When comparing Yii vs Zend Framework, the Slant community recommends Yii for most people. In the question“What are the best PHP frameworks?” Yii is ranked 8th while Zend Framework is ranked 18th. The most important reason people chose Yii is:
Yii takes care of repetitive tasks through Gii, a web-based scaffolding tool. Gii takes care of code generation and creating code templates for: * Models * Controllers * Forms * Modules * Extensions * CRUD controller actions and views * There are a lot of scaffolding templates made by community for Gii, that improve generated code functionality by a lot. * Gii is very easy to extend yourself.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Rapid development through code scaffolding
Yii takes care of repetitive tasks through Gii, a web-based scaffolding tool. Gii takes care of code generation and creating code templates for:
- Models
- Controllers
- Forms
- Modules
- Extensions
- CRUD controller actions and views
- There are a lot of scaffolding templates made by community for Gii, that improve generated code functionality by a lot.
- Gii is very easy to extend yourself.
Pro Comes with important security standarts
Since security is a crucial part of any application, Yii comes with great security features out of the box to help developers create a secure and reliable application. These security features contain but are not restricted to:
- Input validation
- Output filtering
- Features against SQL injection
- Cross-site scripting prevention
Pro Highly extensible
Yii is built to be extremely extensible. Virtually every component of the framework can be extended programmatically. For example, if you want to add a unique id to your views, it's very easy to do:
namespace app\components;
class View extends yii\web\View {
public $bodyId;
/* Yii allows you to add magic getter methods by prefacing method names with "get" */
public function getBodyIdAttribute() {
return ($this->bodyId != '') ? 'id="' . $this->bodyId . '"' : '';
}
}
Pro Integrated with a testing framework
Yii makes use of Codeception, a great PHP testing framework that helps developers run their tests. They can be unit, functional or acceptance tests since Codeception supports them all.
Pro Lots of plugins available
Yii has about 2000 addons hosted on Yii's official website. These addons significantly decrease development time and increase the developer's efficiency.
Pro License
Yii is free and open source and is distributed under the BSD License.
Pro Strong community support
Yii has a strong and rather large community behind it. This is proven by the great number of blog posts, tutorials, guides and reviews on the Yii framework as well as the great number of extensions developed for it.
Pro Easy to install
Yii uses Composer to handle it's dependency installation. This is rather easy and not very time consuming, although it should be noted that Composer is very resource-intensive considering what it's job is. But that is not really Yii's fault.
Pro Best framework for CRUD operation
Yii Framework Provides most of features require for crud functionalities like GridView, Listview and DetailView (with jquery search and validation functions) by generating using GII.
Pro Highly extensible without effort
Pro Well architected
Pro Enterprise ready
Zend is the most used PHP framework by big businesses. Zend is widely used and tested by a large number of banks, as well as companies, such as Allied Beverage, BBC, Shaklee, CarinBridge, BNP Paribas and more.
Pro Corporate backing
Partnered with Google, IBM, Adobe, Microsoft
Pro Extended predefined classes
Zend has a large library of predefined classes with which developers can create maintainable and stable web applications. This is done if the developer works within the constraints and with the components of these different predefined classes, which makes the application more maintainable.
Pro Wide database support
Zend supports almost all kinds of databases out there. From MySQL, IBM DB2, Oracle, Microsoft SQL Server to PostgreSQL.
Pro Allows customization
For developpers not used to Zend, they can use a predefined structure and use preloaded components and classes to build and maintain their application. But for advanced developpers, they can customize the structure to stick to their needs (or their likings) and extend primary Zend components for fine-tuned apps or replace the initial predefined Zend components by third parties components such as Doctrine ORM or another logging or templating framework.
Pro Easy to build an API with Apigility
Apigility is a collection of Zend Framework modules. It's useful for building the API architecture of a web app quickly and painlessly by providing a flexible engine.
Apigility also has a web-based UI that allows developers to quickly create and modify API services, configure authentication, set authorization rules, set up validation and write new documents.
Cons
Con Can be hard for beginners
Since Yii requires developers to write code following certain rules, or in other words, it requires developers to follow the "Yii way of doing things" it can be hard for beginners to warm up to it and start using it right away.
Con Not very good at many to many relations
(but there is a good plugin, namely CAdvancedArBehavior extension to do this)
Con Loose documentation
Since Zend has a loosely-coupled architecture, it means that the documentation will be quite loose as well. Even though there's a lot of documentation for the framework, it's still hard to use it as a guideline to create a completed project. Although this can be less of a problem considering all the tutorials and guides out there.