A PHP framework for 5.4 and up

The Disco PHP Framework is a lean and flexible set of services/components that aid in creating fluent, efficient, rapid development applications.

Installation, dependency management and auto-loading provided by Composer.

Leverage Inversion of Control (IoC) and the application container , Facading, and Dependency Injection techniques and design principles.

Code Flavoring #

Router::get('/',function(){

    View::title('Welcome to Disco');
    View::desc('A PHP framework');
    Template::with('index');

});


Router::multi('/news-letter/', [
    'get' => 'App\controller\NewsLetter@getIndex',
    'post' => 'App\controller\NewsLetter@postIndex'
]);


Router::get('/to-do',function(){

    View::title('Your To-Do List');

    $toDos = \Model::m('App\model\ToDo')
                ->select('id,title,description,created_on')
                ->where('completed=0')
                ->order('created_on DESC')
                ->limit(10)
                ->asArray();

    Template::with('to-dos', $toDos);
});


Router::post('/to-do',function(){

    $data = Data::post(['title','description']);

    $data['created_on'] = ['raw' => 'NOW()'];

    $record = new \App\record\ToDo($data);

    $id = $record->insert();

    View::json(['id' => $id]);

});


Router::get('/user/{id}/{section}', function($id, $section){

    $stats = DB::query('
           SELECT total_worth 
           FROM user_account 
           WHERE id=? AND section=?',
           [$id, $section]
      )->fetch();

    Template::with('user/account', $stats);

})->where(['id' => 'integer', 'section' => 'alpha']);

Default Application Services/Components #

Controlling complexity is the essence of computer programming

Brian Wilson Kernighan