{"id":15068619,"url":"https://github.com/xp-forge/sessions","last_synced_at":"2026-01-04T21:15:59.510Z","repository":{"id":32404794,"uuid":"132666099","full_name":"xp-forge/sessions","owner":"xp-forge","description":"HTTP Sessions","archived":false,"fork":false,"pushed_at":"2025-05-10T08:42:41.000Z","size":108,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-24T01:40:56.757Z","etag":null,"topics":["php7","php8","session-cookie","sessions","web","xp-framework"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xp-forge.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2018-05-08T21:15:33.000Z","updated_at":"2025-05-10T08:42:44.000Z","dependencies_parsed_at":"2024-09-25T01:38:46.560Z","dependency_job_id":"9897ea00-bf7e-4286-b481-c2acefdd4d0d","html_url":"https://github.com/xp-forge/sessions","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/xp-forge/sessions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fsessions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fsessions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fsessions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fsessions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xp-forge","download_url":"https://codeload.github.com/xp-forge/sessions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fsessions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265120110,"owners_count":23714488,"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":["php7","php8","session-cookie","sessions","web","xp-framework"],"created_at":"2024-09-25T01:38:36.005Z","updated_at":"2026-01-04T21:15:59.434Z","avatar_url":"https://github.com/xp-forge.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Sessions for the XP Framework\n========================================================================\n\n[![Build status on GitHub](https://github.com/xp-forge/sessions/workflows/Tests/badge.svg)](https://github.com/xp-forge/sessions/actions)\n[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)\n[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)\n[![Requires PHP 7.4+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_4plus.svg)](http://php.net/)\n[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)\n[![Latest Stable Version](https://poser.pugx.org/xp-forge/sessions/version.svg)](https://packagist.org/packages/xp-forge/sessions)\n\nExample\n-------\n\n```php\nuse web\\session\\{InFileSystem, ForTesting};\n\n// Instantiate session factory\n$sessions= new InFileSystem('/tmp');\n$sessions= (new ForTesting())-\u003elasting(3600)-\u003enamed('psessionid');\n\n// Create a new session\n$session= $sessions-\u003ecreate();\n\n// Open an existing session...\nif ($session= $sessions-\u003eopen($sessionId)) { … }\n\n// ...or locate session attached to a request\nif ($session= $sessions-\u003elocate($request)) { … }\n\n// Basic I/O operations\n$session-\u003eregister('key', 'value');\n$value= $session-\u003evalue('key');\n$keys= $session-\u003ekeys();\n$session-\u003eremove('key');\n\n// Destroy\n$session-\u003edestroy();\n\n// Close session...\n$session-\u003eclose();\n\n// ...or close and then transmit session to response.\n$session-\u003etransmit($response);\n```\n\nEnsure you always either call `close()` or `transmit()` to have the session data synchronized.\n\nImplementations\n---------------\nThis library includes the following implementations:\n\n* `web.session.InFileSystem` - using the local filesystem with serialized data\n* `web.session.ForTesting` - in-memory sessions, for testing purposes\n\nOther implementations provide solutions for clustering:\n\n* https://github.com/xp-forge/redis-sessions\n* https://github.com/xp-forge/mongo-sessions\n* https://github.com/xp-forge/cookie-sessions\n\nSecure\n------\n\nThe [Secure flag](https://www.owasp.org/index.php/SecureFlag) is set for all session cookies. If you develop on localhost using *http* only, you will need to tell the sessions instance as follows:\n\n```php\n// This will omit the \"Secure\" flag from session cookies in dev environment\n$sessions= new InFileSystem('/tmp');\nif ('dev' === $this-\u003eenvironment-\u003eprofile()) {\n  $sessions-\u003ecookies()-\u003einsecure(true);\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxp-forge%2Fsessions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxp-forge%2Fsessions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxp-forge%2Fsessions/lists"}