Laravel製軽量フレームワーク Lumen のインストール方法
前提
- Web サーバの設定は完了済み。
- Lumen コマンドを使用してインストールする。
インストール手順
- Lumen コマンドのインストール
- Lumen コマンドで新規アプリケーション作成
- インストール完了!
1. Lumen コマンドのインストール
composer で Lumenコマンドをグローバルインストール。
$ composer global require "laravel/lumen-installer=~1.0"
PATH を通す。
echo 'export PATH=$HOME/.composer/vendor/bin:$PATH' >> ~/.bashrc
確認してみる。
$ lumen Lumen Installer 1.0.2 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands: help Displays help for a command list Lists commands new Create a new Lumen application.
インストールできた!
2. Lumen コマンドで新規アプリケーション作成
プロジェクトディレクトリに移動。
$ cd /var/www/html
アプリケーション名を blog とし、Lumenコマンドで新規プロジェクト作成。
$ lumen new blog
次に .env.example をコピーして .env を作成する。
APP_KEY
は、
$ php -r "require 'vendor/autoload.php'; echo str_random(32).PHP_EOL;"
で吐き出された値を設定する。
APP_ENV=local APP_DEBUG=true APP_KEY=[your app key] APP_TIMEZONE=Asia/Tokyo DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=blog DB_USERNAME=[your db user name] DB_PASSWORD=[your db pass] CACHE_DRIVER=memcached QUEUE_DRIVER=sync
アクセスしてみる。
これでLumen のインストールは完了!
Laravel リファレンス[Ver.5.1 LTS 対応] Web職人好みの新世代PHPフレームワーク
- 作者: 新原雅司,竹澤有貴,川瀬裕久,大村創太郎,松尾大,丸山弘詩
- 出版社/メーカー: インプレス
- 発売日: 2015/12/04
- メディア: 単行本(ソフトカバー)
- この商品を含むブログを見る