Initial installation of laravel

Time:2021-8-25

Initial installation of laravel

Composer installation

Composer China image
Laravel documentation

curl -sS https://getcomposer.org/installer | php
#Modify the global configuration file of composer to Chinese source
composer config -g repo.packagist composer https://packagist.phpcomposer.com

Installing laravel

LaravelutilizeComposerTo manage dependencies. So, in useLaravelBefore, make sure your machine is installedComposer
There are two ways tolaravel.

Via laravel installer

First, download the laravel installer using Composer:

composer global require "laravel/installer"

ensure$HOME/.composer/vendor/binThe directory (or your operating system equivalent) has been placed in your environment variable$PATHSo that the system can findlaravelExecutable file.

After installation,laravel newThe command will create a new laravel project in the directory you specify. For example,laravel new blogThe command creates ablogDirectory containing all installed LaravelDependencies for:

laravel new blog

Creating projects through composer

Alternatively, you can also run in the terminalcreate-projectCommand to installLaravel

composer create-project --prefer-dist laravel/laravel blog "5.5.*"

Local development server

If you installed it locallyPHPAnd want to usePHPBuilt in development server to serve your application, useArtisancommandserve。 This command will behttp://localhost:8000Start the development server on:

php artisan serve