Home > php教程 > PHP开发 > body text

Laravel 5.3 study notes installation

高洛峰
Release: 2016-12-22 16:00:08
Original
1039 people have browsed it

1. Server requirements

The Laravel framework has a few requirements for the server. Of course, Laravel Homestead has met all these requirements, so we strongly recommend using Homestead as the Laravel local development environment (for Mac, you can also use Valet as the local development environment) .

However, if you are not using Homestead, you need to ensure that the development environment meets the following requirements:

PHP version >= 5.6.4
PHP extension: OpenSSL
PHP extension: PDO
PHP extension: Mbstring
PHP extension: Tokenizer

2. Install Laravel

Laravel uses Composer to manage dependencies, so before using Laravel, make sure Composer is installed on the machine.

Through the Laravel installer

First, install the Laravel installer through Composer:

composer global require "laravel/installer"

Make sure ~/.composer/vendor/bin is in the system path, otherwise it cannot be called from any path laravel command.

After the installation is complete, you can create a new Laravel application in the current directory with a simple laravel new command. For example, laravel new blog will create a new application named blog and include all Laravel dependencies. This installation method is much faster than installing through Composer:

laravel new blog

Through Composer Create-Project

You can also install the Laravel application through Composer's create-project command in the terminal:

composer create-project --prefer-dist laravel/laravel blog

3. Configuration

All configuration files of the Laravel framework are stored in the config directory, and each configuration item has comments, so you can browse any configuration file to get familiar with it. these configuration items.

Public directory

After installing Laravel, you need to point the web root directory of the HTTP server to the public directory. The index.php file in this directory will serve as the front-end controller, and all HTTP requests will enter the application through this file.

Configuration files

All configuration files of the Laravel framework are stored in the config directory. All configuration items are commented, so you can easily browse these configuration files to become familiar with all configuration items.

Directory permissions

After installing Laravel, you need to configure the read and write permissions of some directories: the storage and bootstrap/cache directories should be writable. If you use the Homestead virtual machine as the development environment, these permissions have already been set.

Application Key

The next thing to do is to set the application key (APP_KEY) to a random string. If you installed it through Composer or Laravel installer, the value of the key has been passed php artisan key:generate The command is generated.

Normally, this string should be 32 bits long, configured via APP_KEY in the .env file, if you haven't renamed the .env.example file to .env yet, do so now. If the application key is not set, user sessions and other encrypted data will be compromised.

More configurations

Laravel almost does not need any other configuration to be used normally, but you'd better take a look at the config/app.php file, which contains some configurations that may need to be changed based on the application, such as timezone and locale (used to configure time zone and localization respectively).

You may also want to configure some other components of Laravel, such as cache, database, Session, etc. We will discuss these one by one in subsequent documents.

After the installation is complete, you can proceed to the next step - configuring Laravel.

For more Laravel 5.3 study notes and installation related articles, please pay attention to the PHP Chinese website!

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!