PHPackages                             mammatus/life-cycle-events - 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. mammatus/life-cycle-events

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

mammatus/life-cycle-events
==========================

♻️ Life Cycle Events for MammatusPHP Applications

2.3.0(7mo ago)0116.8k↑31775%1[3 PRs](https://github.com/MammatusPHP/life-cycle-events/pulls)1MITMakefilePHP ^8.2CI passing

Since Dec 18Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/MammatusPHP/life-cycle-events)[ Packagist](https://packagist.org/packages/mammatus/life-cycle-events)[ GitHub Sponsors](https://github.com/WyriHaximus)[ RSS](/packages/mammatus-life-cycle-events/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (11)Used By (1)

Life Cycle Events
=================

[](#life-cycle-events)

[![Continuous Integration](https://github.com/MammatusPHP/life-cycle-events/workflows/Continuous%20Integration/badge.svg)](https://github.com/MammatusPHP/life-cycle-events/workflows/Continuous%20Integration/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/8534137a1af862806c34d43627c932932add88c3f2c8a157527aefb5cd3c0f34/68747470733a2f2f706f7365722e707567782e6f72672f6d616d6d617475732f6c6966652d6379636c652d6576656e74732f762f737461626c652e706e67)](https://packagist.org/packages/mammatus/life-cycle-events)[![Total Downloads](https://camo.githubusercontent.com/28e5b99677fcc00e313415f92cfbe6f7216e912298d350ef385a64ed22446b7c/68747470733a2f2f706f7365722e707567782e6f72672f6d616d6d617475732f6c6966652d6379636c652d6576656e74732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/mammatus/life-cycle-events/stats)[![Code Coverage](https://camo.githubusercontent.com/d6a755b436d2b7e70cd08268861092c474209fe2b5ada0ce3cc79e91748d6ab7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d616d6d617475735048502f6c6966652d6379636c652d6576656e74732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/MammatusPHP/life-cycle-events/?branch=master)[![Type Coverage](https://camo.githubusercontent.com/9685f9fc7bb6e0d92e50b571a29f869d092240b608d7201fe4e83567dd26a267/68747470733a2f2f73686570686572642e6465762f6769746875622f4d616d6d617475735048502f6c6966652d6379636c652d6576656e74732f636f7665726167652e737667)](https://shepherd.dev/github/MammatusPHP/life-cycle-events)[![License](https://camo.githubusercontent.com/229f12418905835830cc3f243fb85f4c6e8c0c0bc23a7f99a4257ca5ea5be9b4/68747470733a2f2f706f7365722e707567782e6f72672f6d616d6d617475732f6c6966652d6379636c652d6576656e74732f6c6963656e73652e706e67)](https://packagist.org/packages/mammatus/life-cycle-events)

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

[](#installation)

To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `^`.

```
composer require mammatus/life-cycle-events

```

Events
======

[](#events)

Build
-----

[](#build)

Build event that is triggered during build time, e.g. on Docker build time before the application is deployed.

Kernel
------

[](#kernel)

Pre-Initialization phase for anything that MUST be set up first like OTEL.

Initialize
----------

[](#initialize)

Initialization phase for any blocking operation before the event loop starts.

Boot/Start
----------

[](#bootstart)

The event loop has just started running and the application is now running. Now the different between the `Boot` and `Start` event is that the `Boot` event is used for the generic catch all process. While `Start` is used for specific split out processes.

Shutdown
--------

[](#shutdown)

Shutdown is emitted when an fatal error occurred or an OS signal is caught an the application is shutting down.

Listener
--------

[](#listener)

The following listener is from one of my apps and listeners both on intialize and shutdown events. The logic has been taken out, but logging is left intact to demonstracte a simple listener example.

```
