Explanation of the latest Laravel in 2021 from entry to core architecture

1. The prerequisite for learning Laravel framework must install and configure the PHP environment

For the php environment on Windows, refer to "Configuring the PHP Development Environment with xmapp under Windows", and for the environment on Linux, refer to the "LNMP Installation Manual".

After the php environment is configured, download the composer tool. It is recommended to install it directly in the same directory as php.exe, or copy the contents to the php.exe directory after installation, so that you can directly execute the composer command.

After the installation is complete, use the git-bash tool to enter the installation directory, execute the ./composer command, you can see the version that the installation is successful.

2. Install Laravel

Modify the image and add the configuration information to Composer's global configuration file config.json

cd /c/Users/Administrator/AppData/Roaming/Composer
composer config -g repo.packagist composer https://packagist.phpcomposer.com

Install laravel method one: (unsuccessful)

Install laravel method one: (unsuccessful) 
1. Install Laravel installer through Composer: 
composer global require "laravel/installer" 
2. After installation, you can use laravel new project name

The second way of installing laravel:

Install laravel method two: 
composer create-project --prefer -dist laravel/laravel project name 
Specify version 
composer create-project --prefer -dist laravel/laravel project name 5.6.39

3. Access test

After installing the Laravel project (such as the installed project path F:\PHP\laravel), you need to point the document/web root directory of the Web server to the public directory of the Laravel application. The index.php file in this directory serves as the front controller (single Entry), all HTTP requests will enter the application through this file.

Specific steps: refer to "Configure PHP Development Environment with xmapp under Windows"

3.1 Modify the D:\xampp\apache\conf\extra\httpd-vhosts.conf configuration file to add a site

<VirtualHost *:80>
    DocumentRoot "F:/PHP/laravel/public"
    ServerName mylaravel.com

3.2 Modify C:\Windows\System32\drivers\etc\host file to add one mylaravel.com

3.3 Restart the apache server in the xmapp tool

3.4 Enter mylaravel.com in the browser to access the laravel project just created

The visited page rendering is the resources/views/welcome.blade.php file

4. Laravel learning

Follow the "PHP God" WeChat public account, reply to "Laravel" to receive a full set of free video tutorials

Guess you like

Origin blog.51cto.com/15115111/2665132