PHP Classes

File: README

Recommend this page to a friend!
  Classes of Jonathan Gotti   Simple MVC Shutdown Manager   README   Download  
File: README
Role: Documentation
Content type: text/plain
Description: simple documentation
Class: Simple MVC Shutdown Manager
Manage PHP script shutdown functions
Author: By
Last change:
Date: 13 years ago
Size: 1,548 bytes
 

Contents

Class file image Download
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);