websupply/route-annotation

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (0.0.3) of this package.

Maintainers

Package info

github.com/wbsply/route-annotation

Type:neos-package

pkg:composer/websupply/route-annotation

Statistics

Installs: 3 095

Dependents: 1

Suggesters: 0

Stars: 3

0.0.3 2023-02-06 13:50 UTC

This package is auto-updated.

Last update: 2025-10-06 14:48:54 UTC


README

Move your routing configuration into the controller with the a Route annotation

Install

composer require websupply/route-annotation

Example

Configuring a controller as follows

use WebSupply\RouteAnnotation\Annotations as WebSupply;

#[WebSupply\Route(path: 'class-annotation')]
class RouteAnnotatedController extends ActionController
{
    #[WebSupply\Route("annotated/with/path")]
    public function annotatedWithPathAction(): string
    {
        return 'Hello';
    }

    #[WebSupply\Route("annotated/with/argument/{name}")]
    public function annotatedUriWithArgumentAction(string $name):string
    {
        return 'Hello ' . $name;
    }
}

Gives you the following routes

$ ./flow routing:list
Currently registered routes:
+---+-------------------------------------------------+----------------+-----------------------------------------------------------------------------------------------------------------+
| # | Uri Pattern                                     | HTTP Method(s) | Name                                                                                                            |
+---+-------------------------------------------------+----------------+-----------------------------------------------------------------------------------------------------------------+
| 1 | class-annotation/annotated/with/path            | any            | Annotated Route (WebSupply\RouteAnnotation\Controller\RouteAnnotatedController->annotatedWithPathAction)        |
| 2 | class-annotation/annotated/with/argument/{name} | any            | Annotated Route (WebSupply\RouteAnnotation\Controller\RouteAnnotatedController->annotatedUriWithArgumentAction) |
+---+-------------------------------------------------+----------------+-----------------------------------------------------------------------------------------------------------------+

Annotation properties

The Route annotation can take following properties (known from the Routes.yaml configuration)

        string $path,
        null|string|array $method = null,
        string $format = 'html',
        ?bool $appendExceedingArguments = null

It respects the core routers handling of these configuration, as this is merely a different way of writing the configuration itself.

Support and sponsoring

Work on this package is supported by the danish web company WebSupply ApS