PHPackages                             abhishekdas/shutdown-scheduler - 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. abhishekdas/shutdown-scheduler

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

abhishekdas/shutdown-scheduler
==============================

A lightweight PHP library for managing shutdown events in your applications

v1.0.1(10mo ago)00GPL-3.0-or-laterPHPPHP &gt;=5.6.0

Since Jun 17Pushed 10mo agoCompare

[ Source](https://github.com/AbhishekDas/shutdown-scheduler)[ Packagist](https://packagist.org/packages/abhishekdas/shutdown-scheduler)[ Docs](https://github.com/abhishekdas/shutdown-scheduler)[ RSS](/packages/abhishekdas-shutdown-scheduler/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Shutdown Scheduler
==================

[](#shutdown-scheduler)

[![License: GPL-3.0](https://camo.githubusercontent.com/4f1aea56e08d732c101f4c95c81d08a529b97ed8f447f5ac303dfa76e0559d63/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c253230332e302d626c75652e737667)](https://opensource.org/licenses/GPL-3.0)

A lightweight PHP library for managing shutdown events in your applications. Shutdown Scheduler allows you to register callbacks that will execute when your script ends, ensuring proper cleanup and resource handling even during unexpected script termination.

📋 Table of Contents
-------------------

[](#-table-of-contents)

- [Features](#-features)
- [Installation](#-installation)
- [Basic Usage](#-basic-usage)
- [Advanced Examples](#-advanced-examples)
    - [Cron Job Implementation](#cron-job-implementation)
- [API Reference](#-api-reference)
- [Development](#-development)
    - [Running Tests](#running-tests)
    - [Coding Standards](#coding-standards)
- [Contributing](#-contributing)
- [License](#-license)

✨ Features
----------

[](#-features)

- **Reliable Execution**: Callbacks are guaranteed to run when the script terminates
- **Event-Based System**: Register multiple shutdown events with unique names
- **Simple API**: Intuitive methods for registering and unregistering callbacks
- **Error Handling**: Built-in validation for callbacks and event names
- **Resource Cleanup**: Perfect for database connections, file handlers, and temporary resources

🚀 Installation
--------------

[](#-installation)

### Manual Installation

[](#manual-installation)

Simply include the `ShutdownScheduler.php` file in your project:

```
require_once 'path/to/ShutdownScheduler.php';
```

### Composer (Recommended)

[](#composer-recommended)

Add the package to your `composer.json` file:

```
{
    "require": {
        "abhishekdas/shutdown-scheduler": "^1.0"
    }
}
```

Then run:

```
composer install

```

🔰 Basic Usage
-------------

[](#-basic-usage)

Here's a simple example of how to use Shutdown Scheduler:

```

```

🔄 Advanced Examples
-------------------

[](#-advanced-examples)

### Cron Job Implementation

[](#cron-job-implementation)

The following example demonstrates how to use the ShutdownScheduler in a cron job to prevent multiple instances from running simultaneously:

```
