1, server Requirements
The Laravel framework has a small number of requirements for the server and, of course, Laravel Homestead has met all of these requirements, so we strongly recommend using Homestead as the Laravel Local development environment (Mac can also use valet as a 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 Extensions: OpenSSL
PHP Extensions: PDO
PHP Extensions: mbstring
PHP Extensions: Tokenizer
2. Installation Laravel
Laravel uses Composer management dependencies, so before using Laravel, make sure that Composer is already installed on the machine.
Through the Laravel installer
First, install the Laravel installer via Composer:
composer global require "laravel/installer"
Make sure ~/.composer/vendor/bin is in the system path, otherwise you cannot invoke the Laravel command on any path.
Once the installation is complete, a new Laravel application can be created in the current directory with a simple laravel new command, for example, laravel new blog will create an application called a blog and contain all laravel dependencies. This installation method is much faster than through Composer installation:
laravel new blog
PassComposer Create-Project
You can also install Laravel applications in the terminal via the Composer create-project command:
composer create-project --prefer-dist laravel/laravel blog
3, configuration
All configuration files for the Laravel framework are stored in the Config directory, and each configuration item is commented, so you can browse any profile to familiarize yourself with these configuration items.
Public directory
After installing Laravel, you need to point the Web root directory of the HTTP server to the public directory, where the index.php file will be the front-end controller, and all HTTP requests will be entered into the application through that file.
Configuration file
All configuration files for the Laravel framework are stored in the Config directory, and all configuration items are commented, so you can easily navigate through the profiles to familiarize yourself with all the configuration items.
Directory Permissions
After installing Laravel, you need to configure some directory read and write permissions: The storage and Bootstrap/cache directories should be writable, and if you use the Homestead virtual machine as the development environment, these permissions are already set.
Apply Key
The next thing to do is to set the applied key (App_key) to a random string, and if you install it through the Composer or Laravel installer, the value of the key is already generated through the PHP artisan key:generate command.
Typically, the string should be 32 bits long, configured with the App_key in the. env file, and if you haven't renamed the. env.example file to. env, do so now. If the application key is not set, user session and other encrypted data will have security implications.
More Configuration
Laravel almost no longer requires any other configuration to work, but you'd better look at the config/app.php file, which includes configurations based on applications that might need to be changed, such as timezone and locale (for configuring time zones and localization, respectively).
You may also want to configure some of the other components of laravel, such as caching, database, session, and so on, which we will explore in subsequent document one by one.
Once the installation is complete, you can go to the next step-configure Laravel.