Content-Length: 258005 | pFad | http://github.com/symfony/symfony/issues/60180

0B Allow to configure trailingSlashOnRoot for routing CollectionConfigurator · Issue #60180 · symfony/symfony · GitHub
Skip to content

Allow to configure trailingSlashOnRoot for routing CollectionConfigurator #60180

@FallDi

Description

@FallDi

Description

Currently is no way to configure trailingSlashOnRoot via CollectionConfigurator. I'm suggest to add such argument to \Symfony\Component\Routing\Loader\Configurator\CollectionConfigurator::prefix

// config/routes.php
<?php declare(strict_types=1);

use App\Controller\LuckyController;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

return function (RoutingConfigurator $routes): void {
    $luckyNumberGroup = $routes->collection()->prefix(
        'lucky-number',
        // missing argument trailingSlashOnRoot
    );
    $luckyNumberGroup->add('lucky-number-view', '')
        ->controller([LuckyController::class, 'view'])
        ->methods(['GET']);
    $luckyNumberGroup->add('lucky-number-add', '')
        ->controller([LuckyController::class, 'create'])
        ->methods(['POST']);
};

However trailingSlashOnRoot argument available via $routes->import()->prefix('lucky-number', trailingSlashOnRoot: false)

\Symfony\Component\Routing\Loader\Configurator\ImportConfigurator::prefix
final public function prefix(string|array $prefix, bool $trailingSlashOnRoot = true): static

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/symfony/symfony/issues/60180

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy