gacela-project / phpstan-extension
PHPStan rule for projects using Gacela
Fund package maintenance!
www.paypal.me/chemaclass
Installs: 330
Dependents: 3
Suggesters: 1
Security: 0
Stars: 4
Watchers: 3
Forks: 0
Open Issues: 4
Type:phpstan-extension
Requires
- php: >=7.4, <8.3
- gacela-project/gacela: >=0.1, <2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.13
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.18.4
- symfony/var-dumper: ^5.4
- vimeo/psalm: ^5.1
Suggests
- gacela-project/gacela: Gacela helps you separate your project into modules, focusing on the application/infrastructure layer, decoupled from your domain.
This package is auto-updated.
Last update: 2024-04-07 11:19:31 UTC
README
This is a PHPStan extension for Gacela Framework. This enforces module boundaries.
See main Gacela project for more information.
Installation
composer require --dev gacela-project/phpstan-extension
Configuration
To configure this PHPStan extension you need 2 things.
Base module namespace
It is assumed that all your modules are under the same namespace. Assume the namespaces for your modules are:
App\Modules\ModuleA
App\Modules\ModuleB
The base namespace for your modules is App\Modules
.
Excluded namespaces (Optional)
If you have namespace that hold code that can be used by any module (e.g. App\Shared
),
then you need to add them to excludedNamespaces
. Default: []
.
Update PHPStan configuration
Update your project's phpstan.neon
file:
includes: - vendor/gacela-project/phpstan-extension/extension.neon parameters: gacela: modulesNamespace: <base module namespace> excludedNamespaces: - excluded - namespaces
Examples
Example without excludedNamespaces
includes: - vendor/gacela-project/phpstan-extension/extension.neon parameters: gacela: modulesNamespace: App\Modules
Full example
includes: - vendor/gacela-project/phpstan-extension/extension.neon parameters: gacela: modulesNamespace: App\Modules excludedNamespaces: - App\Shared
Usage
Run PHPStan as usual. It will additional point out any violations of module boundaries.