drewlabs/http-cookie 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-01