- What is phpdocumentor/reflection-common used for?
- It is a small, dependency-free PHP library that defines shared interfaces and value objects used by phpDocumentor's reflection stack. The main pieces are Fqsen, Name, QualifiedName, and contracts such as Element, File, and Project. It has no runtime services, configuration, or I/O; it mainly parses, normalizes, and validates structural names. Laravel developers typically encounter it through documentation or static-analysis tooling rather than by using it directly.
- How do I install phpdocumentor/reflection-common in a Laravel project?
- Run composer require phpdocumentor/reflection-common --dev if you are authoring tooling that needs the interfaces or Fqsen objects directly. In most Laravel projects it already arrives transitively through packages such as phpdocumentor/reflection-docblock, so a direct require is often unnecessary. There is no service provider, config publish step, or migration to run. Commit the composer.json and composer.lock changes and verify the resolved version against your PHP matrix.
- Is phpdocumentor/reflection-common a Laravel package?
- No, it is a framework-agnostic PHP library maintained by the phpDocumentor project, not a Laravel package. It ships no service providers, facades, configuration, or Laravel-specific integrations. You can use it in Laravel projects only as a dev or tooling dependency for documentation generation, static analysis, or PHPDoc parsing. It is not intended for application request handling or domain logic.
- Which PHP versions and Laravel versions are supported?
- ReflectionCommon itself does not target Laravel versions; it is constrained by PHP version and by the tooling that depends on it. The 2.x API has been stable for a long time, and recent CI coverage includes PHP 8.1 through 8.4, but you should check the exact composer.json PHP constraint before adding it to an older or newer matrix. For Laravel, compatibility comes from the package that pulls it in, such as a docblock parser or documentation generator. Test on your supported PHP and Laravel combination rather than assuming a Laravel-specific support table.
- Should I use phpdocumentor/reflection-common in Laravel application code?
- No. It belongs in the tooling lane, not the request path of a Laravel application. Fqsen semantics use leading backslashes and :: member syntax that differ from Laravel's Str helpers and class-string conventions, so mixing them into domain code can produce subtly wrong identifiers. Use native PHP reflection or Laravel's container and class-string utilities for runtime application concerns. Reserve ReflectionCommon for generators, linters, and PHPDoc-aware tooling.
- What is Fqsen and when should a Laravel developer use it?
- Fqsen represents a fully qualified structural element name, such as \App\Models\User or \App\Models\User::find(). A Laravel developer would need it when building or extending documentation generators, API schema derivation, or static-analysis rules that resolve controllers, methods, properties, or parameters. It is not a general-purpose string helper and should not replace Laravel's class-string or Str utilities. Use it only where the phpDocumentor reflection contracts are already in play.
- Do I need to install it directly or is it a transitive dependency?
- In practice it is usually transitive. It commonly arrives through phpdocumentor/reflection-docblock and related docblock-parsing or documentation-generation packages. Require it directly only when your own tool implements its interfaces or constructs Fqsen and Name values. Otherwise, rely on the dependency graph and pin versions through your main tooling package.
- Does phpdocumentor/reflection-common require configuration or a service provider?
- No configuration is required. There is no service provider, no config file to publish, no credentials, no database schema, and no filesystem or network access. Integration is a Composer dependency and, if needed, an autoload reference to its interfaces or value objects. That minimal surface is why integration cost is usually measured in hours rather than sprints.
- Is phpdocumentor/reflection-common safe and maintained for production tooling?
- The blast radius is low because it is MIT-licensed, dependency-free, and does no I/O or network access. The parsed-name contract has been stable across the 2.x line. The moderate risk is governance: it is a small, volunteer-maintained project under the phpDocumentor org, so a future 3.x with stricter typing could break direct consumers. Treat it as best-effort community support and avoid direct coupling unless your tooling genuinely needs it.
- What are alternatives to phpdocumentor/reflection-common for Laravel documentation generation?
- For documentation generation, the natural companions are phpdocumentor/reflection and phpdocumentor/reflection-docblock; for AST-level analysis, nikic/php-parser is a common choice. For simple runtime inspection in Laravel, PHP's native Reflection API and Laravel's container reflection are usually enough. If you only need class-name normalization, use Laravel's class-string conventions or Str helpers instead of Fqsen. Choose ReflectionCommon when you specifically need its shared phpDocumentor contracts, not as a general reflection layer.