Windows 10 で仮想環境を使わずに Laravel 5.6 を動かす手順。
他のバージョンでも大体同じかと思います。
PHP インストール
https://windows.php.net/download
VC15 x64 Thread Safe の zip をダウンロードして解凍。
解凍されたフォルダーを php にリネームして C:\ 直下へ移動。
php.ini-development をコピーして php.ini 作成。
C:\php へ path を通す。 Windows 10 でのやり方はこちら
PowerShell を開いてバージョンを確認。※既に開いている場合は再起動してください
PS C:\Users\SnowCait> php -v PHP 7.2.6 (cli) (built: May 23 2018 20:29:41) ( ZTS MSVC15 (Visual C++ 2017) x64 ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies |
Composer インストール
https://getcomposer.org/download/
Composer-Setup.exe をダウンロードして実行。
PowerShell を開いてバージョンを確認。※既に開いている場合は再起動してください
PS C:\Users\SnowCait> composer --version Composer version 1.6.5 2018-05-04 11:44:59 |
Laravel インストーラーのインストール
https://laravel.com/docs/5.6/installation
PowerShell で composer global require "laravel/installer"
を実行。
PS C:\Users\SnowCait> composer global require "laravel/installer" Changed current directory to C:/Users/SnowCait/AppData/Roaming/Composer Using version ^2.0 for laravel/installer ./composer.json has been created Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 10 installs, 0 updates, 0 removals - Installing symfony/process (v4.1.0): Downloading (100%) - Installing symfony/polyfill-ctype (v1.8.0): Downloading (100%) - Installing symfony/filesystem (v4.1.0): Downloading (100%) - Installing symfony/polyfill-mbstring (v1.8.0): Downloading (100%) - Installing symfony/console (v4.1.0): Downloading (100%) - Installing guzzlehttp/promises (v1.3.1): Downloading (100%) - Installing psr/http-message (1.0.1): Downloading (100%) - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%) - Installing guzzlehttp/guzzle (6.3.3): Downloading (100%) - Installing laravel/installer (v2.0.1): Downloading (100%) symfony/console suggests installing symfony/event-dispatcher () symfony/console suggests installing symfony/lock () symfony/console suggests installing psr/log-implementation (For using the console logger) guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware) Writing lock file Generating autoload files |
バージョンを確認。
PS C:\Users\SnowCait> laravel --version Laravel Installer 2.0.1 |
Laravel プロジェクトの作成
適当なフォルダーに移動して laravel new
コマンドでプロジェクトを作成。
laravel new blog
を実行すると blog
フォルダーが作成されます。
PS C:\Users\SnowCait> mkdir Projects PS C:\Users\SnowCait> cd .\Projects\ PS C:\Users\SnowCait\Projects> laravel new blog Crafting application... Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Package operations: 70 installs, 0 updates, 0 removals - Installing doctrine/inflector (v1.3.0): Downloading (100%) (長いので省略) |
プロジェクトフォルダーに移動してバージョンを確認。
PS C:\Users\SnowCait\Projects> cd .\blog\ PS C:\Users\SnowCait\Projects\blog> php artisan --version Laravel Framework 5.6.25 |
php artisan serve
コマンドでサーバーを立ち上げ。
http://127.0.0.1:8000 にアクセス。
PS C:\Users\SnowCait\Projects\blog> php artisan serve Laravel development server started: <http://127.0.0.1:8000> |
以上で Laravel を動かすことができました。