1. Go to this page and download the library: Download omegaalfa/cookie library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
omegaalfa / cookie example snippets
use omegaalfa\Cookie;
// Set a cookie
Cookie::make('username', 'John Doe')
->withExpiration(3600)
->withPath('/')
->withDomain('.example.com')
->withSecure(true)
->withHttpOnly(true)
->send();
// Get the value of a cookie
$username = Cookie::get('username');
// Delete a cookie
Cookie::delete('username');
## Métodos
### `set`
Define um novo cookie. Aceita vários parâmetros para configurar o cookie, incluindo nome, valor, tempo de expiração, caminho, domínio, se deve ser seguro, se deve ser acessível apenas via HTTP, e o atributo `SameSite`.