Skip to content

phlexus/phalcon-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phlexus Phalcon Router

Multi format wrapper for Phalcon Router.

Main purpose: make possible to manipulate routes in different formats and environments.

For example: array to object...

Transform this:

$router->add('/admin/users/my-profile', [
    'controller' => 'users',
    'action'     => 'profile',
]);

To this:

$routes = [
    '/admin/users/my-profile' => ['users', 'profile'],
];

Basic usage

$routes = [
    '/' => ['index', 'index'],

    '/advanced' => [
        'methods' => ['GET', 'POST'],
        'paths' => [
            'controller' => 'index',
            'action' => 'advanced',
            'namespace' => 'Your\Vendor\Controllers',
        ],
    ],

    'another-uri' => [
        'methods' => '*',
        'paths' => [
            'controller-name',
            'action-name',
            'Your\Vendor\Controllers',
        ],
    ]
];

$adapter = new \Phlexus\PhalconRouter\Adapters\ArrayAdapter();
$phalconRouter = new \Phlexus\PhalconRouter\PhalconRouter($adapter);
$phalconRouter->addRoutes($routes);
$phalconRouter->parseRoutes();
$phalconRouter->fillRouter();

About

Multi format wrapper for Phalcon Router

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages