drewlabs/http-cookie
最新稳定版本:v0.2.0
Composer 安装命令:
composer require drewlabs/http-cookie
包简介
HTTP cookie implementation library
README 文档
README
Provides HTTP cookie object implementation. It provides a factory class and a proxy class for creating cookie instance.
Usage
To create a cookie instance simply use the factory class or the factory proxy class:
use Drewlabs\Cookies\Factory; $factory = new Factory; $cookie = $factory->create('sessionid', random_int(10000, 100000) . time()); // CookieInterface // API $cookie->getName(); // sessionid -> Returns the cookie name $cookie->getValue(); // -> Returns cookie value $cookie->isHttpOnly(); // Check if the cookie is http only $cookie->isSecure(); // Check if the cookie is secure // etc...
using the factory proxy class:
use Drewlabs\Cookies\FactoryProxy as Factory; $cookie = Factory::create('sessionid', random_int(10000, 100000) . time()); // CookieInterface
Note The cookie instance provide is a Stringable instance that easily allows developpers to convert the cookie instance into an http cookie string:
use Drewlabs\Cookies\FactoryProxy as Factory; $cookie = Factory::create('sessionid', random_int(10000, 100000) . time()); // CookieInterface printf("%s\n", (string)$cookie); // sessionid=428461690891271; Path=/; Secure; HttpOnly; SameSite=Lax
统计信息
- 总下载量: 28
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-01