# doctrine/common

**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-common).**

5,807 stars · 286 forks · PHP · MIT

## Links

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

## Description

Doctrine Common is a set of shared libraries that provide foundational capabilities for parsing PHP docblock annotations, managing event-driven communication, and handling typed object collections. At its core, it includes a docblock annotation parser that reads structured metadata from PHP docblock comments, enabling configuration for object-relational mapping and validation rules. It also offers a typed collection abstraction with lazy-loading support, allowing efficient management of object groups through array-like operations.

The library extends these capabilities with an event management system that dispatches and listens to named events, enabling decoupled communication between application components. It includes tools for resolving annotation class names from docblock strings, tokenizing docblock text into parseable tokens, and extracting class metadata from annotations to drive configuration. The collection system provides grouping and lazy-loading proxy patterns to defer element loading until access, improving performance with large datasets.

Additional features include event subscription management for dynamic attachment and detachment of handlers, and a typed collection manager that wraps arrays with methods for iteration and filtering. The documentation covers installation and usage of these components as standalone libraries within the Doctrine ecosystem.

## Tags

### Data & Databases

- [Typed Data Collections](https://awesome-repositories.com/f/data-databases/typed-data-collections.md) — Manages typed, object-oriented collections with array-like operations and lazy-loading support. ([source](https://cdn.jsdelivr.net/gh/doctrine/common@3.5.x/README.md))
- [PHP Collection Abstractions](https://awesome-repositories.com/f/data-databases/typed-data-collections/data-directory-collections/structured-data-collection-managers/unified-collection-abstractions/php-collection-abstractions.md) — Provides typed, object-oriented collection classes with methods for iteration, filtering, and lazy-loading.

### Programming Languages & Runtimes

- [Annotation-to-Class Mapping](https://awesome-repositories.com/f/programming-languages-runtimes/class-and-method-annotations/annotation-to-class-mapping.md) — Resolves annotation class names from docblock strings by mapping short names to fully qualified class names.
- [Docblock Metadata Readers](https://awesome-repositories.com/f/programming-languages-runtimes/class-and-method-annotations/annotation-to-class-mapping/docblock-metadata-readers.md) — Reads class metadata from docblock annotations to configure object-relational mapping or validation rules.
- [Object Collection Management](https://awesome-repositories.com/f/programming-languages-runtimes/collection-data-structures/object-collection-management.md) — Provides typed, object-oriented collections with array-like operations and lazy-loading support. ([source](https://www.doctrine-project.org/projects/doctrine-common/en/current/))
- [Docblock Parsing](https://awesome-repositories.com/f/programming-languages-runtimes/string-parsing/docblock-parsing.md) — Parses structured metadata from PHP docblock comments using a tokenizer and lexer to extract annotations.
- [Docblock Lexers](https://awesome-repositories.com/f/programming-languages-runtimes/lexical-token-streams/token-stream-converters/regex-token-stream-lexers/docblock-lexers.md) — Tokenizes docblock text into a stream of tokens for building an abstract syntax tree of annotations.

### Software Engineering & Architecture

- [Event-Based Communication](https://awesome-repositories.com/f/software-engineering-architecture/event-based-communication.md) — Dispatches and listens to named events through a centralized event manager for decoupled communication.
- [Event Subscribers](https://awesome-repositories.com/f/software-engineering-architecture/event-subscribers.md) — Subscribes to and emits custom events across the application using an event manager. ([source](https://cdn.jsdelivr.net/gh/doctrine/common@3.5.x/README.md))
- [Collection Proxies](https://awesome-repositories.com/f/software-engineering-architecture/lazy-loading-patterns/collection-proxies.md) — Defers loading of collection elements until accessed, using a proxy pattern for performance with large datasets.

### User Interface & Experience

- [PHP Event Dispatchers](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling/event-handling-architectures/input-event-dispatchers/application-event-dispatching/php-event-dispatchers.md) — Emits and subscribes to custom events so application components can react to state changes.

### Part of an Awesome List

- [Listener Registries](https://awesome-repositories.com/f/awesome-lists/devtools/window-event-subscription-managers/listener-registries.md) — Manages a registry of event listeners and subscribers for dynamic attachment and detachment of handlers.
