Download the PHP package gielfeldt/shutdownhandler without Composer
On this page you can find all versions of the php package gielfeldt/shutdownhandler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gielfeldt/shutdownhandler
More information about gielfeldt/shutdownhandler
Files in gielfeldt/shutdownhandler
Package shutdownhandler
Short Description Shutdown Handler.
License MIT
Homepage https://github.com/gielfeldt/shutdownhandler
Informations about the package shutdownhandler
Shutdown Handler
Installation
To install the ShutdownHandler library in your project using Composer, first add the following to your composer.json
config file.
Then run Composer's install or update commands to complete installation. Please visit the Composer homepage for more information about how to use Composer.
Shutdown handler
This shutdown handler class allows you to create advanced shutdown handlers, that can be manipulated after being created.
Motivation
-
Destructors are not run on fatal errors. In my particular case, I needed a lock class that was robust wrt to cleaning up after itself. See "Example 2" below or examples/fatal.php for an example of this.
- PHP shutdown handlers cannot be manipulated after registration (unregister, execute, etc.).
Example 1 - using Shutdown Handler
Example 2 - Ensuring object destruction
For more examples see the examples/ folder.
Features
- Unregister a shutdown handler
- Run a shutdown handler prematurely
- Improve object destructors by ensuring destruction via PHP shutdown handlers
- Keyed shutdown handlers, allowing to easily deduplicate multiple shutdown handlers
Caveats
- Lots probably.