php7ify is a project that brings new php7 classes, functions and exceptions to php 5.x
- PHP 5.3
To install php7ify with composer, just add the following to your composer.json file:
{
"require": {
"dstuecken/php7ify": "1.0"
}
}
or by running the following command:
composer require dstuecken/php7ify
Just use the new \Throwable interface in your php 5 project, or catch an \Error exception.
try
{
mysql_query();
}
catch (Error $e)
{
echo $e->getMessage() . "\n\n";
echo $e->getTraceAsString();
}