Skip to content

Repository files navigation

davidlienhard/functioncaller

🐘 php library to call functions and catch triggered errors

Latest Stable VersionSource CodeSoftware LicenseMinimum PHP VersionCI Status

Setup

You can install through composer with:

composer require davidlienhard/functioncaller:^1

Note: davidlienhard/functioncaller requires PHP 8.0

Example

<?phpdeclare(strict_types=1);
useDavidLienhard\FunctionCaller\CallasFunctionCaller;
$caller = newFunctionCaller("file", "testfile.txt"); // create caller instance$result = $caller->getResult(); // get result from callif ($result === false) { // check if function has return false$errstr = $caller->getLastError()?->getErrstr(); // get error string$errno = $caller->getLastError()?->getErrno(); // get error numberthrownew \Exception("unable to read file 'testfile.php': ".$errstr." (".$errno.")");
}

License

The MIT License (MIT). Please see LICENSE for more information.

About

🐘 php library to call functions and catch triggered errors

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages