PHP code example of thomas-squall / php-magic-annotations
1. Go to this page and download the library: Download thomas-squall/php-magic-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/ */
thomas-squall / php-magic-annotations example snippets
$ composer
php
class MyCustomAnnotation
{
}
php
use PHPAnnotations\Annotations\Annotation;
class MyCustomAnnotation extends Annotation
{
}
php
use PHPAnnotations\Annotations\Annotation;
class MyCustomAnnotation extends Annotation
{
private $name;
private $surname;
public function __constructor($name, $surname)
{
$this->name = $name;
$this->surname = $surname;
}
public function GetFullName()
{
return "$this->name $this->surname";
}
}
php
class MyTestClass
{
}
php
use use PHPAnnotations\Reflection\Reflector;
$myObject = new MyTestClass();
$reflector = new Reflector($myObject);
echo $reflector->getClass()->getAnnotation("MyCustom")->GetFullName();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.