- What is happenv-com/filament-phpstan-macros used for?
- It is a development package that teaches PHPStan and Larastan about macros registered on Filament components. This improves static analysis of Filament's dynamic macro-based APIs, reducing false positives and enabling more accurate type checking in Laravel applications. It does not add runtime features to your app.
- How do I install happenv-com/filament-phpstan-macros?
- Install it as a Composer dev dependency in your Laravel project, typically with composer require --dev happenv-com/filament-phpstan-macros. Then make sure your PHPStan or Larastan configuration loads the package's extension or configuration as documented. Because it is for static analysis, it should not be required in production.
- Which Laravel versions are supported by this package?
- The package is intended for Laravel applications that use Filament and PHPStan or Larastan. Exact Laravel, Filament, and PHPStan version constraints are defined in the package's composer.json. Check those constraints before upgrading to confirm compatibility with your project.
- Do I need Larastan to use happenv-com/filament-phpstan-macros?
- The package is built around improving PHPStan analysis for Filament macros and is particularly useful alongside Larastan in Laravel projects. Larastan provides Laravel-specific PHPStan understanding, while this package adds awareness of Filament macro registrations. You can still use PHPStan directly, but Larastan is the common setup for Laravel apps.
- How does it reduce PHPStan false positives with Filament?
- Filament exposes many dynamic macro-based APIs that generic static analysis cannot fully infer. This package supplies PHPStan with information about those macros so calls are recognized more accurately. As a result, PHPStan is less likely to report missing methods or incorrect types for valid Filament macro usage.
- Will it improve autocompletion in my editor?
- More accurate static type information can improve editor insight when your IDE uses PHPStan or similar analysis results. The package's primary goal is better PHPStan and Larastan analysis of Filament macros, not runtime behavior. Autocompletion benefits depend on your editor and how it consumes static analysis data.
- Is happenv-com/filament-phpstan-macros safe to use in production?
- Yes, it is intended as a development-only dependency for static analysis. It should be installed with --dev and does not need to be deployed or loaded in production. Keeping it out of production dependencies helps avoid unnecessary packages in your runtime environment.
- How can I verify that Filament macros are recognized by PHPStan?
- Run PHPStan or Larastan after installing and configuring the package, then compare the errors reported for your Filament macro calls. You can create a small analysis target that calls a registered macro and confirm PHPStan resolves it correctly. If errors remain, check that the extension is loaded and that your macro registration patterns are covered.
- Does it support custom macros on Filament components?
- The package is designed for macros registered on Filament components and aims to improve analysis of Filament's dynamic macro APIs. Custom macros that follow Filament's registration patterns should benefit from the added type information. Verify your specific custom macro setup with a PHPStan run after configuration.
- Why use this instead of ignoring PHPStan errors or adding stubs?
- Ignoring errors or adding broad stubs can hide real type problems and add maintenance overhead. This package targets Filament macro awareness specifically so PHPStan can understand valid dynamic calls more accurately. That gives you stronger analysis without suppressing unrelated issues across your Laravel codebase.