Skip to content

Tiny sinatra- and bottle-like (ruby and python respectively) bare PHP5 microframework created for speeding-up and simplification of work with daily routines. Features: easy routing via regex, urls are permanent, controllers and views implements decorator pattern, possible to use framework with both , apache2ctl (web) and cli (command-line) SAPI.

Notifications You must be signed in to change notification settings

nmtitov/routiny

Folders and files

NameName
Last commit message
Last commit date

Latest commit

23181df · Jan 6, 2025

History

4 Commits
Dec 16, 2019
Dec 16, 2019
Jan 6, 2025
Dec 16, 2019
Dec 16, 2019
Feb 19, 2011
Feb 19, 2011

Repository files navigation

Example:

$rt = new Rt();
$rt
    ->get('/(.*)/i')
    ->dispatch(function() {
                return '<h1>404</h1>';
            })
    ->get('/^\/($|index$|index.(html|php|asp|jsp|htm)$)/i')
    ->dispatch(function() {
                return '<h1>It works!</h1>';
            })
    ->get('/^\/string$/i')
    ->dispatch(function() {
                return array('json_string' => str_shuffle('hello world'));
            })
    ->json()
    ->get('/^\/random$/i')
    ->dispatch(function() {
                return array('rand' => rand(0, 1000));
            })
    ->json()
    ->post('/^\/test$/i')
    ->dispatch(function($msg='default', $test='not default') {
                return 'this is reply for POST request with params '
                . $msg
                . ' and also '
                . $test;
            })
    ->get('/^\/xslt$/i')
    ->dispatch(function($data='test') {
                return array('input' => $data);
            })
    ->xml()
    ->xslt(array('stylesheet' => 'sample.xslt'))
    ->format_by_request()
    ->run();

About

Tiny sinatra- and bottle-like (ruby and python respectively) bare PHP5 microframework created for speeding-up and simplification of work with daily routines. Features: easy routing via regex, urls are permanent, controllers and views implements decorator pattern, possible to use framework with both , apache2ctl (web) and cli (command-line) SAPI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published