Download the PHP package refkinscallv/cookie without Composer

On this page you can find all versions of the php package refkinscallv/cookie. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cookie

Here's how you can modify the documentation to include the installation guide and a sample .env file, while keeping the existing content intact.


Cookie Library with Encryption Support

The Cookie class provides an advanced solution for managing cookies, with optional encryption support using the Crypto class. This library allows you to securely store and retrieve cookie data in both encrypted and plain formats.


Features


Installation

  1. Install the Package via Composer

    To install the refkinscallv/cookie package, run the following command:

    This command will download and install the library along with its dependencies.

  2. Include the Composer Autoloader

    Make sure to include the Composer autoloader at the top of your PHP scripts to automatically load the classes:

  3. Environment Configuration

    Make sure that your environment variables are properly configured for cookie management. You can do this by creating a .env file in the root directory of your project (if not already present) with the following contents:

    Sample .env File:

    This file defines:

    • COOKIE_NAME: The name of the cookie.
    • COOKIE_EXPIRES: The cookie expiration time in hours (default is 24 hours).
    • COOKIE_PATH: The path on the server where the cookie is available.
    • COOKIE_SECURE: Whether the cookie should be marked as secure (use HTTPS only). Set to false by default.
  4. Using the Library

    After installing the package and configuring your environment, you can now begin using the Cookie class in your project.


Usage

Basic Setup

Without Encryption

With Encryption


Configuration

Constructor Parameters

Environment Variables

Variable Description Default Value
COOKIE_NAME The name of the cookie. web_cookie
COOKIE_EXPIRES Expiration time in hours. 24 (1 day)
COOKIE_PATH The path on the server where the cookie is available. /
COOKIE_SECURE Use secure cookies (HTTPS only). false

Methods

all()

Retrieve all cookie data as an associative array.

get(string $key)

Retrieve a specific cookie value.

has(string $key)

Check if a cookie key exists.

set(string|array $key, mixed $value = null)

Set a cookie value. Supports setting multiple key-value pairs.

unset(string|array $key)

Remove a specific cookie or multiple cookies.

destroy()

Remove all cookies.


Notes


Example with Database Encryption

To use database-based encryption with cookies, you can leverage the Crypto Library. This library supports multiple storage methods, including databases.

Example

For a full tutorial and detailed documentation on configuring the Crypto library, visit the Crypto Library GitHub Repository.


All versions of cookie with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package refkinscallv/cookie contains the following files

Loading the files please wait ....