Laravel framework installation

Source: Internet
Author: User
Tags composer install
Laravel framework installation portal: goofyy technology House

Laravel-simple and elegant PHP Development Framework (PHP Web Framework)


PHP is an excellent language. when php encounters the Laravel framework, it is easy. the Laravel framework is the highest framework in the PHP Framework rankings. The first step is to install the Laravel framework. many new users are stuck in this step.

First, write down the development environment of Xiaobian:

Installation environment:

Operating system: Mac OS X10.10.4

Database: mysql 5.5.16

PHP: 5.5.24

The small editor uses Laravel5.1. The PHP version must be> = 5.5.9 Mysql 5.1 +

OpenSSL PHP extension-pdo php extension-Mbstring PHP extension-Tokenizer PHP extension

Install Laravel

Laravel can be installed in three ways.

Install composer

Composer is a tool used in PHP to manage dependencies. You can declare the dependent external library (libraries) in your project. Composer will help you install these dependent library files.

Run:


composer create-project laravel/laravel learnlaravel5
Terminal execution. the composer manager downloads the corresponding dependencies and libraries. The current path generates a learnlaravel5 folder. After downloading, you need to grant sufficient permissions to the corresponding directory. the web server must have write permissions to all directories under the storage directory and the bootstrap/cache directory. If you are using the Homestead virtual machine, these permissions have been set for you.


Set the root directory of the website to learnlaravel5/public.


php -S localhost:8000 -t public 
Specify port 8000 of localhost to point to the public directory. Enable the server. A prompt is displayed when the execution is successful.



goofy-2:blog goofygao$ php -S localhost:8000 -t publicPHP 5.5.24 Development Server started at Thu Jul 30 16:58:16 2015Listening on http://localhost:8000Document root is /Users/goofygao/laravel/blog/publicPress Ctrl-C to quit.


The artisan tool in the root directory can also enable the service. Root Directory execution


Php artisan serve also enables services


Then, access http: // localhost: 8000 in the browser.

Use Laravel installer

Download the Laravel installer from the composer installer


composer global require "laravel/installer=~1.1"
Make sure that ~ /. Composer/vendor/bin is in the system PATH, so that the laravel command can be correctly executed. After the installation is complete, you only need to execute the laravel new command to create a new laravel installation in the current directory:



laravel new blog
Many of my friends died at this step because everyone knows the reason. So you can flip it.


After the execution is complete, a blog directory is generated. The installation is successful. Pay attention to the permissions.

Source code installation

Download the Laravel source code package from github or the Laraverl website, decompress the package, and install it.

: Http://www.golaravel.com/download/

Let's take a look at the decompressed file composer. json. This file is mainly used by composer to download Laravel dependencies and configuration information.

If you want to add the corresponding configuration information, you can download the configuration from the https://packagist.org/this site.

For example, I want to add mail configuration information. You only need to search for mail. Select a version. Add configuration information in composer. json.


require nette/mail


Add composer. json.

Then run


php composer.phar install
Or



composer install
To update the file, run the following command:
php composer.phar update

After the installation is complete, you can access it according to the above configuration.

Below are some simple configurations. Modify the Key configuration.

After Laravel is installed, you need to set a random string as the key of the application ). If you installed Laravel through the Composer or Laravel installer, this key has been automatically generated and set by the key: generate command. Generally, the length of the string used as the key is 32 characters. You can also set this key in the. env environment configuration file. If you haven't changed the. env. example file to. env, do it now. If the application key is not configured, the session and other data to be encrypted will be insecure!

Terminal execution:


php artisan key:generate
Generate a Key.


The following figure shows the database configuration. The database used in the root directory/config/database. php. is mysql. So the configuration is as follows:


'mysql' => [            'driver'    => 'mysql',            'host'      => env('DB_HOST', 'localhost'),            'database'  => env('DB_DATABASE', 'laravel'),            'username'  => env('DB_USERNAME', 'root'),            'password'  => env('DB_PASSWORD', 'secret'),            'charset'   => 'utf8',            'collation' => 'utf8_unicode_ci',            'prefix'    => '',            'strict'    => false,        ],
The basic configuration is complete. The ground is under construction.


Digress: The editor is not saved in the middle. it is also very drunk. In the next few days, I will seriously discuss the Laravel framework. Come on. The blog will keep up with you.


Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.