dev-master
9999999-dev http://imin.twThis is a mini PHP Restful framework
MIT
The Requires
- php >=5.4.0
by Min Hsieh
api framework php http restful
Wallogit.com
2017 © Pedro Peláez
This is a mini PHP Restful framework
這是一個練習開發的API Framework,之前要開發一個PHP的RestfulAPI都會選擇使用Laravel,但由於Laravel太過於龐大,並不是每個專案都適用,所以自己嘗試開發一個比較簡易使用的PHP API Framework., (*1)
With Composer, (*2)
composer require minhsieh/mini-php
require "vendor/autoload.php";
use MiniPHP\App;
$app = new App;
# Normal Get
$app->get('/', function() use($app){
echo "
Hello World
This is index";
});
# Get URI input
$app->get('/:name', function($name) use($app){
echo "Hello $name";
})
# Json Response
$app->get('/json', function() use($app){
$app->json(['foo' => 'bar']);
});
# Response to all other
$app->respond( function() use ( $app ){
return $app->html('
We have a problem , (*3)
', 404);
});
$app->listen();
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
This is a mini PHP Restful framework
MIT
api framework php http restful