Download the PHP package phpcraftdream/figcookies without Composer
On this page you can find all versions of the php package phpcraftdream/figcookies. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpcraftdream/figcookies
More information about phpcraftdream/figcookies
Files in phpcraftdream/figcookies
Package figcookies
Short Description Cookies for PSR-7 HTTP Message Interface.
License MIT
Informations about the package figcookies
FIG Cookies
Managing Cookies for PSR-7 Requests and Responses. It is fork from dflydev/dflydev-fig-cookies
Requirements
- PHP 7.1+
- psr/http-message
Installation
Concepts
Instantiating these collections looks like this:
After modifying these collections in some way, they are rendered into a PSR-7 Request or PSR-7 Response like this:
Basic Usage
Get a Request Cookie
The get
method will return a Cookie
instance. If no cookie by the specified
name exists, the returned Cookie
instance will have new empty Cookie
instance.
Set a Request Cookie
The set
method will either add a cookie or replace an existing cookie.
The Cookie
primitive is used as the second argument.
Remove a Request Cookie
The remove
method removes a cookie if it exists.
Create cookie
Get a Response Cookie
Set a Response Cookie
The add
method will either add a cookie or replace an existing cookie.
Modify a Response Cookie
Remove a Response Cookie
The delete
method removes a cookie from the response if it exists.
Expire a Response Cookie
The expire
method sets a cookie with an expiry date in the far past. This
causes the client to remove the cookie.
FAQ
Do you call setcookies
?
No.
Delivery of the rendered Cookies
instances is the responsibility of the
PSR-7 client implementation.
Do you do anything with sessions?
No.
It would be possible to build session handling using cookies on top of FIG Cookies but it is out of scope for this package.
Do you read from $_COOKIES
?
No.
FIG Cookies only pays attention to the Cookie
headers on PSR-7 Request
instances.
License
MIT, see LICENSE.