使用Composer安装Laravel
安装Laravel
以windows为例,首先在cmd中执行查询库:
composer search laravel
会发现出现一大堆:
laravel/laravel The Laravel Framework.
laravel/framework The Laravel Framework.
spatie/laravel-permission Permission handling for Laravel 6.0 and up
fruitcake/laravel-cors Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application
barryvdh/laravel-ide-helper Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.
barryvdh/laravel-debugbar PHP Debugbar integration for Laravel
tymon/jwt-auth JSON Web Token Authentication for Laravel and Lumen
nunomaduro/collision Cli error handling for console/command-line PHP applications.
maatwebsite/excel Supercharged Excel exports and imports in Laravel
laravel/tinker Powerful REPL for the Laravel framework.
laravel/socialite Laravel wrapper around OAuth 1 & OAuth 2 libraries.
intervention/image Image handling and manipulation library with support for Laravel integration
facade/ignition A beautiful error page for Laravel applications.
livewire/livewire A front-end framework for Laravel.
fideloper/proxy Set trusted proxies for Laravel
我们再show一下显示其详细信息,执行:
composer show --all laravel/laravel
name : laravel/laravel
descrip. : The Laravel Framework.
keywords : framework, laravel
versions : dev-master, 8.x-dev, .... // 当前最新的版本是8.x
安装laravel
比如5.2版本安装介绍界面:https://laravel.com/docs/5.2
如果是安装最新版本
D:\..\composer>composer create-project --prefer-dist laravel/laravel 项目文件名
如果要指定下载的版本(指定下载5.2版本的)
composer create-project --prefer-dist laravel/laravel 文件夹名称 "5.2.*"
之后本地访问:https://localhost/composer/laravel01/public/ 如果成功打开,代表安装成功。
使用安装器进行安装
composer global require "laravel/installer"
将~/.composer/vendor/bin目录添加到path变量中。(这里不是很懂以下奉上原文)
Make sure to place the~/.composer/vendor/bin
directory (or the equivalent directory for your OS) in your PATH so thelaravel
executable can be located by your system.
接着在目标文件夹内执行
D:\...\composer>laravel new 项目文件夹名称
如果要下载最新的版本,在已经下载了下载器的前提下,直接执行:
laravel new 项目文件夹名称 --dev // 下载最新的dev版本