LoginSignup
15
18

More than 3 years have passed since last update.

[Lumen][Slim][Silex][Wave][Phalcon] PHPマイクロフレームワーク比較

Last updated at Posted at 2016-06-29

PerlのAmon2みたいな、手軽なフレームワークが欲しくて探してみました。

https://blog.appdynamics.com/php/php-microframework-vs-full-stack-framework/ からの引用です。

PHPバージョン PHP 7サポート プロジェクトWebページ requireパッケージ クラス数
Lumen 5.5.9~ :o: https://lumen.laravel.com/ symfony/process
symfony/polyfill-mbstring
symfony/console
guzzlehttp/promises
psr/http-message
guzzlehttp/psr7
guzzlehttp/guzzle
111
Slim 3 5.5~ :o: http://www.slimframework.com/ pimple/pimple
psr/http-message
nikic/fast-route
container-interop/container-interop
34
Slim 2 5.3~ :x: なし? http://docs.slimframework.com/
Silex 2 5.5~ :o: (2016年6月時点では作業中?) http://silex.sensiolabs.org/ symfony/routing
symfony/polyfill-mbstring
symfony/http-foundation
symfony/event-dispatcher
psr/log
symfony/debug
symfony/http-kernel
pimple/pimple
46
Wave 5.3~ :x: なし? http://www.waveframework.com/
Phalcon 5.3~ :o: (2016年6月時点ではベータ扱い) https://phalconphp.com/en/ - -

インストール方法

Lumen

composerを使います。

php composer.phar require laravel/lumen-installer

Slim 3

composerを使います。

php composer.phar require slim/slim "^3.0"

Slim 2

composerを使います。

php composer.phar require slim/slim "~2.0"

Silex

composerを使います。

php composer.phar require silex/silex "~2.0"

Phalcon

PHP Extentionなので、OSによりインストール方法が違います。

最小のHello World的なもの

Slim 3

index.php
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

require 'vendor/autoload.php';

$app = new \Slim\App;
$app->get('/hello/{name}', function (Request $request, Response $response) {
    $name = $request->getAttribute('name');
    $response->getBody()->write("Hello, $name");

    return $response;
});
$app->run();

考察

Lumen単独では小さいのですが、いろいろ外部のものを使用しているので、あまりマイクロフレームワークっぽくないかもです。

Waveは開発終了したのでしょうか?更新されていません。

CentOS 6のようなPHP 5.3環境では、Slimi 2がよさそうです。


  1. アプリケーション作成後のvendor/laravel/lumen-frameworkにあるクラス数 

15
18
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
18