2017 © Pedro Peláez
 

library phpcookie

Free PHP cookie tools for neat and powerful projects!

image

miladrahimi/phpcookie

Free PHP cookie tools for neat and powerful projects!

  • Sunday, July 26, 2015
  • by miladrahimi
  • Repository
  • 2 Watchers
  • 2 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

PHPCookie

Free PHP cookie tools for neat and powerful projects!, (*1)

Documentation

PHPCookie is a tiny package for working with cookies and encrypting them. It implemented the easy way to access and manipulating cookies with assuming security issues. This package uses PHPCrypt package for encryption., (*2)

Installation

Using Composer

It's strongly recommended to use Composer. If you are not familiar with Composer, The article How to use composer in php projects can be useful. After installing Composer, go to your project root directory and run following command there:, (*3)

composer require miladrahimi/phpcookie

Or if you have composer.json file already in your application, you may add this package to your application requirements and update your dependencies:, (*4)

"require": {
    "miladrahimi/phpcookie": "~1.5"
}
composer update


#### Manually
You can use your own autoloader as long as it follows [PSR-0](http://www.php-fig.org/psr/psr-0) or
[PSR-4](http://www.php-fig.org/psr/psr-4) standards.
In this case you can put `src` directory content in your vendor directory.

### Getting Started
It's so easy to use!
It uses [PHPCrypt](https://github.com/miladrahimi/phpcrypt) package to encrypt and decrypt data.
So if you use Composer everything will be ok otherwise you must download this package too.
After installation of this package you must inject it to Cookie class.
See the example to grasp all what you need to know:

use MiladRahimi\PHPCookie\Cookie; use MiladRahimi\PHPCrypt\Crypt; $project_key = "3303a3f4640d601566c02cb8fe16d96e"; $crypt = new Crypt(); $crypt->setKey($project_key); $cookie = new Cookie(); $cookie->setCrypt($crypt); $cookie->set("Singer", "Pink Floyd");

* First of all, you must set your project key to the instance of `Crypt` class. * Second of all, you must inject Crypt object to `Cookie` class via `Cookie::setCrypt()` method. * You can use `Cookie::set()` and `Cookie::get()` to set and get data in cookies. * The `Cookie::set()` parameters matches with native PHP `setCookie` function. ### Getting data from cookies There is `get()` method in `Cookie` class which you can use to get data from cookie.
echo $cookie->get("Singer");

Encryption

All cookies will be encrypted. If you set cookie via this package, you have to use this package to get it too., (*5)

PHPCookieException

There are some situation which PHPCookieException will be thrown. Here are methods and messages: * Crypt object is not set in Cookie::set() when you use this method before injecting Crypt instance to the class. * Crypt object is not set in Cookie::get() when you use this method before injecting Crypt instance to the class. * The cookie value not exists in Cookie::get() when you trying to get some cookie value which not exists., (*6)

Contributors

Homepage

License

PHPCookie is released under the MIT License., (*7)

The Versions

26/07 2015

dev-master

9999999-dev http://miladrahimi.github.io/phpcookie

Free PHP cookie tools for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

cookie security cookies cookie security

26/07 2015

1.5

1.5.0.0 http://miladrahimi.github.io/phpcookie

Free PHP cookie tools for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

cookie security cookies cookie security

26/07 2015

1.4

1.4.0.0 http://miladrahimi.github.io/phpcookie

Free PHP cookie tools for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

cookie security cookies cookie security

12/07 2015

v1.3

1.3.0.0 http://miladrahimi.github.io/phpcookie

Free PHP cookie tools for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

cookie security cookies cookie security

10/07 2015

v1.2

1.2.0.0 http://miladrahimi.github.io/phpcookie

Free PHP cookie tools for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

cookie security cookies cookie security

10/07 2015

v1.1

1.1.0.0 http://miladrahimi.github.io/phpcookie

Free PHP cookie tools for neat and powerful projects!

  Sources   Download

MIT

The Requires

 

cookie security cookies cookie security

30/06 2015

v1.0

1.0.0.0 http://phpcookie.neatplex.com

Free PHP cookie tools for neat and powerful projects!

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • neatplex/phpcrypt ^1.1

 

cookie security cookies cookie security