petrknap / has-requirements
Simple trait to check if requirements of your code are fulfilled
Fund package maintenance!
1.0.0
2026-04-11 07:30 UTC
Requires
- php: >=8.1
Requires (Dev)
- ext-zlib: *
- nunomaduro/phpinsights: ^2.11
- petrknap/shorts: ^3.3
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^10.5
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2026-04-11 07:36:42 UTC
README
final class ServiceWithRequirements { use PetrKnap\HasRequirements\HasRequirements; public function __construct() { self::checkRequirements(functions: ['required_function']); } public function do(): void { required_function(); } }
It should not replace Composers requires,
but it could improve them and check suggests.
Run composer require petrknap/has-requirements to install it.
You can support this project via donation.
The project is licensed under the terms of the LGPL-3.0-or-later.