
====, (*1)
, (*2)
Install
composer install eden/cookie
, (*3)
====, (*4)
, (*5)
Introduction
Instantiate cookies in this manner., (*6)
$cookie = eden('cookie');
The cookie is returned is an array object and can be used like a normal array., (*7)
$cookie['me'] = array('name' => 'John', 'age' => 31);
$cookie['you'] = array('name' => 'Jane', 'age' => 28);
$cookie['him'] = array('name' => 'Jack', 'age' => 35);
foreach($cookie as $key => $value) {
echo $value['name'];
}
====, (*8)
, (*9)
API
====, (*10)
, (*11)
clear
Removes all cookies., (*12)
Usage
eden('cookie')->clear();
Parameters
Returns Eden\Cookie\Index
, (*13)
====, (*14)
, (*15)
get
Returns data, (*16)
Usage
eden('cookie')->get(*string|null $key);
Parameters
-
*string|null $key
- The key to retreive
Returns mixed
, (*17)
Example
eden('cookie')->get('foo');
====, (*18)
, (*19)
remove
Removes a cookie., (*20)
Usage
eden('cookie')->remove(*string $name);
Parameters
-
*string $name
- The cookie name
Returns Eden\Cookie\Index
, (*21)
Example
eden('cookie')->remove('foo');
====, (*22)
, (*23)
set
Sets a cookie., (*24)
Usage
eden('cookie')->set(*string $key, scalar $data, int $expires, string $path, string|null $domain, bool $secure, bool $httponly);
Parameters
-
*string $key
- Cookie name
-
scalar $data
- The data
-
int $expires
- Expiration
-
string $path
- Path to make the cookie available
-
string|null $domain
- The domain
-
bool $secure
- Use secure cookie
-
bool $httponly
- Make it only available on http://
Returns Eden\Cookie\Index
, (*25)
Example
eden('cookie')->set('foo');
====, (*26)
, (*27)
setData
Sets a set of cookies., (*28)
Usage
eden('cookie')->setData(*array $data, int $expires, string $path, string|null $domain, bool $secure, bool $httponly);
Parameters
-
*array $data
- The list of cookie data
-
int $expires
- Expiration
-
string $path
- Path to make the cookie available
-
string|null $domain
- The domain
-
bool $secure
- Use secure cookie
-
bool $httponly
- Make it only available on http://
Returns Eden\Cookie\Index
, (*29)
Example
eden('cookie')->setData(array('foo' => 'bar'));
====, (*30)
, (*31)
setSecure
Sets a secure cookie., (*32)
Usage
eden('cookie')->setSecure(*string $key, scalar $data, int $expires, string $path, string|null $domain);
Parameters
-
*string $key
- Cookie name
-
scalar $data
- The data
-
int $expires
- Expiration
-
string $path
- Path to make the cookie available
-
string|null $domain
- The domain
Returns Eden\Cookie\Index
, (*33)
Example
eden('cookie')->setSecure('foo');
====, (*34)
, (*35)
setSecureData
Sets a set of secure cookies., (*36)
Usage
eden('cookie')->setSecureData(*array $data, int $expires, string $path, string|null $domain);
Parameters
-
*array $data
- The list of cookie data
-
int $expires
- Expiration
-
string $path
- Path to make the cookie available
-
string|null $domain
- The domain
Returns Eden\Cookie\Index
, (*37)
Example
eden('cookie')->setSecureData(array('foo' => 'bar'));
====, (*38)
, (*39)
Contributing to Eden
Contributions to Eden are following the Github work flow. Please read up before contributing., (*40)
Setting up your machine with the Eden repository and your fork
- Fork the repository
- Fire up your local terminal create a new branch from the
v4
branch of your
fork with a branch name describing what your changes are.
Possible branch name types:
- bugfix
- feature
- improvement
- Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")
Making pull requests
- Please ensure to run
phpunit
before making a pull request.
- Push your code to your remote forked version.
- Go back to your forked version on GitHub and submit a pull request.
- An Eden developer will review your code and merge it in when it has been classified as suitable.