widmogrod / php-exceptions
Collection PHP exceptions grouped by functionality with nice ::assert API
Installs: 286 155
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires (Dev)
- phpspec/phpspec: ^2
This package is auto-updated.
Last update: 2024-12-07 19:12:19 UTC
README
Introduction
How many times you throw exceptions in your code? and how many of them are repeating?
This library collects general use cases and provide nice ::assert API.
Use it, don't waste your development time for custom exceptions, use one of our exceptions classes.
Usage
Tired of writing is_array($value) || $value instanceof \Traversable
?
Use predefined assertions and save your time, like so:
use Exception\InvalidTypeException; function thatCanCantBeViolated($arrayOrTraversable) { InvalidTypeException::assertIsTraversable($arrayOrTraversable); // do your regular work }
Installation
composer require widmogrod/php-exceptions
Development
This repository follows semantic versioning concept. If you want to contribute, just follow GitHub workflow and open a pull request.
Testing
Quality assurance is brought to you by PHPSpec
composer test