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
Phan Extensions

Phan Extensions Laravel Package

drenso/phan-extensions

PhanExtensions provides plugins and stubs for Phan static analysis: Symfony annotation import checking, docblock @method/@throws usage, and inline var comment scanning. Includes stubs for curl, intl, ldap, pdo, radius, and sockets. Not actively maintained.

View on GitHub
Deep Wiki
Context7

This project contains several extensions (stubs/plugins) to be used with Phan for static PHP analysis

Frequently asked questions about Phan Extensions
Can I use PhanExtensions with Laravel 10+ and PHP 8.2?
The package supports PHP 7.1+, but Laravel 10+ requires PHP 8.2. While technically compatible, the unmaintained status means no guarantees for PHP 8.x features like attributes or named arguments. Test thoroughly in a non-production environment.
How do I add PhanExtensions to my Laravel project?
Install via Composer: `composer require drenso/phan-extensions`. Configure Phan’s `plugins` array in your `phan.config.php` to include paths like `vendor/drenso/phan-extensions/Plugin/Annotation/SymfonyAnnotationPlugin.php`. Add stubs to `directory_list` and exclude them from analysis.
Does PhanExtensions work with Symfony annotations in Laravel?
Yes, the `SymfonyAnnotationPlugin` checks for imported annotations (e.g., `@Route`, `@Middleware`). It ignores `Annotation`, `Target`, and `SuppressWarnings` by default. Useful for Laravel apps leveraging Symfony components like `HttpKernel` or `HttpFoundation`.
Are the docblock plugins (`@method`, `@throws`) still useful?
The `@method` plugin remains relevant for marking classes as used. The `@throws` plugin is obsolete in Phan 0.12.3+, so skip it. Phan now handles `@throws` natively, reducing dependency on this package for that feature.
Will PhanExtensions break if I upgrade Phan to v5.x?
Likely. The package targets Phan 3.x and is unmaintained. Test compatibility by running Phan with `--debug` after upgrading. If broken, consider forking or replacing obsolete plugins (e.g., `@throws`) with Phan’s built-in features.
How do I integrate Phan with Laravel’s CI/CD (GitHub Actions)?
Add Phan to your workflow as a step: `composer require --dev phan/drenso/phan-extensions && vendor/bin/phan`. Fail the build on warnings/errors by checking exit codes. Example: `if [ $? -ne 0 ]; then exit 1; fi`. Pair with `php-cs-fixer` for style checks.
Are there alternatives to PhanExtensions for Laravel?
Yes. For Symfony annotations, PHPStan’s `symfony` extension or Psalm’s built-in support may suffice. For stubs, Phan’s core includes some (e.g., `curl`). For docblock parsing, PHPStan/Psalm handle `@method`/`@throws` natively. Evaluate trade-offs before adopting.
Can I use PhanExtensions stubs (curl, intl, pdo) in production?
Yes, but benchmark first. Stubbing adds analysis overhead. Test with a large Laravel app (e.g., 50K+ LOC) to measure runtime impact. Disable stubs in CI if performance is critical, then re-enable for critical paths.
How do I handle false positives from SymfonyAnnotationPlugin?
False positives often occur with custom annotations. Suppress warnings in Phan’s config: `'suppress_issue_types' => ['PhanUnreferencedClass']`. Test against Laravel’s framework/src to validate accuracy. Report issues to Phan’s GitHub if misclassifications persist.
Should I fork PhanExtensions for Laravel-specific needs?
Consider forking if you need Laravel-specific plugins (e.g., `@Route`, `@Middleware` support). Replace obsolete plugins (like `@throws`) with Phan’s native features. Document changes clearly for maintainability. Alternatively, contribute fixes upstream to Phan.
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.
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
spatie/laravel-javascript-views