PHP code example of blitz-php / annotations

1. Go to this page and download the library: Download blitz-php/annotations 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/ */

    

blitz-php / annotations example snippets



/**
 * @RequestMapping(["post", "get"])
 * @AjaxOnly
 */
class FooController
{
    /**
     * @ion index(){}
}

use BlitzPHP\Annotations\AnnotationReader;

$annotations = AnnotationReader::fromClass('FooController');
/*
[
    BlitzPHP\Annotations\Http\RequestMappingAnnotation::class,
    BlitzPHP\Annotations\Http\AjaxOnlyAnnotation::class,
]
*/

use BlitzPHP\Annotations\AnnotationReader;

$annotations = AnnotationReader::fromProperty('FooController', 'repository');
/*
[
    BlitzPHP\Annotations\Validation\RequiredAnnotation::class,
]
*/

use BlitzPHP\Annotations\AnnotationReader;

$annotations = AnnotationReader::fromMethod('FooController', 'index');
/*
[
    BlitzPHP\Annotations\Http\RequestMappingAnnotation::class,
]
*/
shell
composer