https://github.com/elusivecodes/fyrecookie
FyreCookie is a free, open-source cookie library for PHP.
https://github.com/elusivecodes/fyrecookie
cookie php
Last synced: about 1 month ago
JSON representation
FyreCookie is a free, open-source cookie library for PHP.
- Host: GitHub
- URL: https://github.com/elusivecodes/fyrecookie
- Owner: elusivecodes
- License: mit
- Created: 2021-11-29T10:08:20.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-30T11:26:52.000Z (7 months ago)
- Last Synced: 2024-12-30T13:38:25.715Z (5 months ago)
- Topics: cookie, php
- Language: PHP
- Homepage:
- Size: 73.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FyreCookie
**FyreCookie** is a free, open-source cookie library for *PHP*.
## Table Of Contents
- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Methods](#methods)## Installation
**Using Composer**
```
composer require fyre/cookie
```In PHP:
```php
use Fyre\Http\Cookie;
```## Basic Usage
- `$name` is a string representing the cookie name.
- `$value` is a string representing the cookie value.
- `$options` is an array containing cookie options.
- `expires` is a number representing the cookie lifetime, and will default to *null*.
- `domain` is a string representing the cookie domain, and will default to "".
- `path` is a string representing the cookie path, and will default to "*/*".
- `secure` is a boolean indicating whether to set a secure cookie, and will default to *false*.
- `httpOnly` is a boolean indicating whether to the cookie should be HTTP only, and will default to *false*.
- `sameSite` is a string representing the cookie same site, and will default to "*Lax*".```php
$cookie = new Cookie($name, $value, $options);
```## Methods
**Get Domain**
Get the cookie domain.
```php
$domain = $cookie->getDomain();
```**Get Expires**
Get the cookie expires timestamp.
```php
$expires = $cookie->getExpires();
```**Get Header String**
```php
$headerString = $cookie->getHeaderString();
```**Get Name**
Get the cookie name.
```php
$name = $cookie->getName();
```**Get Path**
Get the cookie path.
```php
$path = $cookie->getPath();
```**Get Same Site**
Get the cookie same site attribute.
```php
$sameSite = $cookie->getSameSite();
```**Get Value**
Get the cookie value.
```php
$value = $cookie->getValue();
```**Is Expired**
Determine whether the cookie has expired.
```php
$expired = $cookie->isExpired();
```**Is Http Only**
Determine whether the cookie is HTTP only.
```php
$httpOnly = $cookie->isHttpOnly();
```**Is Secure**
Determine whether the cookie is secure.
```php
$secure = $cookie->isSecure();
```