{"id":16275233,"url":"https://github.com/ghostff/session","last_synced_at":"2025-04-30T07:09:32.307Z","repository":{"id":17387650,"uuid":"81879759","full_name":"Ghostff/Session","owner":"Ghostff","description":"PHP Session Manager (non-blocking, flash, segment, session encryption)","archived":false,"fork":false,"pushed_at":"2024-07-24T14:28:04.000Z","size":74055,"stargazers_count":36,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T07:09:26.456Z","etag":null,"topics":["encryption","flash","memcached","mysql","non-blocking","php7","redis","session","session-encryption","session-management","session-php","sqlite"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ghostff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-13T22:44:04.000Z","updated_at":"2025-03-02T14:34:16.000Z","dependencies_parsed_at":"2024-05-22T16:01:07.103Z","dependency_job_id":"57d43c66-58cb-45e2-8fac-db2b6a94242a","html_url":"https://github.com/Ghostff/Session","commit_stats":{"total_commits":88,"total_committers":3,"mean_commits":"29.333333333333332","dds":0.09090909090909094,"last_synced_commit":"a8967eff6583b6b3504a101a1b5033640b66371c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghostff%2FSession","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghostff%2FSession/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghostff%2FSession/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghostff%2FSession/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ghostff","download_url":"https://codeload.github.com/Ghostff/Session/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658211,"owners_count":21622822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encryption","flash","memcached","mysql","non-blocking","php7","redis","session","session-encryption","session-management","session-php","sqlite"],"created_at":"2024-10-10T18:32:33.540Z","updated_at":"2025-04-30T07:09:32.289Z","avatar_url":"https://github.com/Ghostff.png","language":"PHP","readme":"# Session PHP(7.4+)\nPHP Session Manager (non-blocking, flash, segment, session encryption). Uses PHP [open_ssl](http://php.net/manual/en/book.openssl.php) for **optional** encrypt/decryption of session data.\n\n### Driver Support Scope\n![file](https://img.shields.io/badge/FILE-completed-brightgreen.svg?style=flat-square)\u0026nbsp;\u0026nbsp;\u0026nbsp;\n![cookie](https://img.shields.io/badge/COOKIE-completed-brightgreen.svg?style=flat-square)\u0026nbsp;\u0026nbsp;\u0026nbsp;\n![mysql](https://img.shields.io/badge/MYSQL-completed-brightgreen.svg?style=flat-square)\u0026nbsp;\u0026nbsp;\u0026nbsp;\n![sqlite](https://img.shields.io/badge/SQLITE-completed-brightgreen.svg?style=flat-square)\u0026nbsp;\u0026nbsp;\u0026nbsp;\n![memcached](https://img.shields.io/badge/MEMCACHED-completed-brightgreen.svg?style=flat-square)\u0026nbsp;\u0026nbsp;\u0026nbsp;\n![redis](https://img.shields.io/badge/REDIS-completed-brightgreen.svg?style=flat-square)\u0026nbsp;\u0026nbsp;\u0026nbsp;\n[![license](https://img.shields.io/pypi/l/Django.svg?style=flat-square)]()\u0026nbsp;\u0026nbsp;\u0026nbsp;\n[![Minimum PHP Version](https://img.shields.io/badge/PHP-%3E%3D%207.4-8892BF.svg?style=flat-square)](http://php.net/releases/7_4_0.php)\n\n# Installation   \nYou can download the Latest [release version ](https://github.com/Ghostff/Session/releases/) as a standalone, alternatively you can use [Composer](https://getcomposer.org/) \n```bash\ncomposer require ghostff/session\n```\n\n## Basic usage\n```php\n# Start session with default configurations.\n$session = new Session(); \n\n$session-\u003eset('email', 'foo@bar.com');\n\necho $session-\u003eget('email');\n```\n\n## Configuration Options\n```php\n# use custom configuration file.\nSession::setConfigurationFile('path/to/my/config.php');\n \n# overriding specific configuration settings\nSession::updateConfiguration([\n    Session::CONFIG_DRIVER        =\u003e Redis::class,\n    Session::CONFIG_START_OPTIONS =\u003e [\n        Session::CONFIG_START_OPTIONS_SAVE_PATH =\u003e __DIR__ . '/tmp'\n    ]\n]);\n\n# override a configuration for current session instance\n$session = new Session([Session::CONFIG_ENCRYPT_DATA =\u003e true]);\n```\n\n## Initializing Session\n```php\n# Start session with an auto generated id.\n$session = new Session(); \n\n# Start session with custom ID\n$session = new Session(null, bin2hex(random_bytes(32)));\n```\n\n## Using Segment *:Session*\n```php\n $segment = $session-\u003esegment('my_segment');\n```\n\n## Retrieving Session ID  *:string*\n```php\necho $session-\u003eid();\n```\n\n## Committing changes *:void*\n```php\n# Opens, writes and closes session.\n$session-\u003ecommit();\n```\n\n## Setting Session Data *:Session*\n```php\n$session-\u003eset('fname', 'foo');\n# Setting Segment\n$segment-\u003eset('name', 'bar');\n\n# Setting Flash\n$session-\u003esetFlash('name', 'foobar');\n# Setting Segment Flash\n$segment-\u003esetFlash('name', 'barfoo');\n\n$session-\u003ecommit();\n```\n\n## Retrieving Session Data *:mixed*\n```php\necho $session-\u003eget('name'); # outputs foo\necho $session-\u003egetOrDefault('unset_value', 'not found'); # outputs not found\n# Retrieving Segment\necho $segment-\u003eget('name'); # outputs bar\necho $segment-\u003egetOrDefault('unset_value', 'not found'); # outputs not found\n\n# Retrieving Flash\necho $session-\u003egetFlash('name'); # outputs foobar\necho $session-\u003egetFlashOrDefault('name', 'not found'); # outputs not found\n# Retrieving Segment Flash\necho $segment-\u003egetFlash('name'); # outputs barfoo\necho $segment-\u003egetFlashOrDefault('name', 'not found'); # outputs not found\n```\n\n## Removing Session Data *:Session*\n```php\n$session-\u003edel('name');\n# Removing Segment\n$segment-\u003edel('name');\n\n# Removing Flash\n$session-\u003edelFlash('name');\n# Removing Segment Flash\n$segment-\u003edelFlash('name');\n```\n\n## Retrieve all session or segment data *:array*\n```php\n$session-\u003egetAll();\n# Retrieve only in specified segment.\n$session-\u003egetAll('my_segment_name');\n```\n\n## Check if variable exist in current session namespace *:bool*\n```php\n$session-\u003eexist('name');\n# Search flashes\n$session-\u003eexist('name', true);\n```\n\n## Removing all data in current segment *:Session*\n```php\n$session-\u003eclear();\n```\n\n## Destroying session *:void*\n```php\n$session-\u003edestroy();\n```\n\n## Regenerate session ID *:void*\n```php\n$session-\u003erotate();\n# Delete the old associated session file or not\n$session-\u003erotate(true);\n```\n\n## Setting Queued Session Data *:Session*\n```php\n$session-\u003epush('age', 10)\n        -\u003epush('age', 20)\n        -\u003epush('age', 30)\n        -\u003epush('age', 40);\n```\n\n## Retrieving (pop/shift) Queued Session Data *:mixed*\n```php\necho $session-\u003epop('age', true);  # outputs 10\necho $session-\u003epop('age', true);  # outputs 20\necho $session-\u003epop('age');        # outputs 40\necho $session-\u003epop('age');        # outputs 30\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostff%2Fsession","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghostff%2Fsession","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostff%2Fsession/lists"}