Skip to content

About

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+).

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

119 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Routing Kit Bundle

CI Packagist Version Packagist Downloads License PHP Symfony GitHub stars Coverage

⭐ 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+).

FrankenPHP Friendly Worker Mode

This bundle is FrankenPHP worker mode friendly.

Routing Kit panel: Routes tab listing locale paths per route (route and path in monospace, locale, canonical style, Yes badge, icon edit/delete actions), header actions New path / Export / Clear routing cache / Import, pagination summary, Symfony profiler toolbar
Locale paths per route — canonical style, enabled state, icon row actions
Routing Kit panel: Redirects tab with old paths, targets, hit counts and notes, and the UiKit confirm dialog 'Delete redirect /promo-2025?' open over the list
Operator URL redirects — delete through the UiKit confirm dialog
Routing Kit panel: signed JSON import dialog over the paths list, full-width payload textarea, Replace all existing rows checkbox, Cancel and Import in the dialog footer
Signed JSON import in the UiKit dialog (web_ui.import_display: modal, default)

Features

  • Storage — One row per (routeName, locale); filesystem JSON by default; swap via RoutePathStorageInterface.
  • Locales — YAML default_locale + locales, or a custom LocaleProviderInterface.
  • 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_kit registers {name}.{locale} with _canonical_route (import last).
  • Panel — Twig CRUD under /_routing on the UiKit page contract (list / form / confirm scaffolds, themed once in nowo_ui_kit for every bundle; see docs/TEMPLATES.md) + Symfony forms (FormKit) for create/edit, export, import, and clear-cache actions (auto invalidation after save/delete). Protect with security.access_roles (default [ROLE_ADMIN]) / allow_unauthenticated.
  • Default locale without prefix (opt-in, default_locale_unprefixed) — Router decorator: the default locale generates the bare twin <route>_unlocalized of any route that has one (AuthKit / SiteBackup / app routes), and GET /{default}/… 301s to it. See docs/USAGE.md.
  • SeoKit — Optional bridge decorates SeoPathBuilderInterface for canonical/hreflang paths.
  • URL redirects (opt-in, url_redirects.enabled) — Operator-managed old path → new path / URL redirects applied before routing, with a panel section at /_routing/redirects, protected paths, live-page detection (LivePathCheckerInterface), hit counting (sync or Messenger) and pluggable storage. See docs/REDIRECTS.md.

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.

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

Configuration

nowo_routing_kit:
    default_locale: en
    locales: [en, es]
    web_ui:
        path_prefix: /_routing      # panel pages render in nowo_ui_kit.layouts.admin
    redirects:
        canonical_enabled: true
    seo_kit_bridge: true
    url_redirects:
        enabled: false   # opt-in operator redirects (docs/REDIRECTS.md)

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.

Development

make up
make install
make test
make cs-check
make phpstan
make igor
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.

Playwright e2e of the panel and the README screenshots (REQ-DEMO-013):

make -C demo/symfony8 test-e2e
make -C demo/symfony8 demo-screenshots   # refreshes docs/images/demo/*.webp

Documentation

Additional documentation

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

About

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+).

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages