use Illuminate\Support\Str;
class Shutter {
public function shutdown()
{
if ($this->hasTimeoutOccurred()) {
dump('timeout');
}
}
private function hasTimeoutOccurred(): bool
{
$lastError = error_get_last();
if (!$lastError) {
return false;
}
if (Str::startsWith($lastError['message'], 'Maximum execution time')){
return true;
}
return false;
}
}
ini_set('max_execution_time', 1);
$shutter = new Shutter();
register_shutdown_function(fn() => $shutter->shutdown());
while(1);
public function shutdown()if ($this->hasTimeoutOccurred()) {if (Str::startsWith($lastError['message'], 'Maximum execution time')){
return true;
}$shutter = new Shutter();
register_shutdown_function(fn() => $shutter->shutdown());Sign up for our newsletter to stay up to date.
We care about the protection of your data. Read our Privacy Policy.
Schopenhauerstr. 71
80807 München
max@42coders.com
+49 (0)176 / 724 306 82
© 2025 42coders All rights reserved.