nowo-tech / routing-kit-bundle
Symfony bundle for DB-driven locale routes, canonical URL styles, CRUD panel, and SeoKit compatibility.
Package info
github.com/nowo-tech/RoutingKitBundle
Type:symfony-bundle
pkg:composer/nowo-tech/routing-kit-bundle
Requires
- php: >=8.2 <8.6
- symfony/config: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/event-dispatcher: ^7.0 || ^8.0
- symfony/finder: ^7.0 || ^8.0
- symfony/http-foundation: ^7.4 || ^8.0
- symfony/http-kernel: ^7.4 || ^8.0
- symfony/routing: ^7.0 || ^8.0
- symfony/security-core: ^7.4 || ^8.0
- symfony/security-csrf: ^7.0 || ^8.0
- symfony/yaml: ^7.0 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- nowo-tech/phpstan-frankenphp: ^1.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0 <2.2.6
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^10.0
- rector/rector: ^2.0
- symfony/framework-bundle: ^7.0 || ^8.0
- symfony/twig-bundle: ^7.0 || ^8.0
- twig/twig: ^3.12
Suggests
- doctrine/orm: Implement RoutePathStorageInterface against Doctrine entities
- nowo-tech/seo-kit-bundle: Bridge: RoutingKit paths feed SeoKit canonical/hreflang (requires SeoPathBuilderInterface)
- symfony/security-bundle: Recommended: firewall + ROLE_ADMIN for /_routing
- symfony/translation: Required for |trans in panel templates
- symfony/twig-bundle: Required to render the routing CRUD panel
README
⭐ Found this useful? Install from Packagist · Give it a star on GitHub so more developers can find it.
Routing Kit Bundle — DB-driven (pluggable storage) locale paths for Symfony: dual /foo + /{locale}/foo access, admin-defined canonical URLs, Twig CRUD panel, route-cache invalidation, and SeoKitBundle path bridge. Tested on Symfony 7.4, 8.0, and 8.1 · PHP 8.2+ (Symfony 8.x requires PHP 8.4+).
This bundle is FrankenPHP worker mode friendly.
Features
- Storage — One row per
(routeName, locale); filesystem JSON by default; swap viaRoutePathStorageInterface. - Locales — YAML
default_locale+locales, or a customLocaleProviderInterface. - Canonical definition — Paths stored without
{_locale}; the loader always builds/{_locale}/…. - Styles —
canonical_style, trailing slash, alias mode (redirect/alias). - Fallback — Missing locale row → default-locale path for that route name.
#[Routable]— Controllers offered in the CRUD; params + constraints validated on save.- Loader —
type: nowo_routing_kitregisters{name}.{locale}with_canonical_route(import last). - Panel — Twig CRUD under
/_routing+ clear routing cache (auto after save/delete). - SeoKit — Optional bridge decorates
SeoPathBuilderInterfacefor canonical/hreflang paths.
Installation
composer require nowo-tech/routing-kit-bundle
With Symfony Flex, the recipe registers the bundle and adds config (see .symfony/recipe). Without Flex, see docs/INSTALLATION.md.
# config/routes.yaml — panel, then app routes, then DB loader LAST nowo_routing_kit_panel: resource: '@NowoRoutingKitBundle/Resources/config/routes.yaml' # … application routes … nowo_routing_kit_db: resource: . type: nowo_routing_kit
The loader registers {name}.{locale} with _canonical_route. Protect /_routing with your firewall.
Configuration
nowo_routing_kit: default_locale: en locales: [en, es] panel: path_prefix: /_routing redirects: canonical_enabled: true seo_kit_bridge: true
Usage
use Nowo\RoutingKitBundle\Attribute\Routable; use Nowo\RoutingKitBundle\Attribute\RouteParam; #[Routable(name: 'app_about')] public function about(): Response { … } #[Routable(name: 'app_blog_show', params: [ new RouteParam('slug', required: true, requirement: '[a-z0-9-]+'), ])] public function show(string $slug): Response { … }
Open /_routing to manage paths. See docs/USAGE.md.
Documentation
- Installation
- Configuration
- Usage
- Contributing
- Code of Conduct
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
Additional documentation
Requirements
- PHP
>=8.2(<8.6); Symfony 8.0 and 8.1 require PHP 8.4+ - Symfony 7.4, 8.0, or 8.1
- Twig for the CRUD panel templates
Development
make up
make install
make test
make cs-check
make phpstan
make release-check
Install git hooks once per clone: make setup-hooks (REQ-GIT-001).
Demos
make -C demo up-symfony8
Open http://localhost:8058 — panel at /_routing. FrankenPHP mode is controlled by FRANKENPHP_MODE (classic | worker, default worker) in the demo .env.
Tests and coverage
PHPUnit with 100% line coverage of production PHP under src/ (optional SeoKit bridge files excluded when SeoKit is not a require-dev dependency):
make test-coverage make coverage-check
License
MIT
