{"id":18536076,"url":"https://github.com/khalidsheet/session-manager","last_synced_at":"2025-04-09T16:31:28.632Z","repository":{"id":57044953,"uuid":"126073475","full_name":"khalidsheet/session-manager","owner":"khalidsheet","description":"Allows you to deal with session in php","archived":false,"fork":false,"pushed_at":"2018-04-12T10:47:46.000Z","size":31,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T08:54:51.702Z","etag":null,"topics":["oop","php","php-session","session"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khalidsheet.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":"2018-03-20T19:45:07.000Z","updated_at":"2020-08-10T12:21:58.000Z","dependencies_parsed_at":"2022-08-24T04:50:44.603Z","dependency_job_id":null,"html_url":"https://github.com/khalidsheet/session-manager","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalidsheet%2Fsession-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalidsheet%2Fsession-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalidsheet%2Fsession-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalidsheet%2Fsession-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khalidsheet","download_url":"https://codeload.github.com/khalidsheet/session-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248067762,"owners_count":21042349,"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":["oop","php","php-session","session"],"created_at":"2024-11-06T19:29:51.944Z","updated_at":"2025-04-09T16:31:28.625Z","avatar_url":"https://github.com/khalidsheet.png","language":"PHP","readme":"# PHP Session Manager\n### Allows you to deal with Session in php\n---\n\n# Installation\n```php\n#include your file\ninclude './to/path/session-manager.php';\n\nuse Prog98rammer\\Session\\Session;\n\n// start the session.\n$session = new Session();\n\n```\n# Usage \n-- **Basic Usage**\n\n## Set the sessoin prefix\n#### There are two ways to set the prefix\n\n-- **First One**\n```php\n$session = new Session($prefix);\n```\n\n-- Example\n```php\n$session = new Session('test_');\n```\n\n#### Second way\n```php\n$session = new Session;\n$session-\u003eprefix('test_')-\u003eset('name', 'khalid'); // it will set the session as \"test_name\"\n```\n#### Get the session prefix\n```php\n$sesssion-\u003egetPrefix(); // will return the session prefix\n```\n\n#### Get all session keys\n```php\n$sesssion-\u003eall();\n```\n\n#### Add new session\n```php\n// store the new session\n$session-\u003eset($key, $value);\n\n// for Example\n$session-\u003eset('name', 'John');\n```\n#### Add more than one session by Chaining method\n```php\n$session-\u003eset('name', 'Khalid')\n        -\u003eset('age', 19)\n        -\u003eset('country', 'Iraq')\n        -\u003eset('city', 'Baghdad');\n```\n#### Add more than one session by providing an array\n```php\n$session-\u003eset([\n    'name' =\u003e 'khalid',\n    'age' =\u003e 19,\n    'location' =\u003e [\n        'country' =\u003e 'iraq',\n        'city' =\u003e 'baghdad'\n    ]\n]);\n```\n\n#### Get one session by key\n```php\n$sesssion-\u003eget($key); // will use the default prefix.\n```\n\n#### Get All Session by spicefic prefix\n```php\n$session-\u003efromPrefix($prefix);\n\n#example\n$session-\u003efromPrefix('test'); // returns an array of all session that have a \"test\" prefix\n\n```\n#### Check if the session exists!\n```php\n\nSession::has($key); // returns True or False\n\n#example\nif(Session::has('is_loggin')) {\n   // do something\n} else {\n   // do something else\n}\n\n```\n\n#### Remove Session by key\n```php\n$sesssion-\u003eremove($key);\n```\n#### by chaining method\n```php\n$session-\u003eremove('name')\n        -\u003eremove('age')\n        -\u003eremove('location');\n```\n\n#### by providing an array of keys\n```php\n$session-\u003eremove([\n    'name', 'age', 'location'\n]);\n```\n\n#### or just like this\n```php \n$session-\u003eremove('name', 'age', 'location');\n```\n\n#### Get the session id\n```php\n$sesssion-\u003eid(); // will return the id of the session.\n```\n\n#### Regenerate the session id\n```php\n$sesssion-\u003eregenerate_id(); // will return the id of the session.\n```\n\n#### if you like to remove all session at one \n```php\n$session-\u003edestroy();\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalidsheet%2Fsession-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhalidsheet%2Fsession-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalidsheet%2Fsession-manager/lists"}