Download the PHP package bayfrontmedia/php-cookies without Composer
On this page you can find all versions of the php package bayfrontmedia/php-cookies. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bayfrontmedia/php-cookies
More information about bayfrontmedia/php-cookies
Files in bayfrontmedia/php-cookies
Package php-cookies
Short Description Helper class to easily work with cookies.
License MIT
Homepage https://github.com/bayfrontmedia/php-cookies
Informations about the package php-cookies
PHP cookies
Helper class to easily and safely work with cookies.
- License
- Author
- Requirements
- Installation
- Usage
License
This project is open source and available under the MIT License.
Author
Requirements
- PHP
^8.0
Installation
Usage
- get
- has
- set
- forget
- forgetAll
get
Description:
Returns value of single $_COOKIE
array key or entire array, with optional default value.
Parameters:
$key = NULL
(string|null)$default = NULL
(mixed): Default value to return if the array key is not found
Returns:
- (mixed)
Example:
has
Description:
Checks if $_COOKIE
array key exists.
Parameters:
$key
(string)
Returns:
- (bool)
Example:
set
Description:
Creates a cookie.
See: https://www.php.net/manual/en/function.setcookie.php
Parameters:
$name
(string): Cookie name$value
(string): Cookie value$minutes = 0
(int): Minutes from now until the cookie expires$path = '/'
(string): Path on the server in which the cookie will be available$domain = ''
(string): Domain/subdomain that the cookie is available to$secure = true
(bool): Transmit the cookie only over a secure https connection$http_only = true
(bool): Accessible only through the http protocol$same_site = 'Lax'
(string): Acceptable values ofNone
,Lax
orStrict
Returns:
- (bool)
Example:
forget
Description:
Removes validity of cookie.
Parameters:
$name
(string)
Returns:
- (void)
Example:
forgetAll
Description:
Removes the validity of all cookies.
Parameters:
- None
Returns:
- (void)
Example: