PHP code example of codeburner / annotator

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

    

codeburner / annotator example snippets


/**
 * @EmptyAnnotation
 * @OneAnnotation 1
 * @ComplexAnnotation {"key1": "value1", "key2": ["value2-1", "value2-2"]}
 */

namespace Foo\Bar;

use Foo\FooAnnotation;
use Foo\Bar\BarAnnotation as AliasedAnnotation;

/**
 * @BarAnnotation -f
 * @FooAnnotation -f
 * @AliasedAnnotation -f
 */

class MyAnnotation extends Codeburner\Annotator\Annotation
{
	public function filter()
	{
		array_filter($this->arguments, 'strtoupper');
	}
}


/**
 * @cook Crystals
 * @with {"local": "trailer", "clothes": ["apron", "briefs"]}
 */

class HeisenbergController
{

	/**
	 * @number 1000
	 */

	public function count()
	{

	}

}

$reflection = new Codeburner\Annotator\Reflection\ReflectionAnnotatedClass(HeisenbergController::class);

echo "I'll cook ", 
		$reflection->getMethod("count")->getAnnotation("number"), " ", 
		$reflection->getAnnotation("cook"), " in my ", 
		$reflection->getAnnotation("with")->getArgument("local"), " with wearing ",
		implode(", ", $reflection->getAnnotation("with")->getArgument("clothes"));


use Codeburner\Router\Annotations\RouteStrategyAnnotation as RouteStrategy;
use Codeburner\Router\Annotations\RoutePrefixAnnotation as RoutePrefix;
use Codeburner\Router\Annotations\RouteAnnotation as Route;

/**
 * @RouteStrategy -f \Codeburner\Router\Strategy\SimpleDispatchStrategy
 * @RoutePrefix -f /blog
 */

class ArticleController
{

	/**
	 * @Route -f /
	 */

	public function index()
	{

	}
}