Download the PHP package victory7/ezsession without Composer

On this page you can find all versions of the php package victory7/ezsession. 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 ezsession

EzSession - Standalone by JWT, Write & Read On-Demand

ezsession is a PHP session management library focused on an on-demand write and read strategy to optimize session data handling. It efficiently manages sessions using in-memory cache (e.g., Redis), permanent storage (e.g., MySQL), and JWT tokens, minimizing unnecessary storage queries and providing easy access to JWT for custom data handling. This approach ensures that session data is only written when required, significantly reducing storage operations and improving overall performance.

Features

Requirements

Installation

You can install ezsession using Composer. Simply run:

Then, include the autoloader in your script:

Configuration

Redis & MySQL Setup

Before using ezsession, make sure you have access to a running Redis and MySQL server. Update your database credentials and Redis configuration accordingly.

Usage

To use ezsession in your PHP application, initialize the session handler and start a session as follows:

How It Works

ezsession handles session data efficiently by using a combination of JWT tokens, Redis, and MySQL to reduce unnecessary storage operations:

  1. Session Initialization: On the first request, ezsession generates a session ID using a UUID and issues a JWT token signed with your application secret key. This token is returned as a session cookie (with the name defined in the configuration).

  2. Subsequent Requests: For the rest of the requests, the session token is retrieved either via the same cookie or from the Authorization Bearer header. After validation, ezsession checks the "stored" flag in the JWT:

    • If the "stored" flag is false, it means there is no data in the cache or permanent storage, so the JWT value is returned to $_SESSION and is accessible via $_SESSION['jwt'].
    • If nothing has been written to the session, ezsession does not write anything to cache or database and does not perform any queries.
  3. Writing to Session: When something is written to the session (e.g., $_SESSION['name'] = 'John';), ezsession stores this data in both Redis and MySQL, updates the "stored" flag to true, and generates a new JWT token. This updated token is then returned to the client, replacing the previous token automatically.

  4. Data Retrieval: When the "stored" flag is true, ezsession first checks Redis for the data:

    • If the data is found in Redis, it is returned.
    • If not, ezsession queries MySQL, and if the data is found, it caches it in Redis for future requests.
  5. Unset Session Values: If all session values are unset, the "stored" flag is set back to false, and requests are handled purely through the JWT without accessing cache or database.

Working with JWT Data

A key feature of ezsession is the ability to add, modify, or delete custom data in the JWT token directly:

Example Usage

Contributing

Contributions are welcome! Feel free to fork this repository, make your changes, and submit a pull request. Let's make session management easier for everyone.

License

ezsession is licensed under the MIT License. See LICENSE for more details.

Support

If you encounter any issues or have questions, please open an issue on GitHub or contact me at [email protected].

Future Improvements


Thank you for using ezsession! We hope it makes your session management process more enjoyable.


All versions of ezsession with dependencies

PHP Build Version
Package Version
Requires firebase/php-jwt Version ^5.5
predis/predis Version ^1.1
ramsey/uuid Version ^4.2
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 victory7/ezsession contains the following files

Loading the files please wait ....