Getting Started¶
A tool to create multiple Phalcon's Collections with easy.
Requirements¶
- PHP >=7.1
- Phalcon 3.4 or higher.
Install¶
composer require baka/router
Usage¶
use Baka\Router\RouteGroup; use Baka\Router\Route; $routes = [ Route::get('status') // Method: GET // Paths: /status, /status/{id:[0-9]+} // Namespace: // Controller: StatusController // Action: index ]; // Group all the routes that has shared configutarions like namespace $routeGroup = RouteGroup::from($routes) ->defaultNamespace('App\Api\Controllers'); // Mount collections to the app $app = new \Phalcon\Mvc\Micro(); foreach ($routeGroup->toCollections() as $collection){ $app->mount($collection); }