2017 © Pedro Peláez
 

library cookies

image

tomkyle/cookies

  • Friday, April 18, 2014
  • by tomkyle
  • Repository
  • 1 Watchers
  • 0 Stars
  • 136 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 17 Versions
  • 0 % Grown

The README.md

Cookies

Small and simple PHP library for dealing with cookies., (*1)

Build Status Scrutinizer Code Quality Coverage Status, (*2)

<?php
use \tomkyle\Cookies\Cookie;
use \tomkyle\Cookies\SendCookie;
use \tomkyle\Cookies\UnsetCookie;

// Most simple
$c1 = new Cookie( "foo", "bar" );

// Optionally set expiration:
$c1->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 );
<?php
use \tomkyle\Cookies\Cookie;
use \tomkyle\Cookies\RequestCookie;
use \tomkyle\Cookies\SendCookie;

// Fire cookie:
new SendCookie( new Cookie( "foo", "bar" ) );

// Retrieve cookie from next request:
$rc = new RequestCookie("foo");
echo $rc; // outputs "bar"
echo $rc->getValue(); // outputs "bar"

Installation via Composer

This library has no dependencies. Install from command line or composer.json file:, (*3)

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, (*4)

Testing

Simply issue phpunit to run the test suites; you may have to composer updatefirst., (*5)

The Versions

18/04 2014

dev-develop

dev-develop

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Carsten Witt

18/04 2014

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Carsten Witt

18/04 2014

1.1.9

1.1.9.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Carsten Witt

18/04 2014

1.1.8

1.1.8.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Carsten Witt

18/04 2014

1.1.7

1.1.7.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

18/04 2014

1.1.6

1.1.6.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

18/04 2014

1.1.5

1.1.5.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

18/04 2014

1.1.4

1.1.4.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

18/04 2014

1.1.3

1.1.3.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

18/04 2014

1.1.2

1.1.2.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

18/04 2014

1.1.1

1.1.1.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

18/04 2014

1.1.0

1.1.0.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

10/04 2014

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

08/04 2014

0.1.3

0.1.3.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

08/04 2014

0.1.2

0.1.2.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

07/04 2014

0.1.1

0.1.1.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

07/04 2014

0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt