# doctrine/annotations

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/doctrine-annotations).**

6,738 stars · 231 forks · PHP · MIT

## Links

- GitHub: https://github.com/doctrine/annotations
- Homepage: https://www.doctrine-project.org/projects/annotations.html
- awesome-repositories: https://awesome-repositories.com/repository/doctrine-annotations.md

## Description

This project is a PHP docblock annotation parser and reflection metadata tool designed to extract structured metadata from doc-comments and convert them into class instances. It functions as a system for retrieving and managing custom metadata attached to classes, methods, and properties.

The library includes a metadata caching system to store parsed results, which reduces the performance overhead associated with repeated reflection calls and string parsing. It also serves as a static analysis utility for validating source code structure and enforcing coding standards through automated docblock analysis.

The project covers a broad range of capabilities including regex-based syntax parsing, class-based type resolution, and reflection-driven validation. It provides mechanisms for mapping doc-block tags to dedicated classes and indexing annotations to facilitate runtime metadata extraction.

## Tags

### Programming Languages & Runtimes

- [Doc-block Parsing](https://awesome-repositories.com/f/programming-languages-runtimes/class-and-method-annotations/annotation-to-class-mapping/doc-block-parsing.md) — The project extracts structured metadata from doc-blocks using a specific syntax to configure classes and functions. ([source](https://www.doctrine-project.org/projects/doctrine-annotations/en/stable/index.html))
- [Docblock Parsing](https://awesome-repositories.com/f/programming-languages-runtimes/string-parsing/docblock-parsing.md) — Parses structured documentation comments into usable PHP objects for application logic. ([source](https://www.doctrine-project.org/projects/doctrine-annotations/en/1.10/index.html))
- [Class and Method Annotations](https://awesome-repositories.com/f/programming-languages-runtimes/class-and-method-annotations.md) — Provides the ability to retrieve specific annotation values from classes, properties, or methods using reflection. ([source](https://www.doctrine-project.org/projects/doctrine-annotations/en/stable/index.html))
- [Annotation-to-Class Mapping](https://awesome-repositories.com/f/programming-languages-runtimes/class-and-method-annotations/annotation-to-class-mapping.md) — Transforms structured docblock annotations into dedicated class instances by resolving fully qualified names. ([source](https://www.doctrine-project.org/projects/doctrine-annotations/en/stable/annotations.html))
- [Class-Based Type Resolution](https://awesome-repositories.com/f/programming-languages-runtimes/class-based-type-resolution.md) — Maps specific annotation tags to dedicated PHP classes to define the expected structure of metadata.
- [Annotation Retrieval](https://awesome-repositories.com/f/programming-languages-runtimes/class-member-access/object-member-access/private-property-access/reflection-based-access/annotation-retrieval.md) — Retrieves specific annotation instances from classes or functions using reflection to access configured properties. ([source](https://www.doctrine-project.org/projects/doctrine-annotations/en/1.14/index.html))
- [Class Metadata Inspection](https://awesome-repositories.com/f/programming-languages-runtimes/class-metadata-inspection.md) — Enables the discovery and retrieval of configured metadata attached to classes and methods at runtime. ([source](https://www.doctrine-project.org/projects/doctrine-annotations/en/1.12/index.html))
- [Docblock Tag Mapping](https://awesome-repositories.com/f/programming-languages-runtimes/docblock-tag-mapping.md) — Maps specific doc-block tags to dedicated classes to define the expected structure of metadata. ([source](https://www.doctrine-project.org/projects/doctrine-annotations/en/1.10/index.html))
- [Doc-Comment Analysis](https://awesome-repositories.com/f/programming-languages-runtimes/php-parsers/doc-comment-analysis.md) — Extracts structured metadata specifically from PHP documentation comments and converts them into class instances.
- [PHP Reflection Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/php-reflection-libraries.md) — Provides a standardized interface for retrieving and managing custom metadata attached to PHP code structures.
- [Reflection Wrappers](https://awesome-repositories.com/f/programming-languages-runtimes/reflection-apis/reflection-wrappers.md) — Extends reflection capabilities to retrieve and validate custom metadata attached to code elements at runtime.
- [Docblock-to-Object Mapping](https://awesome-repositories.com/f/programming-languages-runtimes/reflection-based-object-manipulation/object-mapping/docblock-to-object-mapping.md) — Transforms structured text within comments into instantiated class objects via name resolution and imports.
- [Custom Annotation Definitions](https://awesome-repositories.com/f/programming-languages-runtimes/type-annotations/class-member-annotations/custom-annotation-definitions.md) — Allows the creation of specialized classes to represent specific metadata configurations. ([source](https://www.doctrine-project.org/projects/doctrine-annotations/en/1.14/index.html))
- [PHP Code Analysis](https://awesome-repositories.com/f/programming-languages-runtimes/php-code-analysis.md) — Analyzes the structure and metadata of PHP source code to validate structural consistency.

### Part of an Awesome List

- [Attribute Reflection](https://awesome-repositories.com/f/awesome-lists/devtools/reflection-and-metadata/attribute-reflection.md) — Uses reflection to locate and retrieve metadata attributes and tags from classes and methods.
- [Reflection-Driven Validation](https://awesome-repositories.com/f/awesome-lists/devtools/reflection/reflection-driven-validation.md) — Validates annotation placement and data types by comparing parsed metadata against target reflection properties.
- [General Utilities](https://awesome-repositories.com/f/awesome-lists/devtools/general-utilities.md) — Library for reading class annotations.

### Software Engineering & Architecture

- [Code Annotations](https://awesome-repositories.com/f/software-engineering-architecture/metadata-attachments/code-annotations.md) — Extracts structured metadata from source code annotations for runtime analysis via reflection. ([source](https://www.doctrine-project.org/projects/doctrine-annotations/en/stable/custom.html))
- [Coding Standards Enforcement](https://awesome-repositories.com/f/software-engineering-architecture/coding-standards-enforcement.md) — Validates source code against structural rules and style guidelines using automated docblock analysis. ([source](https://www.doctrine-project.org/projects/doctrine-coding-standard/en/current/reference/index.html))
- [Parsed Metadata Caching](https://awesome-repositories.com/f/software-engineering-architecture/metadata-reflection-frameworks/metadata-parsing/parsed-metadata-caching.md) — Includes a metadata caching system to reduce performance overhead from repeated reflection and parsing.
- [Regex-Based Parsers](https://awesome-repositories.com/f/software-engineering-architecture/syntax-parsing-engines/regex-based-parsers.md) — Uses regular expressions to analyze raw docblock strings and extract annotation symbols and values.

### Testing & Quality Assurance

- [Annotation Processor Validation](https://awesome-repositories.com/f/testing-quality-assurance/validation-verification/input-validation/compile-time-validators/annotation-processor-validation.md) — Implements validation logic to verify that annotations are placed on correct source elements and contain valid data types. ([source](https://www.doctrine-project.org/projects/doctrine-annotations/en/stable/custom.html))
- [Structural Rule Enforcement](https://awesome-repositories.com/f/testing-quality-assurance/static-code-analysis/structural-rule-enforcement.md) — Validates source code structure and enforces coding standards through automated docblock analysis.

### Data & Databases

- [Parsed Code Caching](https://awesome-repositories.com/f/data-databases/data-caching/persistent-binary-caches/parsed-code-caching.md) — Caches the object representation of parsed docblocks to eliminate the overhead of repeated reflection and parsing.
- [Metadata Caches](https://awesome-repositories.com/f/data-databases/in-memory-caches/metadata-caches.md) — Implements in-memory storage for parsed annotations to reduce the cost of repeated reflection calls.
