Download the PHP package brenno-duarte/prettyexception without Composer
On this page you can find all versions of the php package brenno-duarte/prettyexception. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download brenno-duarte/prettyexception
More information about brenno-duarte/prettyexception
Files in brenno-duarte/prettyexception
Package prettyexception
Short Description PrettyException is a component that helps to manipulate the Whoops component.
License MIT
Informations about the package prettyexception
PHP PrettyException for Whoops
PrettyException is a component that helps to manipulate the Whoops component.
How to use
You can return the error using:
inPretty
: returns with the Whoops screeninJson
: returns the exception in JSONinText
: returns the exception in textinXml
: returns the exception in XML
Then use the run
method.
Customizing the exception screen
It is possible to make some customizations on the exception screen.
setTitle
: Sets the title for the error page.
table
: Adds a key=>value table of arbitrary data, labeled by $label, to the output. Useful where you want to display contextual data along with the error, about your application or project.
tableCallback
: Similar to PrettyPageHandler::addDataTable, but accepts a callable that will be called only when rendering an exception. This allows you to gather additional data that may not be available very early in the process.
closeTableAndRun
: Closes the table and executes the exception. Optionally, you can add a comment.
Running exception in other formats
In some cases like AJAX requests or using the command line, it is possible to display exceptions using runIfAjax
andrunIfCli
.
runIfAjax
will be executed if there are any AJAX requests and returned in JSON. Otherwise, the standard exception screen will be displayed.
runIfCli
will only be run from the PHP command line.
License
MIT