PHP annotations: adding or annotating a doctrine?

Can you give me some reason better than another?

Here is my list:

  • Application - a project designed for this
  • The add-on seems to have more functionality
  • Add API seems easier to use.
  • The doctrine has more support and more people.
  • Doctrine seems more lively
  • Doctrine is fully compatible with PHP 5.3, while the add-on seems to be trying to become compatible (see home page).
  • Doctrine annotations can be easily cached.

The decision is not easy ...

+6
source share
2 answers

I believe it is better to use the Doctrine component:

  • I have never heard of Addendum - while I heard a lot about Doctrine (and used it several times)
    • This means more community and support for Doctrine.
  • Doctrine is used by some major Framework (symfony and can be easily integrated with Zend Framework)
    • This means that the chances are higher than you are already using Doctrine; and find developers familiar with its syntax
  • Maybe less important to you, but some guy from the Doctrine team did some work integrating annotations into PHP
    • There is an RFC: Request for Comments: Class Metadata
    • At the moment, it does not look like it will be integrated into PHP, but it does mean that there is work done by the Doctrine team that shows that their solution has some thinking
+9
source

What is it worth ...

I've been using Addendum for a year now and I found it ridiculously easy to use. Its extension for the PHP Reflection API is seamless, and it supports many more use cases than the Doctrine Annotations component.

It lacks namespace support, but I could use the AnnotationMatcher class to accept classes with names (without getting false matches with docblock tags), and it works like a charm.

Doctrine annotations take into account PHP 5.3 instructions. The only thing that does not add Addendum, and IMO, it would not be so trivial to implement.

+3
source

Source: https://habr.com/ru/post/885557/


All Articles