Laravel製軽量フレームワーク「Lumen」
lumenをcomposer経由でインストールする手順を記します。
(※既に空のプロジェクトディレクトリがある想定です。)
コマンド
$ composer create-project --prefer-dist laravel/lumen [option:directory_name]
上記のコマンドを対象のプロジェクトディレクトリに移動してから叩く
User@****** MINGW64 /c/xampp/htdocs/pj_dir (master)
$ composer create-project --prefer-dist laravel/lumen
Installing laravel/lumen (v5.5.0)
- Installing laravel/lumen (v5.5.0): Loading from cache
Created project in C:\xampp\htdocs\pj_dir\lumen
> php -r "copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 72 installs, 0 updates, 0 removals
- Installing symfony/polyfill-mbstring (v1.6.0): Downloading (100%)
- Installing symfony/event-dispatcher (v3.3.10): Downloading (100%)
- Installing psr/log (1.0.2): Loading from cache
- Installing symfony/debug (v3.3.10): Downloading (100%)
- Installing symfony/http-foundation (v3.3.10): Downloading (100%)
- Installing symfony/http-kernel (v3.3.10): Downloading (100%)
- Installing nikic/fast-route (v1.2.0): Downloading (100%)
- Installing mtdowling/cron-expression (v1.2.1): Downloading (100%)
- Installing monolog/monolog (1.23.0): Loading from cache
- Installing symfony/translation (v3.3.10): Downloading (100%)
- Installing nesbot/carbon (1.22.1): Loading from cache
- Installing psr/simple-cache (1.0.0): Downloading (100%)
- Installing psr/container (1.0.0): Downloading (100%)
- Installing illuminate/contracts (v5.5.17): Downloading (100%)
- Installing doctrine/inflector (v1.2.0): Downloading (100%)
- Installing illuminate/support (v5.5.17): Downloading (100%)
- Installing symfony/finder (v3.3.10): Downloading (100%)
- Installing illuminate/filesystem (v5.5.17): Downloading (100%)
- Installing illuminate/container (v5.5.17): Downloading (100%)
- Installing illuminate/events (v5.5.17): Downloading (100%)
- Installing illuminate/view (v5.5.17): Downloading (100%)
- Installing illuminate/translation (v5.5.17): Downloading (100%)
- Installing illuminate/validation (v5.5.17): Downloading (100%)
- Installing symfony/process (v3.3.10): Downloading (100%)
- Installing illuminate/database (v5.5.17): Downloading (100%)
- Installing symfony/console (v3.3.10): Downloading (100%)
- Installing illuminate/console (v5.5.17): Downloading (100%)
- Installing illuminate/queue (v5.5.17): Downloading (100%)
- Installing illuminate/pipeline (v5.5.17): Downloading (100%)
- Installing illuminate/pagination (v5.5.17): Downloading (100%)
- Installing illuminate/session (v5.5.17): Downloading (100%)
- Installing illuminate/http (v5.5.17): Downloading (100%)
- Installing illuminate/hashing (v5.5.17): Downloading (100%)
- Installing illuminate/encryption (v5.5.17): Downloading (100%)
- Installing illuminate/config (v5.5.17): Downloading (100%)
- Installing illuminate/cache (v5.5.17): Downloading (100%)
- Installing illuminate/bus (v5.5.17): Downloading (100%)
- Installing illuminate/broadcasting (v5.5.17): Downloading (100%)
- Installing illuminate/auth (v5.5.17): Downloading (100%)
- Installing laravel/lumen-framework (v5.5.2): Downloading (100%)
- Installing vlucas/phpdotenv (v2.4.0): Downloading (100%)
- Installing fzaninotto/faker (v1.7.1): Downloading (100%)
- Installing sebastian/version (2.0.1): Downloading (100%)
- Installing sebastian/resource-operations (1.0.0): Downloading (100%)
- Installing sebastian/object-reflector (1.1.1): Downloading (100%)
- Installing sebastian/recursion-context (3.0.0): Downloading (100%)
- Installing sebastian/object-enumerator (3.0.3): Downloading (100%)
- Installing sebastian/global-state (2.0.0): Downloading (100%)
- Installing sebastian/exporter (3.1.0): Downloading (100%)
- Installing sebastian/environment (3.1.0): Downloading (100%)
- Installing sebastian/diff (2.0.1): Downloading (100%)
- Installing sebastian/comparator (2.1.0): Downloading (100%)
- Installing doctrine/instantiator (1.1.0): Downloading (100%)
- Installing phpunit/php-text-template (1.2.1): Downloading (100%)
- Installing phpunit/phpunit-mock-objects (4.0.4): Downloading (100%)
- Installing phpunit/php-timer (1.0.9): Downloading (100%)
- Installing phpunit/php-file-iterator (1.4.2): Downloading (100%)
- Installing theseer/tokenizer (1.1.0): Downloading (100%)
- Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)
- Installing phpunit/php-token-stream (2.0.1): Downloading (100%)
- Installing phpunit/php-code-coverage (5.2.3): Downloading (100%)
- Installing webmozart/assert (1.2.0): Downloading (100%)
- Installing phpdocumentor/reflection-common (1.0.1): Downloading (100%)
- Installing phpdocumentor/type-resolver (0.4.0): Downloading (100%)
- Installing phpdocumentor/reflection-docblock (4.1.1): Downloading (100%)
- Installing phpspec/prophecy (v1.7.2): Downloading (100%)
- Installing phar-io/version (1.0.1): Downloading (100%)
- Installing phar-io/manifest (1.0.1): Downloading (100%)
- Installing myclabs/deep-copy (1.7.0): Downloading (100%)
- Installing phpunit/phpunit (6.4.3): Downloading (100%)
- Installing hamcrest/hamcrest-php (v1.2.2): Downloading (100%)
- Installing mockery/mockery (0.9.9): Downloading (100%)
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/http-kernel suggests installing symfony/browser-kit ()
symfony/http-kernel suggests installing symfony/class-loader ()
symfony/http-kernel suggests installing symfony/config ()
symfony/http-kernel suggests installing symfony/dependency-injection ()
symfony/http-kernel suggests installing symfony/var-dumper ()
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)
symfony/translation suggests installing symfony/config ()
symfony/translation suggests installing symfony/yaml ()
illuminate/support suggests installing symfony/var-dumper (Required to use the dd function (~3.3).)
illuminate/filesystem suggests installing league/flysystem (Required to use the Flysystem local and FTP drivers (~1.0).)
illuminate/filesystem suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (~1.0).)
illuminate/filesystem suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (~1.0).)
illuminate/database suggests installing doctrine/dbal (Required to rename columns and drop SQLite columns (~2.5).)
symfony/console suggests installing symfony/filesystem ()
illuminate/console suggests installing guzzlehttp/guzzle (Required to use the ping methods on schedules (~6.0).)
illuminate/queue suggests installing aws/aws-sdk-php (Required to use the SQS queue driver (~3.0).)
illuminate/queue suggests installing illuminate/redis (Required to use the Redis queue driver (5.5.*).)
illuminate/queue suggests installing pda/pheanstalk (Required to use the Beanstalk queue driver (~3.0).)
illuminate/cache suggests installing illuminate/redis (Required to use the redis cache driver (5.5.*).)
illuminate/broadcasting suggests installing pusher/pusher-php-server (Required to use the Pusher broadcast driver (~3.0).)
laravel/lumen-framework suggests installing laravel/tinker (Required to use the tinker console command (~1.0).)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.5)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
Writing lock file
Generating autoload files
User@****** MINGW64 /c/xampp/htdocs/pj_dir (master)
$
★番外編
インストール時に以下のようなエラーが出た場合
$ composer create-project --prefer-dist laravel/lumen
Installing laravel/lumen (v5.5.0)
- Installing laravel/lumen (v5.5.0): Downloading (100%)
Created project in C:\xampp\htdocs\pj_dir\lumen
> php -r "copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpunit/phpunit 6.5.x-dev requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.4.x-dev requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.4.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.4.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.4.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.4.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.3.x-dev requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.3.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.3.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.2.x-dev requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.2.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.2.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.2.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.2.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.2.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.1.x-dev requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.1.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.1.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.1.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.1.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.1.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.x-dev requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.9 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.8 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.7 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.6 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.5 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.13 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.12 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.11 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.10 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- phpunit/phpunit 6.0.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- Installation request for phpunit/phpunit ~6.0 -> satisfiable by phpunit/phpunit[6.0.0, 6.0.1, 6.0.10, 6.0.11, 6.0.12, 6.0.13, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6 .0.7, 6.0.8, 6.0.9, 6.0.x-dev, 6.1.0, 6.1.1, 6.1.2, 6.1.3, 6.1.4, 6.1.x-dev, 6.2.0, 6.2.1, 6.2.2, 6.2.3, 6.2.4, 6.2.x-dev, 6.3.0, 6.3.1, 6.3.x-dev, 6.4.0, 6.4.1, 6.4.2, 6.4.3, 6.4.x-dev, 6.5.x-dev].
To enable extensions, verify that they are enabled in your .ini files:
- C:\tools\php71\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
解決策
参照しているPHPのphp.ini
の
php.ini
;extension=php_mbstring.dll
のコメントを外して有効にする。
Laravelとの相違点
以下のArtisanコマンドが使えないみたいです
make:controller
make:model
またResource Controllers / Resource Route の部分は自作する必要があるようです。
参考URL: Lumen で RESTful API を作ってみた - Tech memo