PHP code example of alex-oleshkevich / zf-annotations

1. Go to this page and download the library: Download alex-oleshkevich/zf-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/ */

    

alex-oleshkevich / zf-annotations example snippets


return array(
    'modules' => array(
        // other modules
        'ZfAnnotation'
    ),
    // other content
);

array(
    'zf_annotation' => array(
        // in which modules to search annotated classes
        'scan_modules' => array(),

        // DEPRECATED AND REMOVED IN 2.3
        // here listed all annotations supported by the module
        // add your own here
        'annotations' => array(
            'ZfAnnotation\Annotation\Route',
            // ...
        ),
        
        /*
         * IMPORTANT NOTE:
         * The given directories should NOT be the directory where classes of the namespace are in, 
         * but the base directory of the root namespace. The AnnotationRegistry uses a namespace to directory separator
         * approach to resolve the correct path.
         */
        'namespaces' => array(
            'My\Annotation' => '/path/to/annotations'
        ),
        
        // listeners to events emitted by parser. 
        // they process class annotations and transforms them into config values
        // add your own here.
        'event_listeners' => array(
            'ZfAnnotation\EventListener\RouteListener',
            // ...
        ),
        // if not null, supplied directory would used for cache to speed up parsing
        'cache' => '/path/to/cache/dir',
        // if true, will ignore cached data and always return a fresh one.
        'cache_debug' => false
    )
)