Skip to content

ahmet-sakar/php-mvc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example

Sample

use \MVC\Core\{Router, View};
$router = new Router();

$router->get('/', function() {
    echo View::show('/index.php');
});

$router->dispatch();

Prefix Use

$router->prefix('/', function($r) {
    $r->get('/?', function() {
        echo 'Home Page';
    });
    
    $r->prefix('/foo', function($r) {
        $r->get('/?', function() {
            echo 'Foo';
        });

        $r->prefix('/bar', function($r) {
            $r->get('/?', function() {
                echo 'Foo Bar';
            });

            $r->get('/baz', function() {
                echo 'Foo Bar Baz';
            });
        });
    });
});

Route Parameter Use

$r->get('/users/:id', function($id) {
    echo "ID: $id";
});

$r->get('/users/:id/:id', function($id) {
    echo "ID: $id[0]-$id[1]";
});

About

PHP Simple MVC System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors