Documentation
SPHPlayground manual
sphplayground
sphplayground

Application configuration

Config a general configuration manager

A Config object can be used to store any type of PHP variables. An application can have multiple named singleton configuration objects. These objects are accessible via a static Config::instance() method.

PHP is a runtime PHP environment manager container

PHP utility class handles common PHP configuration related tasks via build-in singleton PHPConfig and named PHPIni instances.

PHP 8 Error and Exception handling

Since PHP 7.2+ most errors are reported by throwing Error exceptions. These can be catched by using 'try/catch blocks. If there are no matching blocks, then any default exception handler installed with set_exception_handler() will be called, and if there is no default exception handler, then the exception will be converted to a fatal error and will be handled like a traditional error.

ErrorDispatcher object to manage PHP error and exception listeners

This class can manage both PHP errors and uncaught Throwable objects.

ErrorDispatcher as PHP Error manager

An ErrorDispatcher object replaces PHP's native error handler and sends PHP errors to its error listeners. An Error listener must be a callable or of ErrorListener type.

All of the following PHP error types cannot be handled by an ErrorDispatcher instance

ErrorDispatcher as a Uncaught Throwable handler

In PHP 7, most errors are reported by throwing Error exceptions. Both Error and Exception implements the Throwable interface.

An Exception listener must be a callable or of ExceptionListener type.

NOTE: It is important to note that Script execution will stop after a handler is called.

Viewing and debugging PHP errors and exceptions

Exceptions, Errors,and warnings can be viewed with classes in this namespace

E_WARNING

include_once(not-a-file): Failed to open stream: No such file or directory
on line 17 of file:
/home3/fjlpxeha/playground.samiholck.fi/manual-app/content/examples/Sphp/Config/ErrorHandling/ErrorDispatcher.php

E_WARNING

include_once(): Failed opening 'not-a-file' for inclusion (include_path='.:/opt/cpanel/ea-php80/root/usr/share/pear:/home3/fjlpxeha/playground.samiholck.fi/sphp')
on line 17 of file:
/home3/fjlpxeha/playground.samiholck.fi/manual-app/content/examples/Sphp/Config/ErrorHandling/ErrorDispatcher.php

E_USER_ERROR

User defined Errors suck badly
on line 18 of file:
/home3/fjlpxeha/playground.samiholck.fi/manual-app/content/examples/Sphp/Config/ErrorHandling/ErrorDispatcher.php

E_USER_WARNING

User warnings suck
on line 19 of file:
/home3/fjlpxeha/playground.samiholck.fi/manual-app/content/examples/Sphp/Config/ErrorHandling/ErrorDispatcher.php

E_USER_DEPRECATED

Deprecated user features suck
on line 20 of file:
/home3/fjlpxeha/playground.samiholck.fi/manual-app/content/examples/Sphp/Config/ErrorHandling/ErrorDispatcher.php

E_USER_NOTICE

User defined Notes suck a bit
on line 21 of file:
/home3/fjlpxeha/playground.samiholck.fi/manual-app/content/examples/Sphp/Config/ErrorHandling/ErrorDispatcher.php

E_WARNING

Undefined variable $foo
on line 23 of file:
/home3/fjlpxeha/playground.samiholck.fi/manual-app/content/examples/Sphp/Config/ErrorHandling/ErrorDispatcher.php