Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP annotations : Addendum or Doctrine Annotation?

  • Addendum
  • Doctrine 2 Annotations

Can you give me any reason one is better than the other ?

Here my list for now :

  • Addendum is a project dedicated for that
  • Addendum seems to have more functionnalities
  • Addendum API seems easier to use
  • Doctrine has more support and more people involved
  • Doctrine seems to be a project more alive
  • Doctrine is fully compatible PHP 5.3, whereas Addendum seems to be trying to become compatible (see home page)
  • Doctrine Annotations can be cached easily

The decision is not easy...

like image 410
Matthieu Napoli Avatar asked Apr 09 '11 10:04

Matthieu Napoli


2 Answers

I suppose I'd rather use the Doctrine's component :

  • I've never heard of Addendum -- while I've heard a lot about Doctrine (and have used it several times)
    • Which means more community and support for Doctrine
  • Doctrine is used by some big Frameworks (symfony ; and can easily be integrated with Zend Framework)
    • Which means chances are higher that you'll already use Doctrine ; and find developers who are familiar with its syntax
  • Maybe less important for you, But some guy from Doctrine's team has done some work on getting Annotations integrated into PHP
    • There is a RFC : Request for Comments: Class Metadata
    • For now, it doesn't seem this is going to be integrated into PHP, but it means there is works done by the Doctrine's team, that shows their solution has some thinking
like image 165
Pascal MARTIN Avatar answered Oct 08 '22 19:10

Pascal MARTIN


For what it's worth...

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

It lacks namespaces support, but I could patch AnnotationMatcher class so it accepted namespaced classes (without getting false matches from docblock tags) and it has worked like a charm.

Doctrine's annotations takes into account PHP 5.3 use statements. That's the only thing that Addendum does not do and IMO it wouldn't be so trivial to implement.

like image 38
Leonardo Rothe Avatar answered Oct 08 '22 20:10

Leonardo Rothe