README.md
1Metadata is a library for class/method/property metadata management in PHP
2==========================================================================
3
4| [Master (2.x)][Master] | [1.x][1.x] |
5|:----------------:|:----------:|
6| [![Build status][Master image]][Master] | [![Build status][1.x image]][1.x] |
7| [![Coverage Status][Master coverage image]][Master coverage] | [![Coverage Status][1.x coverage image]][1.x coverage] |
8
9
10Overview
11--------
12
13This library provides some commonly needed base classes for managing metadata
14for classes, methods and properties. The metadata can come from many different
15sources (annotations, YAML/XML/PHP configuration files).
16
17The metadata classes are used to abstract away that source and provide a common
18interface for all of them.
19
20Usage
21-----
22
23The library provides three classes that you can extend to add your application
24specific properties, and flags: ``ClassMetadata``, ``MethodMetadata``, and
25``PropertyMetadata``
26
27After you have added, your properties in sub-classes, you also need to add
28``DriverInterface`` implementations which know how to populate these classes
29from the different metadata sources.
30
31Finally, you can use the ``MetadataFactory`` to retrieve the metadata::
32
33```php
34<?php
35
36use Metadata\MetadataFactory;
37use Metadata\Driver\DriverChain;
38
39$driver = new DriverChain(array(
40 /** Annotation, YAML, XML, PHP, ... drivers */
41));
42$factory = new MetadataFactory($driver);
43$metadata = $factory->getMetadataForClass('MyNamespace\MyObject');
44```
45
46 [Master image]: https://img.shields.io/travis/schmittjoh/metadata/master.svg?style=flat-square
47 [Master]: https://travis-ci.org/schmittjoh/metadata
48 [Master coverage image]: https://img.shields.io/scrutinizer/coverage/g/schmittjoh/metadata/master.svg?style=flat-square
49 [Master coverage]: https://scrutinizer-ci.com/g/schmittjoh/metadata/?branch=master
50
51 [1.x image]: https://img.shields.io/travis/schmittjoh/metadata/1.x.svg?style=flat-square
52 [1.x]: https://github.com/schmittjoh/metadata/tree/1.x
53 [1.x coverage image]: https://img.shields.io/scrutinizer/coverage/g/schmittjoh/metadata/1.x.svg?style=flat-square
54 [1.x coverage]: https://scrutinizer-ci.com/g/schmittjoh/metadata/?branch=1.x
55
56