Skip to main content

Posts

Showing posts with the label userland

Has anyone created a PHP Session-like class in user code (not native)?

The native PHP Session functionality is great, but it's ultimately a singleton. There are times when you need to maintain state for multiple apps and in the scope of an already-started session (e.g. in an app framework). Technically one can stop/restart a session after changing session_name() , but this is impractical/impossible/unsafe within most apps. Using a shared session.save_path is also not an option if one app stores session data with a non-disk adapter.