PHPackages                             tuupke/laravel-finalizer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tuupke/laravel-finalizer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tuupke/laravel-finalizer
========================

Simple package with helpers to handle execution after closed connections

1.0.5(1y ago)020.1k↓30%2MITPHPPHP &gt;=7.0.0

Since Nov 28Pushed 1y ago2 watchersCompare

[ Source](https://github.com/tuupke/laravel-finalizer)[ Packagist](https://packagist.org/packages/tuupke/laravel-finalizer)[ RSS](/packages/tuupke-laravel-finalizer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (7)Used By (2)

Introduction
============

[](#introduction)

Laravel's implementation of finalizers (through middleware) are still synchronous with the request and will therefor increase the response-time of your application. There are many use-cases - logging for instance - for which this is not desired.

Normally speaking, standard Laravel practices dictate that a job should be used in these cases. When this is overkill, this package can be used. It provides a small wrapper around PHP's `register_shutdown_function`, to help with these use-cases.

Installation
============

[](#installation)

Installation of this packages is done through composer.

`composer require "tuupke/laravel-finalizer"`

Then open `config/app.php` and append to the `providers` array:

`Tuupke\Finalizer\FinalizerServiceProvider::class,`

and add to the `aliasses` array:

`'Finalizer' => Tuupke\Finalizer\FinalizerFacade::class,`

Usage
=====

[](#usage)

From somewhere within your application you can now call: `Finalizer::register($closure))` with $closure some closure executing some action. Optionally, you can provide an integer as the second parameter, which will server as the priority. The lower this priority, the earlier it is executed. When 2 closures are registered with the same priority. The closure which was registered first, will be executed first.

Example
-------

[](#example)

A minimalist example which stores some contents in a file is listed below. Note that this should not be used in an actual application. When logging is required, use the Log facade.

```
Finalizer::register(function(){
    file_put_contents('/tmp/finalizer-test', "Second String", FILE_APPEND);
}, 2);

Finalizer::register(function(){
    file_put_contents('/tmp/finalizer-test', "First String\n", FILE_APPEND);
}, 1);

```

After a request has been executed which contained this code-block, the contents of `/tmp/finalizer-test` is:

```
First String
Second String

```

Use in non-Laravel applications
===============================

[](#use-in-non-laravel-applications)

Strictly speaking, this package can also be used in non-Laravel PHP applications which use composer. But it is not recommended and defeats the purpose of this package. If you want, you can still use it. A minimal example is provided below.

```
// include composer autoload
require 'vendor/autoload.php';

// import the Finalizer Class
use Tuupke\Finalizer;

// Create a new instance of the Finalizer. The class itself does not provide late static binding (yet).
$finalizer = new Finalizer;

// register some closure.
$finalizer->register(function(){
    ...  ...
});

```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~571 days

Recently: every ~624 days

Total

6

Last Release

601d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd90cab491582157594563240fe12d010e1a6a950f86cd4c5ebb8f0abe673094?d=identicon)[tuupke](/maintainers/tuupke)

---

Top Contributors

[![tuupke](https://avatars.githubusercontent.com/u/2218324?v=4)](https://github.com/tuupke "tuupke (8 commits)")

### Embed Badge

![Health badge](/badges/tuupke-laravel-finalizer/health.svg)

```
[![Health](https://phpackages.com/badges/tuupke-laravel-finalizer/health.svg)](https://phpackages.com/packages/tuupke-laravel-finalizer)
```

###  Alternatives

[fbett/le_acme2

Letsencrypt PHP ACME v2 client

323.7k](/packages/fbett-le-acme2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
