PHP Classes

File: readme.MD

Recommend this page to a friend!
  Classes of Mateo   Netscape Cookie   readme.MD   Download  
File: readme.MD
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Netscape Cookie
Store and retrieve cookie values in Netscape files
Author: By
Last change:
Date: 1 year ago
Size: 671 bytes
 

Contents

Class file image Download

Netscape Cookies

Install

composer require mateodioev/netscape-cookie

Usage

use Mateodioev\NetscapeCookie\{Config, Cookie, FileHandler};

$cookieJar = new FileHandler((new Config)
  ->setDir(__DIR__.'/cookies', true)
);

$cookieJar->setFileName('cookie.txt')
  ->add(Cookie::create('google.com', true, '/', true, 0, 'test', 'test'))
  ->add(Cookie::create('google.com', true, '/', true, time() + 3600, 'test1', 'test2')
)->save();

Output:

# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# File generate by github.com/Mateodioev

google.com	TRUE	/	TRUE	0	test	test
google.com	TRUE	/	TRUE	1666764937	test1	test2