Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomkyle/cookies
A small PHP library for dealing with cookies
https://github.com/tomkyle/cookies
Last synced: about 12 hours 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 10 years ago)
- Default Branch: master
- Last Pushed: 2014-04-18T13:03:19.000Z (over 10 years ago)
- Last Synced: 2024-07-27T19:47:39.119Z (3 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.
[![Build Status](https://travis-ci.org/tomkyle/Cookies.svg?branch=master)](https://travis-ci.org/tomkyle/Cookies)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/tomkyle/Cookies/badges/quality-score.png?s=e1e8eaac2d69db9564c723d289bea895e1976bb9)](https://scrutinizer-ci.com/g/tomkyle/Cookies/)
[![Coverage Status](https://coveralls.io/repos/tomkyle/Cookies/badge.png?branch=master)](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.