README.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. Metadata is a library for class/method/property metadata management in PHP
  2. ==========================================================================
  3. Overview
  4. --------
  5. This library provides some commonly needed base classes for managing metadata
  6. for classes, methods and properties. The metadata can come from many different
  7. sources (annotations, YAML/XML/PHP configuration files).
  8. The metadata classes are used to abstract away that source and provide a common
  9. interface for all of them.
  10. Usage
  11. -----
  12. The library provides three classes that you can extend to add your application
  13. specific properties, and flags: ``ClassMetadata``, ``MethodMetadata``, and
  14. ``PropertyMetadata``
  15. After you have added, your properties in sub-classes, you also need to add
  16. ``DriverInterface`` implementations which know how to populate these classes
  17. from the different metadata sources.
  18. Finally, you can use the ``MetadataFactory`` to retrieve the metadata::
  19. <?php
  20. use Metadata\MetadataFactory;
  21. use Metadata\Driver\DriverChain;
  22. $driver = new DriverChain(array(
  23. /** Annotation, YAML, XML, PHP, ... drivers */
  24. ));
  25. $factory = new MetadataFactory($driver);
  26. $metadata = $factory->getMetadataForClass('MyNamespace\MyObject');