承接 popphp/pop-cookie 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

popphp/pop-cookie

最新稳定版本:4.0.4

Composer 安装命令:

composer require popphp/pop-cookie

包简介

Pop Cookie Component for Pop PHP Framework

README 文档

README

Build Status Coverage Status

Join the chat at https://discord.gg/TZjgT74U7E

Overview

pop-cookie is a component used to securely create and manage cookies in a PHP web environment. With it, you can set and retrieve cookie values, as well as set required configuration options for the web application environment.

pop-cookie is a component of the Pop PHP Framework.

Top

Install

Install pop-cookie using Composer.

composer require popphp/pop-cookie

Or, require it in your composer.json file

"require": {
    "popphp/pop-cookie" : "^4.0.4"
}

Top

Quickstart

The cookie object can be created using the getInstance() method, which takes an options array:

use Pop\Cookie\Cookie;

$cookie = Cookie::getInstance([
    'path'   => '/',
    'expire' => time() + 3600,
]);

Available options

$options = [
    'path'     => '/',
    'expire'   => time() + 3600,
    'domain'   => 'www.domain.com',
    'secure'   => true,
    'httponly' => true,
    'samesite' => 'Lax'  // 'Lax', 'Strict', 'None'
];

From there, you can interact with the cookie object.

Setting cookie values

// Set cookie values
$cookie->foo = 'bar';
$cookie['baz'] = 123;

Accessing cookie values

echo $cookie->foo;
echo $cookie['baz'];

Unset cookie values

unset($cookie->foo);
unset($cookie['baz']);

Top

统计信息

  • 总下载量: 9.17k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-07-08