Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ixnode/php-exception
This library offers some ready to use PHP Exceptions.
https://github.com/ixnode/php-exception
exception exception-handling php php8
Last synced: 10 days ago
JSON representation
This library offers some ready to use PHP Exceptions.
- Host: GitHub
- URL: https://github.com/ixnode/php-exception
- Owner: ixnode
- License: mit
- Created: 2022-12-30T11:47:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-03T21:13:41.000Z (over 1 year ago)
- Last Synced: 2024-09-20T15:38:35.870Z (about 2 months ago)
- Topics: exception, exception-handling, php, php8
- Language: PHP
- Homepage:
- Size: 94.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP Exception
[![Release](https://img.shields.io/github/v/release/ixnode/php-exception)](https://github.com/ixnode/php-exception/releases)
[![PHP](https://img.shields.io/badge/PHP-^8.0-777bb3.svg?logo=php&logoColor=white&labelColor=555555&style=flat)](https://www.php.net/supported-versions.php)
[![PHPStan](https://img.shields.io/badge/PHPStan-Level%20Max-brightgreen.svg?style=flat)](https://phpstan.org/user-guide/rule-levels)
[![PHPCS](https://img.shields.io/badge/PHPCS-PSR12-brightgreen.svg?style=flat)](https://www.php-fig.org/psr/psr-12/)
[![LICENSE](https://img.shields.io/github/license/ixnode/php-exception)](https://github.com/ixnode/php-exception/blob/master/LICENSE)> This library offers some ready to use PHP Exceptions.
## Exception Classes
### Group `Array`
Array
Name
Parameter
Usage
ArrayKeyNotFoundException
string $key
Used to indicate that a key in an array does not exist.
ArrayCountException
none
Used to indicate that two given arrays do not match in size.
### Group `Case`
Case
Name
Parameter
Usage
CaseInvalidException
string $given
array $expected
Used to indicate that a specified case is not supported (match, switch, etc.).
CaseUnsupportedException
string $case
Used to indicate that a specified case is not supported (logic
missing things, etc.).
### Group `Class`
Class
Name
Parameter
Usage
ClassInvalidException
string $class
string $expected
Used to indicate that a given or passed class is invalid.
### Group `Configuration`
Configuration
Name
Parameter
Usage
ConfigurationMissingException
string $hint
Used to indicate that a configuration or an action is missing.
### Group `Db`
Db
Name
Parameter
Usage
DbEntityNotFoundException
string $class
Used to indicate that a db entity was not found.
### Group `File`
File
Name
Parameter
Usage
FileNotFoundException
string $path
Used to indicate that a given file was not found.
FileNotReadableException
string $path
Used to indicate that a given file is not readable.
FileNotWriteableException
string $path
Used to indicate that a file cannot be written.
### Group `Function`
Function
Name
Parameter
Usage
FunctionCurlExecException
string $error
string $url
Used to indicate that the curl_exec function is not working properly.
FunctionFOpenException
none
Used to indicate that the function fopen does not work properly.
FunctionJsonEncodeException
none
Used to indicate that an object cannot be converted into a JSON string.
FunctionReplaceException
string $replacePattern
Used to indicate that a value could not be replaced (str_replace, preg_replace, etc.).
### Group `Parser`
Parser
Name
Parameter
Usage
ParserException
string $parseString
string $context
Used to indicate that a given string could not be parsed.
### Group `Type`
Type
Name
Parameter
Usage
TypeInvalidException
string $expected
?string $given = null
Used to indicate that a given or passed variable is the wrong type.
## Installation
```bash
composer require ixnode/php-exception
``````bash
vendor/bin/php-exception -V
``````bash
php-exception 0.1.0 (12-30-2022 11:41:25) - Björn Hempel
```## Usage
```php
use Ixnode\PhpException\FileNotFoundException;
``````php
throw new FileNotFoundException('path-to-file');
```## Development
```bash
git clone [email protected]:ixnode/php-exception.git && cd php-exception
``````bash
composer install
``````bash
composer test
```## License
This tool is licensed under the MIT License - see the [LICENSE](/LICENSE) file for details