Laravel安装环境要求:
Laravel 框架对系统有一些要求。所有这些要求 Laravel Homestead 虚拟机都能满足,因此强烈建议你使用 Homestead 作为你本地的 Laravel 开发环境。
但如果你不使用 Homestead,则需要确保你的服务器符合以下要求:
- PHP >= 7.0.0(请php环境变量配置好)
- PHP OpenSSL 扩展
- PHP PDO 扩展
- PHP Mbstring 扩展
- PHP Tokenizer 扩展
- PHP XML 扩展
安装 Laravel
Laravel 利用 Composer 来管理依赖。所以,在使用 Laravel 之前,请确保你的机器上安装了 Composer。
安装Composer:直接下载安装,下一步...下一步,会在C盘符下:
cmd:进入,输入:composer -v 命令查看,出现如下图,安装成功!
通过 Laravel 安装器
首先,使用 Composer 下载 Laravel 安装程序:
composer global require "laravel/installer"
如果是windows下安装,安装程序会在目录:
C:UsersAdministratorAppDataRoamingComposer
安装命令执行如下:
Administrator@PC-20190222QKVD MINGW64 /g/PhpStudy/PHPTutorial/WWW
$ composer global require "laravel/installer"
Changed current directory to C:/Users/Administrator/AppData/Roaming/Composer
Using version ^2.1 for laravel/installer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 14 installs, 0 updates, 0 removals
- Installing symfony/process (v4.3.4): Downloading (100%)
- Installing symfony/polyfill-ctype (v1.12.0): Downloading (100%)
- Installing symfony/filesystem (v4.3.4): Downloading (100%)
- Installing psr/container (1.0.0): Downloading (100%)
- Installing symfony/service-contracts (v1.1.6): Downloading (100%)
- Installing symfony/polyfill-php73 (v1.12.0): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.12.0): Downloading (100%)
- Installing symfony/console (v4.3.4): Downloading (100%)
- Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
- Installing ralouphie/getallheaders (3.0.3): Downloading (100%)
- Installing psr/http-message (1.0.1): Downloading (100%)
- Installing guzzlehttp/psr7 (1.6.1): Downloading (100%)
- Installing guzzlehttp/guzzle (6.3.3): Downloading (100%)
- Installing laravel/installer (v2.1.0): Downloading (100%)
symfony/service-contracts suggests installing symfony/service-implementation
symfony/console suggests installing symfony/event-dispatcher
symfony/console suggests installing symfony/lock
symfony/console suggests installing psr/log (For using the console logger)
guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
Writing lock file
Generating autoload files
确保 $HOME/.composer/vendor/bin 目录(或你的操作系统的等效目录)已经放在你的环境变量 $PATH 中,以便系统可以找到 laravel 的可执行文件。
安装之后, laravel new 命令会在你指定的目录中创建一个新的 Laravel 项目。例如,laravel new laravel 命令会创建一个名为 laravel 的目录,其中包含所有已经安装好的 Laravel 的依赖项:
laravel new laravel:如下图,安装完成!
laravel框架运行:
发表评论 取消回复