widmogrod/php-exceptions

Collection PHP exceptions grouped by functionality with nice ::assert API

0.1.0 2015-02-26 22:25 UTC

This package is auto-updated.

Last update: 2024-11-07 18:58:31 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