Home >PHP Framework >Laravel >About the initial installation of Laravel

About the initial installation of Laravel

藏色散人
藏色散人forward
2020-03-04 15:25:503253browse

Laravel initial installation

composer installation

composer Chinese mirror:https:// www.phpcomposer.com/

laravel documentation:https://www.php.cn/course/1061.html

curl -sS https://getcomposer.org/installer | php
# 修改 composer 的全局配置文件,修改为中国源
composer config -g repo.packagist composer https://packagist.phpcomposer.com

Install Laravel

Laravel uses Composer to manage dependencies. So, before using Laravel, make sure you have Composer installed on your machine.

There are two ways to follow laravel.

Through the Laravel installer

First, download the Laravel installer using Composer:

composer global require "laravel/installer"

Make sure $HOME/ The .composer/vendor/bin directory (or the equivalent for your operating system) is already placed in your environment variable $PATH so that the system can find the laravel executable.

After installation, the laravel new command will create a new Laravel project in the directory you specify. For example, the laravel new blog command will create a directory named blog, which contains all installed Laravel dependencies:

laravel new blog

Create project through Composer

Alternatively, you can also install Laravel by running the create-project command in the terminal:

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

Local Development Server

If you have PHP installed locally and want to To use PHP's built-in development server to serve your application, use the Artisan command serve. This command will start the development server at http://localhost:8000:

php artisan serve

The above is the detailed content of About the initial installation of Laravel. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete