PHP code example of beerline / php-custom-annotations
1. Go to this page and download the library: Download beerline/php-custom-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/ */
beerline / php-custom-annotations example snippets
use Doctrine\Common\Annotations\AnnotationReader;
use Beerline\PhpCustomAnnotations\Metadata\PropertyMetadataPicker;
$product = new Product( 'iPhone', now(), 'Designed by Apple in California' );
$propertyMetadataPicker = new PropertyMetadataPicker( new AnnotationReader() );
$propertiesMetadata = $propertyMetadataPicker->findPropertyCertainMetadata(
$product,
Translatable::class
);
foreach ($propertiesMetadata as $property) {
foreach ($property->getMetadataClass() as $metadataClass){
if ( $metadataClass instanceof Translate) {
echo $property->getPropertyName() . ': ' . $metadataClass->translatable . "\n";
}
}
}
yaml
services:
// Your services here
Beerline\PhpCustomAnnotations\Metadata\PropertyMetadataPicker:
class: 'Beerline\PhpCustomAnnotations\Metadata\PropertyMetadataPicker'
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.