Home > Backend Development > PHP Tutorial > PHP development framework: Laravel

PHP development framework: Laravel

WBOY
Release: 2016-07-25 09:12:30
Original
951 people have browsed it

Laravel is a simple and elegant PHP web development framework (PHP Web Framework). It can free you from messy codes like noodles; it can help you build a perfect network APP, and every line of code can be concise and expressive.

Features

1. Grammar is more expressive

Do you know what “true” means in the following line of code?

$uri = Uri::create(‘some/uri’, array(), array(), true);

Also, do you know what the other parameters here mean (except the first one)? Of course you don't know. Because this line of code is not expressive.

Look at this code again:

$url = URL::to_secure(‘some/uri’);

This expression creates a URL link using the HTTPS protocol. In fact, the above two ways of writing are doing the same thing, but which one is more clear and expressive?

2. High-quality documents

One of the reasons why CodeIgniter is so popular is that it has good documentation. This is very convenient for programmers. In comparison, Kohana is a technically superior framework than CI, but guess what? No one cares about how strong Kohana's technology is, because Kohana's documentation is really bad. And Laravel has a great community support. The expressiveness and good documentation of the Laravel code itself make PHP programming a pleasure.

3. Rich expansion packs

Bundle is the name for extension package in Laravel. It can be anything - as large as a complete ORM, as small as a debug tool, or just copy & paste to install any extension! Laravel's extension packs are contributed by developers from all over the world, and more are constantly being added.

4. Open source and hosted on GITHUB

Laravel is completely open source. All code is available on Github, and you are welcome to contribute.

Technical Features

1. Bundle is the organization form or name of Laravel’s expansion package. Laravel's extension package repository is quite mature and can easily help you install extension packages (bundles) into your application. You can choose to download an extension package (bundle) and copy it to the bundles directory, or install it automatically through the command line tool "Artisan".

2. Laravel already has an advanced PHP ActiveRecord implementation -- Eloquent ORM. It can easily apply "constraints" to both sides of the relationship, so that you have complete control over the data and enjoy all the conveniences of ActiveRecord. Eloquent natively supports all methods of the query builder (query-builder) in Fluent.

3. Application logic can be implemented in controllers or directly integrated into route declarations, and the syntax is similar to the Sinatra framework. Laravel's design philosophy is to give developers maximum flexibility, allowing them to create very small websites and build large-scale enterprise applications.

4. Reverse Routing gives you the ability to create links (URIs) through route names. Just use the route name and Laravel will automatically create the correct URI for you. This way you can change your routes at any time, and Laravel will automatically update all related links for you.

5. Restful Controllers are an optional way to distinguish GET and POST request logic. For example, in a user login logic, you declare a get_login() action to process the service of obtaining the login page; you also declare a post_login() action to verify the data POSTed from the form, and After validation, a decision is made to redirect to the login page or to the console.

6. Class Auto-loading simplifies the loading of classes. In the future, you no longer need to maintain the auto-loading configuration table and unnecessary component loading. When you want to load any library or model, just use it immediately, and Laravel will automatically load the required files for you.

7. View Composers are essentially a piece of code that will be automatically executed when the View is loaded. The best example is the random article recommendation on the side of the blog. The "view assembler" contains the logic for loading the random article recommendation. In this way, you only need to load the view of the content area, and Laravel will do the other things. Complete it automatically for you.

8. The reverse control container (IoC container) provides a convenient way to generate new objects, instantiate objects at any time, and access singleton objects. Inverse control (IoC) means that you almost don't need to load external libraries (libraries), you can access these objects anywhere in the code, and you don't need to endure complicated and redundant code structures.

9. Migrations is like a version control tool, but it manages the database paradigm and is directly integrated into Laravel. You can use the "Artisan" command line tool to generate and execute "migration" instructions. When your team members change the database paradigm, you can easily update the current project through the version control tool, and then execute the "migrate" command. Well, your database is already up to date!

10. Unit-Testing is a very important part of Laravel. Laravel itself contains hundreds of test cases to ensure that any modification will not affect the functionality of other parts. This is one of the reasons why Laravel is considered the most stable version in the industry. Laravel also provides convenient functions to make unit testing your own code easy. All test cases can be run through the Artisan command line tool.

11. The Automatic Pagination function avoids mixing a large amount of irrelevant paging configuration code into your business logic. The convenience is that you don't need to remember the current page, just get the total number of entries from the database, then use limit/offset to get the selected data, and finally call the 'paginate' method to let Laravel output the links of each page to the specified view ( View), Laravel will automatically complete all the work for you. Laravel's automatic paging system is designed to be easy to implement and easy to modify. Although Laravel can handle these tasks automatically, don't forget to call the corresponding methods and manually configure the paging system!

Project homepage: http://www.open-open.com/lib/view/home/1393898144240



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template