https://github.com/tomkyle/cookies
A small PHP library for dealing with cookies
https://github.com/tomkyle/cookies
Last synced: 5 months ago
JSON representation
A small PHP library for dealing with cookies
- Host: GitHub
- URL: https://github.com/tomkyle/cookies
- Owner: tomkyle
- License: mit
- Created: 2014-04-07T09:02:56.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-18T13:03:19.000Z (about 11 years ago)
- Last Synced: 2025-01-30T23:17:14.847Z (5 months ago)
- Language: PHP
- Size: 266 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#Cookies
Small and simple PHP library for dealing with cookies.
[](https://travis-ci.org/tomkyle/Cookies)
[](https://scrutinizer-ci.com/g/tomkyle/Cookies/)
[](https://coveralls.io/r/tomkyle/Cookies?branch=master)##Set cookie
```php
setExpiration( new \DateTime( "14day" ));// Fire cookie:
new SendCookie( $c1 );// Another example
$c2 = new Cookie( "any", "val", new \DateTime( "tomorrow" ) );
new SendCookie( $c2 );// Delete from HTTP and $_COOKIE:
new UnsetCookie( $c2 );
```##Retrieve cookie
```php
getValue(); // outputs "bar"
```##Installation via Composer
This library has no dependencies. Install from command line or `composer.json` file:
#####Command line
composer require tomkyle/cookies#####composer.json
"require": {
"tomkyle/cookies": "dev-master"
}##Classes Overview
- *interface* CookieInterface
- *abstract* CookieAbstract
- Cookie *extends* CookieAbstract
- RequestCookie *extends* CookieAbstract
- SendCookie
- UnsetCookie##Supported Attributes
- Cookie name
- Cookie value
- Expiration/Life time
- **Not supported:** Path
- **Not supported:** Domain
- **Not supported:** Secure (HTTPS only)
- **Not supported:** http-only protection[PHP documentation on setcookie](http://www.php.net/manual/en/function.setcookie.php)
##Testing
Simply issue `phpunit` to run the test suites; you may have to `composer update`first.