PHP Classes

Simple MVC Shutdown Manager: Manage PHP script shutdown functions

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 236 All time: 8,084 This week: 660Up
Version License PHP version Categories
mvc-shutdown-manager 1.0MIT/X Consortium ...5PHP 5, Language
Description 

Author

This class can manage multiple PHP script shutdown functions.

It can manage a list of callback functions that should be called when the current PHP script exits.

The class can register a shutdown function with a given execution priority, unregister a function, check if a given function is registered, and execute all shutdown functions according to the associated priority.

Picture of Jonathan Gotti
Name: Jonathan Gotti is available for providing paid consulting. Contact Jonathan Gotti .
Classes: 13 packages by
Country: France France
Age: 48
All time rank: 724 in France France
Week rank: 193 Down8 in France France Down
Innovation award
Innovation award
Nominee: 4x

Details

shutdownManager will assist you managing your shutdown handlers. The main purpose of this class it to allow you to priorize your shutdown handlers without matter about the order you registered them in your code. The other benefits versus traditional register_shutdown_function is the possibility to remove a previously registered handlers or even avoid all of them at once. Here's some example of what you can do. #- registering a new handler: $callableCallback = 'myShutdownHandler'; // see php doc of call_user_func for info about valid callable callbacks $priority = 0; // optional priority of your callback default to 0 higher values means later call $handlerId = smvcShutdownManager::register($callableCallback,$priority); #- to check if an handler is registered: smvcShutdownManager::isRegistered($handlerId); or smvcShutdownManager::isRegistered($callableCallback); #- get all registered handlers: $registeredHandlers = smvcShutdownManager::isRegistered(); #- remove handler: smvcShutdownManager::unregister($handlerId); or smvcShutdownManager::unregister($callableCallback); #- remmoving all handlers at once: smvcShutdownManager::unregister(null); #- exit script bypassing registered handlers all at once: $exitStatut=0; // this value will be passed to exit function so see exit doc for more info on what you can pass here $bypassCallbacks = true; // setting second parameter to true will simply ignore any previously registered handlers. smvcShutdownManager::shutdown($exitStatut,$bypassCallbacks);

  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file README Doc. simple documentation
Accessible without login Plain text file shutdownManager.php Class main class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:236
This week:0
All time:8,084
This week:660Up