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

Php Enum Phpstan Laravel Package

marc-mabe/php-enum-phpstan

PHPStan extension for marc-mabe/php-enum. Teaches PHPStan about enum accessor methods and allowed values so static analysis understands your enumerations and catches invalid usage. Install with Composer and include the provided extension.neon.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enables proactive error detection for enum-related bugs (e.g., invalid enum values, deprecated constant usage) during development, reducing runtime failures and debugging time.
  • Supports adopting PHPStan as a core quality gate in CI/CD pipelines, reinforcing type safety for enums without runtime overhead.
  • Eliminates the need to build custom static analysis rules for php-enum usage—making it a clear "buy" over "build" for teams already using marc-mabe/php-enum.
  • Critical for projects with complex enum-driven business logic (e.g., status transitions, configuration values) where incorrect enum usage could cause cascading failures.
  • Aligns with roadmap goals for code quality modernization, especially when migrating legacy codebases to typed enums or enforcing strict type validation.

When to Consider This Package

  • Adopt when: Your project uses marc-mabe/php-enum (not native PHP 8.1+ enums), has PHPStan in its toolchain, and prioritizes static type safety for enums. Ideal for medium-to-large codebases with enum-heavy workflows (e.g., payment statuses, role permissions).
  • Look elsewhere when: Using PHP 8.1+ native enums (PHPStan handles these natively), not using PHPStan at all, or maintaining legacy projects with php-enum <4.0 (incompatible). Also skip if your team lacks PHPStan expertise—this package adds minimal value without static analysis infrastructure.

How to Pitch It (Stakeholders)

Executives: "This tool catches enum-related bugs before code reaches production—like invalid status values or deprecated references—reducing costly outages and debugging time. It integrates seamlessly with our existing PHPStan setup, requiring minimal effort but delivering high ROI through cleaner code and faster releases."

Engineering: "Adds precise type inference for php-enum methods (getValue(), getValues(), from()) and constants in PHPStan. No more false positives for valid enum usage—just real-time validation of enum values, union types, and deprecations. Works out-of-the-box with 2 lines of config and fits perfectly into CI checks."

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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation
uri-template/tests