LoginSignup
5
5

More than 5 years have passed since last update.

シンプルな軽量フレームワークFlight

Posted at

Flight

サイトでは高速、シンプル、拡張可能なPHPのフレームワークと書いてます。
http://flightphp.com/
https://github.com/mikecao/flight

Routing

こんな感じですごい簡単
http://flightphp.com/learn/

Flight::route('/', function(){
    echo 'hello world!';
});
Flight::route('/@name/@id', function($name, $id){
    echo "hello, $name ($id)!";
});

GET / POSTの値取得

GET /users?page=1

Flight::route('GET /users', function(){
  $page = Flight::request()->query->page;
  $users = User::all($page);
  Flight::json(['status' => 200, 'users' => $users]);
});

POST /users

Flight::route('GET /users', function(){
  $name = Flight::request()->data->name;
  $user = new User($name);
  Flight::json(['status' => 200, 'user' => $user]);
});

api向けに利用したのでテンプレートはよくわからないですが
1日で作りたいものができたので学習コストも低めでらくちんフレームワークだと思います。

5
5
0

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
5
5