3 different frameworks for PHP

Source: Internet
Author: User
Tags php framework yii

PHP's three frameworks are ideal for creating Web2.0 applications, but each frame uses different purposes. We look at what they have and how they compete, and hopefully this will help you with your PHP framework learning.

Template engine

The template engine reduces the workload for developers, which provides better functionality for writing front-end code. The template engine provides features such as automatic HTML escaping and filtering, and fills in the blanks left by native PHP.

Symfony Twig Template System

Twig is a modern template system for PHP. Symfony leverages its strengths to enable developers to write clean, concise code, and it can do more than native PHP. For example, native PHP writes the code:

<?php echo $var?> <?php echo htmlspecialchars ($var, ent_quotes, ' UTF-8 ')?>

Twig can do the same work with the following code:

{{var}} {{Var|escape}} {{Var|e}} {# shortcut to escape a variable #}

Browse the Twig website to learn more about its features.

Laravel Blade Template System

Unlike other templating systems, Blade lets you use PHP code in your views. In addition, Blade has a performance of 0 load applications because its view files must use the. blade.php extension file name. All the code in the view file during processing is converted to native PHP.

Yii Default Template system

Yii does not use any third-party templating system by default, but this does not mean that it lacks template system support. The choice of template system depends on the development team. It is recommended to use twig and smarty. Symfony uses twig, so if you've used symfony in the past, you might need to use twig to develop one of your yii projects.

There is no clear which frame is better. Three frameworks use a template engine to write better front-end coding and maintenance. One small advantage of YII is that the framework does not have a pre-defined template system.

Different points of the frame

The creation of each frame is different. Symfony works with reusable components, and it also provides the best modularity. Symfony also uses models and controllers to develop Web applications, which may seem dull in many developers ' eyes, but it works. In addition, Symfony is a good example of modular frame construction. You can use the 30 components that it provides in your project in a modular way.

Yii uses the MVC framework. (Symfony provides MVC support and can learn more details in the IS Symfony2 a MVC framework.) )

Symfony can be used to quickly develop complex projects. Even if there is a dispute about which framework is more beneficial to complex projects, Symfony has the ability to handle complex things better than other frameworks. Yii also uses components, but it is not as modular as symfony. Laravel compared to the other two frames, the modular approach to it is not so sharp.

If you are looking for a modular frame, choose Symfony, or Laravel,yii is a good choice.

Installation

These three frameworks provide multiple installers. If you're using composer for handling packages, that's great, because they're all three available to install through composer.

In Symfony, the role of composer is more critical. The best way to handle the component is to use this: Composer PHP dependency manager (Composer PHP dependency manager)

There are other ways to install the respective frameworks. For example, you can use a simple archiving method to install the framework. After installation, YII provides you with a Web application and a basic template. Symfony 2 also provides a demo program to start working on.

Laravel can also be installed quickly by using composer to create a project or Laravel installer. Check out the Laravel Installation guide for more laravel installation instructions.

Rapid development

From a company or customer perspective, it is important to quickly launch applications to market to meet consumer demand and to defeat competitors. Symfony stands out because it is a powerful framework with strong community support. Laravel is developing fast, but there is still a long way to go before it can be seen as an inevitable choice for PHP development. On the other hand, if you do not have any knowledge of PHP framework and want to get started as soon as possible, consider laravel. Laravel's learning process is simple and you will find many tutorials online to help you get started. Yii increases performance to a new level and provides code scaffolding for faster code generation and development.

Performance

The performance of any one application is important only if it is a real-time application that uses critical data. How many web-based applications depend on high performance? Not many, but the performance of the framework plays a key role in many projects.

Social networks are a major example of real-time events. Jadson created a mobile social network using YII2. When it comes to choosing the best framework for writing high-performance application code, YII is the fastest PHP framework to become a prominent choice.

The performance of Laravel is very questionable. It's the slowest, but what does it matter? You can find many accelerated performance resources on the web, such as guide on GitHub, which can speed up your laravel application.

Database support

Symfony 2 provides better database support. You can use a range of database work, including NoSQL and Dynamodb. Yii and Laravel are also useful in this regard, but they support fewer databases than symfony. The database supported by each framework is shown in table 1.

Community and Resources

Predicting the life expectancy of an open source framework depends on its community advantage. Three frameworks have a solid community, although the symfony may be a bit more mature. The community is developing, so it is challenging to predict the future dynamics of the community.

When it comes to learning materials and documents, Laravel is the most prominent, although Symfony and yii are not inferior:

    • Laravel Documentation
    • Syfony Documents (3.0)
    • Yii Documentation
  Scalability

Frameworks are structures that can be extended with extensions or packages, improving their functionality and scope. When it comes to expansion, Laravel is the winner. Packalyst, which is the directory of the Laravel package, offers more than 9,000 packages. Yii and symfony provide approximately 2,800 extensions and 2,830 packages respectively. Laravel are 3 times times as much as they are, so laravel seems to be the best framework in this regard.

  Similarity Point

We've covered the differences between frames. Now let's take a look at their similarities:

    • Three frameworks are all-stack PHP development framework, providing network application creation function, from the writing of front-end code to back-end data retrieval.
    • The project is open source and its source code can be found on GitHub, making it easy for anyone to contribute:
      • Symfony
      • Laravel
      • Yii
    • The framework is well documented and supported by a large community.
    • They all support ORM (Object Relational mapping). ORM is popular when writing OO code for an application.
    • They are powerful, secure, and reliable, used to create Web 2.0 applications.

Are you still feeling confused? The following list may help you narrow down your options:

Symfony:

    • Available in an LTS version
    • With load function
    • is the most stable framework at the moment.
    • is a component-based framework that provides a wealth of modularity
    • Has an excellent community, providing a wealth of learning resources

YII:

    • Comes with Ajax support
    • Ideal for developing real-time applications because it's faster to operate
    • is highly scalable
    • Can handle errors with accuracy
    • Ideal for creating a quiet Web service
    • Has an excellent community, providing a wealth of learning resources

Laravel:

    • is the most popular framework of the 2015-2016.
    • Provide support package management for designers
    • Excellent Complete unit Testing
    • Provides a rich package for extending framework functionality
    • Has an excellent community, providing a wealth of learning resources

Concluding remarks

These three PHP frameworks are good choices for symfony, Laravel, and Yii, providing developers with a full stack development environment. For me personally, Laravel is better, as a new "frame Star", there is no sign of stopping.

However, both Symfony and Yii are excellent frameworks. Symfony is effective and has a larger, more mature community. Yii is a unique framework that is powerful, secure, and capable of accomplishing work.


Original from: Blog Park/cherry0327

3 different frameworks for PHP

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.