Skip to content

Instantly share code, notes, and snippets.

@JFossey
JFossey / a-php-fatal-error-log-with-stack-trace-workaround.md
Last active July 6, 2018 11:03
PHP fatal error log handler with optional debug stack trace workaround

PHP Fatal with a mini stack trace workaround

Often you get a fatal error to deal with but where the problem code is not always very clear where the problem is.

This is especially difficult for fatal errors like "NOTICE: PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted.

When memory errors any debugging can easily influence the location the fatal is triggered.

Everything on the Internet states that you cant get a stack trace for a fatal. The most common suggested solution is to use a custom shutdown function to at least handle the fatal in some way maybe log it.

@JFossey
JFossey / ExampleFacade.php
Last active October 12, 2021 15:43
Application / DOMAIN Packages: How to separate code (PHP Composer + Laravel)
<?php
declare(strict_types=1);
namespace Example;
// Framework
use Illuminate\Support\Facades\Facade;
/**