{"id":21771122,"url":"https://github.com/initphp/cookies","last_synced_at":"2026-04-30T06:38:17.459Z","repository":{"id":57714705,"uuid":"517441674","full_name":"InitPHP/Cookies","owner":"InitPHP","description":"This library aims to make cookies easier to manage and a little bit more secure. It signs cookies with a (secret) salt and prevents data from being modified by the user.","archived":false,"fork":false,"pushed_at":"2022-07-25T09:58:12.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-29T17:12:31.231Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/InitPHP.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":"2022-07-24T21:33:42.000Z","updated_at":"2022-07-24T21:34:50.000Z","dependencies_parsed_at":"2022-09-26T16:33:25.843Z","dependency_job_id":null,"html_url":"https://github.com/InitPHP/Cookies","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/InitPHP/Cookies","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FCookies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FCookies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FCookies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FCookies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InitPHP","download_url":"https://codeload.github.com/InitPHP/Cookies/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FCookies/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259606866,"owners_count":22883555,"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":[],"created_at":"2024-11-26T14:15:09.266Z","updated_at":"2026-04-30T06:38:17.414Z","avatar_url":"https://github.com/InitPHP.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InitPHP Cookies Manager\n\nThis library aims to make cookies easier to manage and a little bit more secure. It signs cookies with a (secret) salt and prevents data from being modified by the user.\n\n## Requirements\n\n- PHP 7.2 or later\n- [InitPHP ParameterBag Library](https://github.com/InitPHP/ParameterBag)\n\n## Installation\n\n```\ncomposer require initphp/cookies\n```\n\n## Configuration\n\n```php\n$options = [\n        'ttl'       =\u003e 2592000, // 30 days\n        'path'      =\u003e '/',\n        'domain'    =\u003e null,\n        'secure'    =\u003e false,\n        'httponly'  =\u003e true,\n        'samesite'  =\u003e 'Strict'\n];\n```\n\n## Usage\n\n```php\nrequire_once __DIR__ . \"/vendor/autoload.php\";\nuse InitPHP\\Cookies\\Cookie;\n\n$cookie = new Cookie('cookie_name', 's£cr£t_s@lt', []);\n$cookie-\u003eset('username', 'sdd');\n```\n\n## Methods\n\n```php\npublic function has(string $key): bool;\n```\n\n***\n\n```php\npublic function get(string $key, $default = null): mixed;\n```\n\n***\n\n```php\npublic function pull(string $key, $default = null): mixed;\n```\n\n***\n\n```php\npublic function set(string $key, string|bool|int|float $value, ?int $ttl = null): self;\n```\n\n***\n\n```php\npublic function setArray(string[] $assoc, ?int $ttl = null): self;\n```\n\n***\n\n```php\npublic function remove(string ...$key): bool;\n```\n\n***\n\n```php\npublic function push(set $key, string|bool|int|float $value, ?int $ttl = null): string|bool|int|float;\n```\n\n***\n\n```php\npublic function all(): array;\n```\n\n***\n\n```php\npublic function flush(): bool;\n```\n\n***\n\n```php\npublic function destroy(): bool;\n```\n\n***\n\n\n## Credits\n\n- [Muhammet ŞAFAK](https://github.com/muhammetsafak) \u003c\u003cinfo@muhammetsafak.com.tr\u003e\u003e\n\n## License\n\nCopyright \u0026copy; 2022 [MIT License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finitphp%2Fcookies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finitphp%2Fcookies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finitphp%2Fcookies/lists"}