Download the PHP package fsi/metadata without Composer
On this page you can find all versions of the php package fsi/metadata. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package metadata
Short Description FSi Metadata Component is a library that provide some commonly used mechanisms to read configurations for classes from different sources like annotations, yaml or xml.
License MIT
Informations about the package metadata
THIS PACKAGE IS DEPRECATED
Do not use this package, as it will not receive any updates and may be deleted in the future.
FSi Metadata Component Documentation
FSi Metadata Component is a library that provide some commonly used mechanisms to read configurations for classes from different sources like annotations, yaml or xml. At the moment only php files annotations are supported.
Setup and autoloading
We highly recommend to use autoloader generated by composer.phar
Adding reflection into composer.json
{
...
"require": {
...
"fsi/metadata": "0.9.*"
...
},
...
}
Usage
FSi Metadata Component provides ClassMetadata object that can be easly overwritten. Default ClassMetadata object allows you to strore inside of it configuration for class, properties and methods. This can be done by using methods "addClassMetadata", "addPropertyMetadata", "addMethodMetadata".
What you need to do is to create class that extends from one of abstract drivers like AbstractAnnotationDriver.
Example of reading annotations from php class files.
Annotation driver
Annotation declaration
Example action in symfony 2 controller
Example action in symfony 2 controller (with cache)
All you need to do to implement caching metadata is create the cache object from Doctrine\Common\Cache
and pass it
into MetadataFactory
constructor. For development purposes we suggest to use ArrayCache
instead of not using any cache.
Sometimes default ClassMetadata
is not enough. You can create own class that implements
ClassMetadataInterface
and pass class name into MetadataFactory
constructor as third parameter.
Factory constructor example with custom metadata class
If you want to use Metadata Component in two separate mechanisms, inside of the
same application you should create new MetatadaFactory
and appropriate driver in each
mechanism but cache driver may be the same object each time. It is possible when
cache mechanism is used with different prefix and/or metadata class for each factory object.