tomshoo/defer

Backport of laravel 11 defer helper

Maintainers

Details

github.com/tomshoo/defer

Source

Issues

Installs: 501

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/tomshoo/defer

1.0.0 2024-11-23 14:44 UTC

This package is auto-updated.

Last update: 2026-01-23 17:20:18 UTC


README

This is a backport attept for laravel 11 defer helper.

Features

  • Postpones callback executions to after the response has been sent to a client
  • Maintains the database connection used when executing deferred callback.

Installation and Setup

Install the package within your project using,

composer require tomshoo/defer

Or you can add the following to your composer.json,

{
  "require": {
    "tomshoo/defer": "^1.0"
  }
}

Once installed you can then register the service provider, and the middleware, using the following samples.

// config/app.php

'providers' => [
    // ...,
    \Tomshoo\Defer\DeferServiceProvider::class,
    // ...,
],
// app/Http/Kernel.php

public class Kernel {
    protected $middleware = [
        \Tomshoo\Defer\Middleware\DeferCallbackExecutor::class,
        //...,
    ];
}