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: about 1 year 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 (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-07T21:25:53.000Z (over 1 year ago)
- Last Synced: 2025-03-25T05:51:13.886Z (about 1 year ago)
- Topics: exception, exception-handling, php, php8
- Language: PHP
- Homepage:
- Size: 101 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
[](https://github.com/ixnode/php-exception/releases)
[](https://www.php.net/supported-versions.php)
[](https://phpstan.org/user-guide/rule-levels)
[](https://www.php-fig.org/psr/psr-12/)
[](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 git@github.com: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