PHP code example of websupply / route-annotation

1. Go to this page and download the library: Download websupply/route-annotation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

websupply / route-annotation example snippets


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;
    }
}

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