Skip to content

Repository files navigation

PHP Exception

ReleasePHPPHPStanPHPCSLICENSE

This library offers some ready to use PHP Exceptions.

Exception Classes

Group Array

Array

Name

Parameter

Usage
ArrayKeyNotFoundExceptionstring $keyUsed to indicate that a key in an array does not exist.
ArrayCountExceptionnoneUsed to indicate that two given arrays do not match in size.

Group Case

Case

Name

Parameter

Usage
CaseInvalidExceptionstring $given
array $expected
Used to indicate that a specified case is not supported (match, switch, etc.).
CaseUnsupportedExceptionstring $caseUsed to indicate that a specified case is not supported (logic missing things, etc.).

Group Class

Class

Name

Parameter

Usage
ClassInvalidExceptionstring $class
string $expected
Used to indicate that a given or passed class is invalid.

Group Configuration

Configuration

Name

Parameter

Usage
ConfigurationMissingExceptionstring $hintUsed to indicate that a configuration or an action is missing.

Group Db

Db

Name

Parameter

Usage
DbEntityNotFoundExceptionstring $classUsed to indicate that a db entity was not found.

Group File

File

Name

Parameter

Usage
FileNotFoundExceptionstring $pathUsed to indicate that a given file was not found.
FileNotReadableExceptionstring $pathUsed to indicate that a given file is not readable.
FileNotWriteableExceptionstring $pathUsed to indicate that a file cannot be written.

Group Function

Function

Name

Parameter

Usage
FunctionCurlExecExceptionstring $error
string $url
Used to indicate that the curl_exec function is not working properly.
FunctionFOpenExceptionnoneUsed to indicate that the function fopen does not work properly.
FunctionJsonEncodeExceptionnoneUsed to indicate that an object cannot be converted into a JSON string.
FunctionReplaceExceptionstring $replacePatternUsed to indicate that a value could not be replaced (str_replace, preg_replace, etc.).

Group Parser

Parser

Name

Parameter

Usage
ParserExceptionstring $parseString
string $context
Used to indicate that a given string could not be parsed.

Group Type

Type

Name

Parameter

Usage
TypeInvalidExceptionstring $expected
?string $given = null
Used to indicate that a given or passed variable is the wrong type.

Installation

composer require ixnode/php-exception
vendor/bin/php-exception -V
php-exception 0.1.0 (12-30-2022 11:41:25) - Björn Hempel <bjoern@hempel.li>

Usage

useIxnode\PhpException\FileNotFoundException;
thrownewFileNotFoundException('path-to-file');

Development

git clone git@github.com:ixnode/php-exception.git &&cd php-exception
composer install
composer test

License

This tool is licensed under the MIT License - see the LICENSE file for details

About

This library offers some ready to use PHP Exceptions.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages