Download the PHP package eboreum/exceptional without Composer

On this page you can find all versions of the php package eboreum/exceptional. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package exceptional

Eboreum/Exceptional: Create and format PHP exceptions easily

license build Code Coverage PHPStan Level

Create and format PHP exceptions easily. Automatically unravel method arguments. Ensure that sensitive strings like passwords, tokens, PHPSESSID, etc. are being masked and thus will instead appear as e.g. "**" in the resulting text.

When a method is called, and somehow that leads to an exception/throwable being raised, wouldn't it be nice knowing all arguments a method was called with? Exceptional can unravel that for you and present these arguments with their respective names in a concise and meaningful way. Additionally, the integration with Eboreum/Caster (https://packagist.org/packages/eboreum/caster) allows revealing of information about the object within which the exception/error occured. This is sometimes valuable and crucial information, and it is superb for debugging.

Requirements

For more information, see the composer.json file.

Installation

Via Composer (https://packagist.org/packages/eboreum/exceptional):

composer install eboreum/exceptional

Via GitHub:

git clone [email protected]:eboreum/exceptional.git

Fundamentals

Exception message generation

Example 1: The basics

Example:

Output:

Notice how each argument is paired with its respective values from the func_get_args() function. The argument $c has even received its default value, which func_get_args() will not return.

Example 2: Providing more arguments than there are named arguments

Example:

Output:

Notice how $a and $b are named, but the unnamed arguments have received their respective indexes, {2} and {3}.

Example 3: A constant as default value

Example:

Output:

Argument $a has received its default value from the class constant Fooc261bae9da674d679de77a943ae57779::SOME_CONSTANT, $b has received its default value from the class constant Fooaea91664ed3d4467aeb2dfabb2623b53::SOME_PARENT_CONSTANT, and $c has received its default value from the global constant GLOBAL_CONSTANT_25b105757d32443188cca9c7646ccfe6.

Example 4: Static method call

Example:

Output:

Notice how instead of $this, static::class is used.

Example 5: Making object descriptions verbose using caster

Wouldn't it be nice if we, in addition to the method argument snitching, could get additional information about the object within which the method failed? We can do just that using the Eboreum\Caster\Caster integration.

Example:

Output:

Notice how we now get useful information from the above object, its ID being 42 (and argument $a is 7).

You must use $this as the argument in the makeFailureInMethodMessage call (and not static::class) for the above to work.

Exception formatters

Example 1: Default formatter

Class: Eboreum\Exceptional\Formatting\DefaultFormatter

A plain text formatter. Contains line breaks and indentation.

Output:

Example 2: HTML5 <table> formatter

Class: Eboreum\Exceptional\Formatting\HTML5TableFormatter

Formats the throwable as HTML5 <table>.

Output:

Example 3: JSON formatter

Class: Eboreum\Exceptional\Formatting\JSONFormatter

Formats the throwable as JSON.

Output:

Example 4: Oneline formatter

Class: Eboreum\Exceptional\Formatting\OnelineFormatter

Formats the throwable as string with all its contents on a single line. Great for (improved) output in error logs, which do not allow line breaks.

Output:

Example 5: XML formatter

Class: Eboreum\Exceptional\Formatting\XMLFormatter

Formats the throwable as XML.

Output:

Test/development requirements

Running tests

For all unit tests, first follow these steps:

License & Disclaimer

See LICENSE file. Basically: Use this library at your own risk.

Contributing

We prefer that you create a ticket and or a pull request at https://github.com/eboreum/exceptional, and have a discussion about a feature or bug here.

Branch rules

main = 2.x (not a tag)

Previous branches:

Credits

Authors


All versions of exceptional with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
eboreum/caster Version ^2.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eboreum/exceptional contains the following files

Loading the files please wait ....