Objective:
Laravel5 is a PHP framework, known as "created for WEB artists," because of its simplicity, elegance and extensibility, and the increasing popularity of phper. According to the 2015 most popular PHP framework report, Laravel has become the most popular framework for developers.
Body:
-About Laravel Installation
For example, in a MAC environment, install Composer before installing Laravel, install Laravel by using Composer (note: Composer is a tool used in PHP to manage dependency (dependency) relationships. You can declare the dependent External tool library (libraries) in your project, and composer will help you install the dependent library files.
The way to install composer is simple, go to composer's official website, click the download option, and you can see there's a curl command
Copy this command to the Terminal (Command line tool), you can download a Composer.phar file here is recommended to download the composer after the command
Mvcomposer.phar/usr/local/bin/composer
Put this file into the Usr/local/bin directory and become a global directive for use when creating new directories later.
Using commands in the command-line tool after installing composer
Composercreat-projectlaravel/laravellaravel5
You can successfully install the Laravel
It is recommended to turn on the VPN before using the command
After successful installation, jump to laravel directory using the command CD laravel5/and use the artisan command
Phpartisanserve
will return an HTTP address, browse the address, you can jump out of a built-in Web page, to this step, the entire installation process is over.
-2-laravel's basic workflow
(Note: The concept of routing/Controller/view will be described in detail in a later article)
Each time the laravel is used, it is first booted into a routes.php file, which in the./app/http directory, the first open can see three lines of code
Route::get ('/', function () {return
These three lines of code define a route (you need to define a route before starting an HTTP program.) In the previous example, our business logic was implemented in the routing, which is no problem for simple Web sites or Web applications, and when we need to scale up, the program becomes complex, and layered business logic is more appropriate. At this time, we should use the controller)
Here the '/' refers to the root directory where the contents of the anonymous function are executed when the browser accesses the root directory
This time it is time to return to a view view, which is saved in the./resources/views Directory
The welcome here is a PHP file name, which represents a PHP
Now let's create a new controller in command line tool input command
Phpartisanmake:controllerhellocontroller
Back to the code editing interface, in the HTTP controllers directory can see the new controller, in the hellocontrollers can see the system automatically created a lot of methods, now we write this line of code in the index method
Return
And go back to routes.php to write this line of code
Similarly, access to the root directory will appear laravel welcome interface
The new line of code in routes refers to finding the index method in Hellocontroller after the root directory is accessed, @ can be understood as the calling method
So, about Laravel and the basic usage process introduced here,
The contents of the Laravel Easy start guide are not to be continued!
Please contact me to discuss more technical questions:)
PostScript: Learn Laravel's website recommendation
{1. http://www.golaravel.com/2.http://laravel-china.org/3.http://laravelacademy.org/about-us}