xielei/app

php tiny app

1.0.1 2019-11-06 01:51 UTC

README

php tiny app

Installation

composer require xielei/app

Usage

event suggest
app.init init route,debug..
app.route_parse init route,debug..
app.start auth..
app.end response.
app.404
app.405
$app = new \xielei\App();
$app->run(array $events);

# http://host:port/foo/bar

# path
#    app
#       controller
#           Foo.php

$events = [
    ['app.init', function(){
        app()->route->add('*', '/', 'home/index');
    }],
    ['app.start', function(){
        # todo
    }],
    ['app.end', function($result){
        echo $result;
    }],
    ['app.404', function($e){
        echo '404';
    }],
    ['app.405', function($e){
        echo '405';
    }]
];