Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phlexus/phalcon-router
Multi format wrapper for Phalcon Router
https://github.com/phlexus/phalcon-router
Last synced: 29 days ago
JSON representation
Multi format wrapper for Phalcon Router
- Host: GitHub
- URL: https://github.com/phlexus/phalcon-router
- Owner: phlexus
- License: bsd-3-clause
- Created: 2019-08-05T21:21:05.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-28T22:39:46.000Z (almost 4 years ago)
- Last Synced: 2024-11-14T11:37:54.858Z (3 months ago)
- Language: PHP
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```php
$router->add('/admin/users/my-profile', [
'controller' => 'users',
'action' => 'profile',
]);
```To this:
```php
$routes = [
'/admin/users/my-profile' => ['users', 'profile'],
];
```## Basic usage
```php
$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();
```