Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Parser Reflection

Parser Reflection Laravel Package

goaop/parser-reflection

AST-based Reflection API for PHP: introspect classes, methods, and properties directly from source code without autoloading or executing anything. Built on nikic/php-parser and compatible with native Reflection classes—ideal for static analyzers, code generators, and IDE tooling.

View on GitHub
Deep Wiki
Context7

Provides reflection information, based on raw source

Frequently asked questions about Parser Reflection
Can I use this package to analyze Laravel’s service container classes without runtime overhead?
No, this package is designed for static analysis of source files only. Laravel’s service container classes (e.g., proxies, closures) are dynamically generated at runtime, so they won’t be parsed accurately. Focus on analyzing your application’s source code (e.g., controllers, models) instead.
How do I install goaop/parser-reflection in a Laravel project?
Run `composer require goaop/parser-reflection` in your project root. No additional Laravel-specific setup is needed—it’s a standalone library. Use it in custom Artisan commands, background jobs, or CLI scripts where static analysis is required.
Will this package work with Laravel’s dynamic proxies (e.g., Eloquent models, route model binding)?
No, this package only parses source code, not dynamically generated proxies. For proxy analysis, you’d need to combine it with runtime reflection (e.g., `ReflectionClass`) or exclude Laravel’s `vendor/` and `bootstrap/` directories from parsing.
Can I use this for real-time code analysis in Laravel middleware or controllers?
No, this package is for static analysis only and isn’t suited for runtime environments like middleware or controllers. It’s best for pre-deployment checks, CI pipelines, or CLI tools where performance and memory efficiency matter.
How does this compare to phpDocumentor/reflection-docblock for Laravel projects?
Both parse source code, but `goaop/parser-reflection` uses `nikic/php-parser` for deeper AST analysis (e.g., types, docblocks, methods). phpDocumentor focuses on documentation extraction. Choose this package if you need low-level code structure insights for tools like AOP or code generation.
What Laravel versions does this package support, and are there any known conflicts?
This package is framework-agnostic and works with any Laravel version. However, Laravel’s evolving class structure (e.g., new proxies, annotations) may require manual filtering. Test against LTS versions (10.x, 11.x) first to avoid edge cases.
How can I cache parsing results to improve performance in large Laravel apps?
Cache parsed ASTs using Laravel’s cache drivers (e.g., `Cache::remember`). Store results by file path or hash to avoid reprocessing. For CI/CD, cache results between runs to speed up static analysis tasks.
Does this package handle Laravel-specific annotations (e.g., #[Route], #[Middleware])?
Yes, it parses docblocks and attributes (PHP 8+) like any other code. However, dynamically generated annotations (e.g., from route macros) won’t appear in static analysis. Validate outputs against Laravel’s actual runtime behavior.
Can I integrate this into Laravel’s service provider for static checks during bootstrapping?
Yes, but avoid parsing during runtime—it’s slow and memory-intensive. Use a `booting` event in a service provider to trigger a background job (e.g., `ParseCodeJob`) or CLI command instead.
What’s the best way to test this package in a Laravel project?
Start with a small module (e.g., `app/Http/Controllers`) and compare its parsed output to `ReflectionClass` results. Test edge cases like traits, closures, and Laravel-specific annotations. Use PHPUnit to assert parsed data matches expected structures.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor