brandembassy / php-router
This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.
Installs: 105 003
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 2
pkg:composer/brandembassy/php-router
Requires
- php: >=7.4
- psr/http-message: ^1.0
Requires (Dev)
- brandembassy/coding-standard: ^8.6
- mockery/mockery: ^1.2
- nette/di: ^2.4 || ^3.0
- phpunit/phpunit: ^8
- roave/security-advisories: dev-master
- slim/slim: ^3.12
This package is auto-updated.
Last update: 2025-05-20 12:11:05 UTC
README
Router interface for interoperability between Brand Embassy libraries and services.
Install
composer require brandembassy/php-router
Usage
Two interfaces:
RouteDispatcherfor dispatching PSR request.UrlGeneratorfor generating URLs for links in application.
Bridges
Slim Framework with NetteDI
First in your parameters in .neon config file you need to specify routes. Structure
is demonstrated by following example:
parameters:
app:
routes:
backOffice: # namespace, just for organization no semantic meaning
"/back-office/brand/{brandId}/create-user":
"get|post": # you can specify multiple HTTP methods
name: backOfficeCreateUserInBrand # Name is mandatory and is used as identifier
service: BrandEmbassy/App/BackOffice/User/CreateUserInBrandActoon # This service must be callable (must have __invoke() method)
Then in your services.neon you just register services:
urlGenerator: class: BrandEmbassy\Router\UrlGenerator factory: BrandEmbassy\Router\Bridge\Slim\SlimRouterNetteDiFactory::create(..., %app.routes%) routeDispatcher: class: BrandEmbassy\Router\RouteDispatcher factory: BrandEmbassy\Router\Bridge\Slim\SlimRouterNetteDiFactory::create(..., %app.routes%)