Some PHP frameworks

Source: Internet
Author: User
Tags php framework php template hosting hosting companies yii
PHP is one of the most popular programming languages in the world and is widely used in major projects. For example, Facebook uses PHP to create and maintain their internal systems, and WordPress's internal PHP-based, in return, provides technical support for more than 26% of its websites. Now PHP has provided support for more than 82% sites (the server-side programming language that WEB technology surveys sites can track).

This article will help you find the most appropriate PHP framework by comparing 3 of the most popular PHP frameworks: Symfony, Laravel, and Yii.

Why Choose PHP Framework?

Here are some of the benefits of using the PHP framework for development:

    • The PHP framework makes development faster. For example, you do not need to write complex query operations to retrieve data from a database, and PHP provides operations to add (Create), read (Retrieve) (re-get data), update, and delete.

    • Frameworks can make it easier for developers to extend the system.

    • Code maintenance is easier than normal PHP applications. The application code will be more concise.

    • The MVC pattern ensures rapid development.

    • Framework to better protect Web applications from common security threats.

    • The DRY (Don ' t Repeat yourself) principle makes the least amount of code work.

The benefits listed above are of great importance. Although native PHP can be used to write any application, today's development requires more tools and time management skills to meet the needs of the market.

How to choose a suitable PHP framework?

Answering the questions below will help you to better select a suitable framework:

    • What are the features and functions of this framework? (Does it provide what I need?) )

    • What is the learning curve of this framework?

    • What is the scalability of this framework?

    • Does this framework have a positive effect on the development and maintenance of the coding team?

    • Does this framework provide a long-duration support version (LTS supports)?

    • Is there a strong community support for this framework?

Symfony, Laravel and Yii overview

Before delving into the technical details, let's start with an overview of the three:

Symfony

Symfony is a reusable PHP component that enables developers to develop scalable, high-performance applications. It has 30 components to choose from, and developers are free to experiment or work in a RAD environment.

Some of the more famous projects, like Drupal and PhpBB, use the Symfony framework. In fact, another PHP pop-up framework Laravel is also built from Symfony.

Laravel

The PHP framework for WEB Artisans--laravel, as the most popular PHP framework, provides developers with an excellent community communication platform (one of Laravel's founders is Livecoding.tv Sfiskell).

The 5.1 release of May 2015 Laravel will provide a long-duration support version (two years). The 5.2 version was also introduced to the market in December 2015. Many hosting companies offer Laravel support and Laravel application hosting solutions.

Yii

People Manggold J in 2008, Yii was created as a secure, fast, high-performance application/WEB development framework. Yii uses PHP's composer dependency manager to handle different dependencies and installations (as we'll talk about below). Lazy-loading technology (loading technique) makes YII the fastest PHP framework.

Another good feature of YII is the integration of JQuery, which allows front-end developers to work faster on the ground, using scaffolding to generate code. Yii, like Symfony, uses components to make application development faster.

Symfony, Laravel and Yii comparison

These three frameworks are very much built to develop WEB 2.0 applications, but their focus is different. Let's take a look at their respective features and installation:

Template engine

The template engine relieves the developer of the burden and provides better functionality when writing the 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 flexible, fast and secure PHP template language. The advantage of Symfony is that Twig is used to enable developers to write clean, uncluttered code, and to use native PHP for more functionality. For example, the following lengthy code implements escape (escaping):



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

Twig can use the following code to achieve the same functionality:



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

You can go to the Twig homepage to see more features.

Laravel Blade Template System

Unlike other templating systems, Blade allows you to use PHP code in your views. Also, because the blade view file is stored in the. blade.php extension, the performance loss of blade for your application is 0. All the code inside the view file can be converted to native PHP during the process.

Yii Default Template system

YII does not use any third-party templating system by default, but this does not mean that it lacks support for the template system, and the choice of template system depends on the development team, recommending Twig and Smarty. Symfony uses Twig, so if you've used Symfony before, you might want to choose Twig as your next Yii project.

It's hard to define the best of the paragraph. All three frameworks utilize a templating system to better write and maintain the front end. One small advantage of Yii is that it does not have a pre-defined template system.

Differences in frame

Each framework is built differently. Symfony is committed to reusable components and provides the best modularity. In addition, Symfony uses modules and controllers to develop WEB applications, which may discourage some novice developers. In addition, Symfony is a good example of a modular structure where you can use the 30 components provided by Symfony in your project in a modular way.

Yii uses the MVC framework. (Symfony also supports the MVC architecture, see the blog.sznapka.pl website is Symfony2 a MVC framework for a more detailed discussion)

Symfony can be used for rapid development of complex projects. If the framework is best suited for complex projects, Symfony has a very good ability to handle complex processes compared to other frameworks. YII also utilizes components, but not the same as the Symfony module. Laravel does not provide a modular approach, but works just as well as the other two frameworks.

If you are looking for a modular framework, choose Symfony. Otherwise, Laravel and Yii are good choices.

Installation

These three frameworks provide multiple installation procedures, and if you use Composer to process packages, you will find that all of the frameworks can be installed through Composer.

For Symfony, the role of Composer is particularly important. Because the Composer dependency manager using PHP is a good helper for working with components.

Of course there are other ways to install the framework, such as using a simple archiving method.

After installation, YII will provide a WEB application and a basic template to help you develop; Symfony 2 provides a starting demo application, and the Laravel installer installs and uses Composer to create projects, making Laravel easy to install and use. For more information, see the Laravel Installation Guide.

Development

From a company or customer perspective, it is important to quickly bring applications to market to meet consumer demand and defeat competitors. Symfony has a strong community support behind it, and Laravel is growing fast, and it's still a long way from being fully recognized by developers. In addition, if you do not know any PHP framework, and want to choose a suitable for you as soon as possible, Laravel is a good choice, it has a simple learning curve, and there are many online tutorials to help you start using. Yii increases performance to a new level and provides a code scaffolding for faster generation and development of code.

Performance

The performance of any application is only meaningful if it uses real-time applications for critical data. How many Web-based applications depend on high performance? Not much, but the performance of the framework can play a key role in many projects.

Social networking is a prime example of real-time events, and one of our star streaming media,--jadson, uses YII2 to build a mobile social network. The fastest PHP framework Yii is undoubtedly the best choice for high-performance application coding frameworks.

The performance of Laravel is very controversial. It's the slowest, but is it important? You can find many online resources for accelerating performance, including the GitHub Guide for making Laravel applications faster.

Database support

Symfony 2 provides better database support. You can use database arrays, including NoSQL and DynamoDB. Yii and Laravel also support databases, but the supported databases are less than Symfony. The databases supported by each framework are shown in table 1.

Table 1


Community and Resources

Community power is an important predictor of the lifetime of open source frameworks. These three frameworks have their own fixed community, Symfony relatively mature. Communities continue to evolve, making it difficult to predict the dynamics of future communities.

Laravel is best at learning materials and documentation, and Symfony and Yii are not bad:

    • Laravel Documentation

    • Symfony Documents (3.0)

    • YII Documentation

Scalability

Frameworks are structures that can be carried out or extended, improving their functionality and scope. Laravel is a well-deserved winner in this respect. Packalyst is the directory of the Laravel software package and provides more than 9,000 packages. Yii and Symfony, respectively, provide approximately 2,800 extensions and 2,830 bundles. Laravel is the best framework for this, with its three times-fold expansion beyond the other two.

Similarities between Symfony, Laravel and Yii

We studied the differences between the frameworks. Now let's look at their similarities:

1. The three frameworks are all-stack PHP frameworks and provide the ability to write from the front-end code of the WEB application to the back-end data retrieval.

2. These projects are open source, their source code can be found on GitHub, and everyone can easily contribute their own codes:

    • Symfony

    • Laravel

    • Yii

3. These frameworks are well documented and supported by large communities.

4. They each support ORM (Object relational mapping). ORM is very fond of writing object-oriented code for applications.

5. It is safe and reliable to use them to create WEB 2.0 applications.

Still can't choose? Perhaps these checklists can help you narrow down your choices:

Symfony:

    • Available in LTS versions,

    • With load function,

    • is currently the most stable framework,

    • is a component-based framework that provides a wide range of modularity,

    • Have a strong community and a lot of learning resources

YII:

    • Comes with Ajax support

    • Ideal for developing real-time applications

    • Highly scalable

    • Accurate error Handling

    • Good at creating Restful Web Services

    • Have a strong community and a lot of learning resources

Laravel:

    • The most popular framework of the 2015-2016

    • Support Composer for package management

    • Be good at Unit testing

    • Provides a number of packages to extend the framework functionality

    • Have a strong community and a lot of learning resources

Conclusion:

The Symfony, Laravel, Yii three PHP frameworks are excellent options for developers to provide a full stack development environment. I think Laravel is the biggest winner, and I'm still constantly growing.

However, both Symfony and Yii are excellent frameworks. Symfony is more mature and has a larger, more mature community. Yii is a unique and reliable framework for the work to be done in a robust and secure manner.

Other resources

    • Symfony2 vs Yii2:which Development framework should you choose?

    • PHP Frameworks for Developers

    • It ' s Laravel 5.1 for Enterprise development

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.