{"id":18576087,"url":"https://github.com/thiagodp/session","last_synced_at":"2025-04-10T08:31:01.898Z","repository":{"id":57040948,"uuid":"44723053","full_name":"thiagodp/session","owner":"thiagodp","description":"An object-oriented version of PHP's session functions.","archived":false,"fork":false,"pushed_at":"2025-01-02T04:48:12.000Z","size":81,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T19:01:53.418Z","etag":null,"topics":["php","phputil","session"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thiagodp.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}},"created_at":"2015-10-22T04:58:37.000Z","updated_at":"2018-09-11T17:13:56.000Z","dependencies_parsed_at":"2022-08-23T22:00:12.184Z","dependency_job_id":null,"html_url":"https://github.com/thiagodp/session","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fsession","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fsession/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fsession/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fsession/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thiagodp","download_url":"https://codeload.github.com/thiagodp/session/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248185317,"owners_count":21061494,"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":["php","phputil","session"],"created_at":"2024-11-06T23:23:33.238Z","updated_at":"2025-04-10T08:31:01.589Z","avatar_url":"https://github.com/thiagodp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Session\n\nPHP's session in a object-oriented version.\n\nMain files: \n* Interface [phputil\\Session](https://github.com/thiagodp/session/blob/master/lib/Session.php)\n* Class [phputil\\FileBasedSession](https://github.com/thiagodp/session/blob/master/lib/FileBasedSession.php)\n\nThis project uses [semantic versioning](http://semver.org/).\n\n### Installation\n\n```command\ncomposer require phputil/session\n```\n\n### Example 1\n\nSetting and getting a value from the session.\n\n```php\n$session = new phputil\\FileBasedSession();\n$session-\u003estart();\n\n$session-\u003eput( 'user_name', $_POST[ 'user_name' ] ); // Set a value in the session\necho 'Hello, ', $session-\u003eget( 'user_name' ); // Get a value from the session\n```\n\n### Example 2\n\nSetting session cookie name and cookie duration.\n\n```php\n$session = new phputil\\FileBasedSession();\n$session-\u003esetName( 'myapp' ); // (optional) \"PHPSESSID\" session cookie key becomes \"myapp\"\n$session-\u003esetCookieParams( $lastOneDay = 60 * 60 * 24 ); // (optional) cookie will last one day\n$session-\u003estart();\n```\n\n### Example 3\n\nSwapping between sessions.\n\n```php\n$session = new phputil\\FileBasedSession();\n\n$session-\u003estart();\n$savedId = $session-\u003eid();\n$session-\u003eclose();\n\n// Opening another session\n$session-\u003eid( $_GET[ 'another_id' ] );\n$session-\u003estart(); // starts the session with id \"another_id\"\n...\n$session-\u003eclose();\n\n// Restoring the session with \"savedId\"\n$session-\u003eid( $savedId );\n$session-\u003estart();\n```\n\n### Example 4\n\nRegenerating the session id.\n\n```php\n$session = new phputil\\FileBasedSession();\n$session-\u003estart();\n$session-\u003eregenerateId( true ); // true means delete the old file\n```\n\n### Example 5\n\nDestroying the session.\n\n```php\n$session = new phputil\\FileBasedSession();\n$session-\u003estart();\n$session-\u003edestroy();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagodp%2Fsession","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthiagodp%2Fsession","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagodp%2Fsession/lists"}