Skip to content

Allow to configure trailingSlashOnRoot for routing CollectionConfigurator #60180

Open
@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy