PHP Classes

How Can PHP Store Cookie Values in Files using the Package Netscape Cookie: Store and retrieve cookie values in Netscape files

Recommend this page to a friend!
  Info   View files Documentation   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 20 This week: 1All time: 11,180 This week: 560Up
Version License PHP version Categories
netscape-cookie 1.0.0MIT/X Consortium ...5HTTP, PHP 5
Description 

Author

This package can store and retrieve cookie values in Netscape files.

It provides one class that can create cookies to store cookie parameters and set and get their values.

Another class can save the cookie values in a text file in Netscape format.

Picture of Mateo
  Performance   Level  
Name: Mateo <contact>
Classes: 21 packages by
Country: Peru Peru
Age: ???
All time rank: 21074 in Peru Peru
Week rank: 9 Up1 in Peru Peru Up
Innovation award
Innovation award
Nominee: 9x

Winner: 3x

Documentation

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

  Files folder image Files  
File Role Description
Files folder imagesrc (3 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file readme.MD Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file Config.php Class Class source
  Plain text file Cookie.php Class Class source
  Plain text file FileHandler.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:20
This week:1
All time:11,180
This week:560Up