Lumenとは

Limenのオフィシャルページ

The stunningly fast micro-framework by Laravel.

直訳すると、“Laravelによるほどろくほど高速なマイクロフレームワーク"ってことですね。

現時点(2017年2月14日)では、バージョン5.4が最新のようです。Limen Documentation

laravel5.2は使ったあるので、そこまで苦労しないで使えるはず。。

Limenを試してみる

ここに書いてあるとおりやってみるLimen Installation

環境

  • mac OS 10.12.3
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
$ php -v
PHP 7.1.1 (cli) (built: Jan 21 2017 13:36:56) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
$ composer -V
Composer version 1.3.2 2017-01-27 18:23:41
$ openssl version
OpenSSL 0.9.8zh 14 Jan 2016
$ php -m | grep -i pdo
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
$ php -m | grep -i mbstring
mbstring
$

ComposerでLumen installerをインストール

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
$ composer global require "laravel/lumen-installer"
Changed current directory to /Users/hoge/.composer
Using version ^1.0 for laravel/lumen-installer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing laravel/lumen-installer (v1.0.2) Downloading: 100%
Writing lock file
Generating autoload files
$

サンプルプロジェクト作成

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ lumen new lumen_sample
Crafting application...
Application ready! Build something amazing.
$ cd lumen_sample/
$ tree -L 1
.
├── app
├── artisan
├── bootstrap
├── composer.json
├── composer.lock
├── database
├── phpunit.xml
├── public
├── readme.md
├── resources
├── routes
├── storage
├── tests
└── vendor

9 directories, 5 files

動作確認

1
2
3
4
5
6
$ php -S localhost:8000 -t public
PHP 7.1.1 Development Server started at Tue Feb 14 12:46:01 2017
Listening on http://localhost:8000
Document root is /document_root/lumen_sample/public
Press Ctrl-C to quit.
[Tue Feb 14 12:46:16 2017] ::1:53482 [200]: /

ブラウザで下記にアクセスする

http://localhost:8000/

こんな感じで表示されたらOK

lumen