|
1 | | -# The Biurad PHP Library Template |
| 1 | +# The Biurad PHP Annotations |
2 | 2 |
|
3 | 3 | [](https://packagist.org/packages/biurad/annotations) |
4 | 4 | [](LICENSE) |
|
8 | 8 | [](https://scrutinizer-ci.com/g/biurad/php-annotations) |
9 | 9 | [](https://biurad.com/sponsor) |
10 | 10 |
|
11 | | -**biurad/php-annotations** is a php library template repository for biurad lap. To use this library, rename **php-starter** and **BSD-3** on every file that contain it to your preferred library name and license. |
12 | | - |
13 | | -As to why this project exist, it's to serve as a template for future open source PHP library projects. Of course, feel free to fork it and make your own recipe. |
| 11 | +**biurad/php-annotations** is an annotations and attribute reader for [PHP] 7.2+ created by [Divine Niiquaye][@divineniiquaye]. This library provides a Simple, Lazy, Fast & Lightweight [Doctrine Annotations][doctrine] and PHP 8 Attribute reader for your project. |
14 | 12 |
|
15 | 13 | ## 📦 Installation & Basic Usage |
16 | 14 |
|
17 | | -This project requires [PHP] 7.1 or higher. The recommended way to install, is via [Composer]. Simply run: |
| 15 | +This project requires [PHP] 7.2 or higher. The recommended way to install, is via [Composer]. Simply run: |
18 | 16 |
|
19 | 17 | ```bash |
20 | | -$ composer require biurad/php-annotations |
| 18 | +$ composer require biurad/annotations |
21 | 19 | ``` |
22 | 20 |
|
23 | | -Write a bit of **How To** use this package, so developers can have a bit of idea about the repository before checking out documentation. |
| 21 | +We all know writing annotations support for a project takes alot of time, work and sometimes end up changing the whole code to suite the current changes of [PHP], example of project that has messy annotations is [Nette DI][nette-di]. In short, this library is meant to be a base building block that utilizes [Doctrine Annotations][doctrine] and attributes introduced in [PHP] 8. |
| 22 | + |
| 23 | +Let's you working on a few projects and you need to annotation support for each. With this library we make your work easier,all you need is a instance of `Biurad\Annotations\ListenerInterface` and an annotated class for finding annotations or attributes. |
| 24 | + |
| 25 | +**To know more about how to use this library, try going through the `tests` directory and find out how to integrate this library into your project.** |
| 26 | + |
| 27 | +example of usage: |
| 28 | + |
| 29 | +```php |
| 30 | +use Biurad\Annotations\AnnotationLoader; |
| 31 | +use Doctrine\Common\Annotations\AnnotationReader; |
| 32 | + |
| 33 | +$annotation = new AnnotationLoader(new AnnotationReader()); |
| 34 | + |
| 35 | +$annotation->attachListener(...); // Add your implemented Annotation listeners |
| 36 | + |
| 37 | +$annotation->attach(...); // Add a class string, classless file, or directory |
| 38 | + |
| 39 | +$listeners = \iterator_to_array($annotation->load()); |
| 40 | + |
| 41 | +// To use a collector you implemented into your instance of `Biurad\Annotations\ListenerInterface` |
| 42 | +foreach ($$listeners as $collector) { |
| 43 | + // You can fetch the required $collector from here. |
| 44 | +} |
| 45 | +``` |
24 | 46 |
|
25 | 47 | ## 📓 Documentation |
26 | 48 |
|
@@ -100,3 +122,5 @@ Check out the other cool things people are doing with `biurad/php-annotations`: |
100 | 122 | [Biurad Lap]: https://team.biurad.com |
101 | 123 | [email]: support@biurad.com |
102 | 124 | [message]: https://projects.biurad.com/message |
| 125 | +[doctrine]: https://github.com/doctrine/annotations |
| 126 | +[nette-di]: https://github.com/nette/di |
0 commit comments