texdc / guard
assertion library with reusable guard function
Installs: 345
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/texdc/guard
Requires
- php: ^7.1
- beberlei/assert: @stable
Requires (Dev)
- phpmd/phpmd: @stable
- phpmetrics/phpmetrics: @stable
- phpunit/phpunit: @stable
- satooshi/php-coveralls: @stable
- squizlabs/php_codesniffer: @stable
This package is not auto-updated.
Last update: 2025-09-28 10:16:22 UTC
README
An extension for beberlei/assert that adds some extra assertions and a factory function to simplify usage.
installation
composer require texdc/guard
usage
namespace my\lib; use function texdc\guard\verify; function storeRating(int $rating) : void { verify($rating)->numericRange(1, 10, 'rating should be from 1 - 10'); // ... } function speak(string $message, ?int $times = null) : void { verify($message)->notEmpty('message is required')->length(256, 'message is too long'); verify($times, 'invalid multiplier')->nullOr()->isModulus(8); // ... }