tccltd / tcc-skippable-segment
Skippable Route Config
Installs: 2 891
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 5
Forks: 5
Open Issues: 0
Requires
- php: >=5.3.0
- zendframework/zendframework: ~2.3
This package is not auto-updated.
Last update: 2024-11-09 17:03:55 UTC
README
This module is based on the work by: @towr (https://gist.github.com/towr/3320fb4ee13dfd079890).
It allows you to specify segments of routes which can be skipped (E.g. [/:lang]/my-page/anotherpage - The lang part may be omitted).
Usage
SkippableSegment route. Modified Segment route where you can skip optional segments.
'router' => [ 'routes' => [ 'home' => [ 'type' => 'SkippableSegment', 'options' => [ 'route' => '[/:lang]', 'constraints' => [ 'lang' => '(?i:en|us)', ], 'defaults' => [ 'lang' => '', 'controller' => 'MyController', 'action' => 'index' ], 'skippable' => [ 'lang' => true, ], ], 'may_terminate' => true, 'child_routes' => [ 'my-page' => [ 'type' => 'Segment', ... ... ], ], ], ], );