Download the PHP package rairlie/laravel-locking-session without Composer

On this page you can find all versions of the php package rairlie/laravel-locking-session. 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 laravel-locking-session

laravel-locking-session

This package implements session locking in Laravel by wrapping an exclusive lock around the underlying session driver. As such it should work with any session backend - cookies, files, database, etc. (only files and cookies currently tested).

It addresses the problem where session data is lost due to concurrent requests updating the session at the same time. One instance where this may happen is when making simultaneous XHR requests.

Example scenario:

Consider the case where a variable COUNTER is a value stored in the session, and two requests attempt to increment it at the same time. Without session locking:

Request A: Read session data: COUNTER = 1
Request B: Read session data: COUNTER = 1
Request A: COUNTER = COUNTER + 1
Request B: COUNTER = COUNTER + 1
Request A: Write session data: COUNTER = 2
Request B: Write session data: COUNTER = 2

Final result: COUNTER = 2

With session locking in place, this becomes:

Request A: Lock session
Request A: Read session data: COUNTER = 1
Request B: Attempt to lock session - already locked, must wait
Request A: COUNTER = COUNTER + 1
Request A: Write session data: COUNTER = 2
Request A: Release lock
Request B: Acquires lock
Request B: Read session data: COUNTER = 2
Request B: COUNTER = COUNTER + 1
Request B: Write session data: COUNTER = 3
Request B: Release lock

Final result: COUNTER = 3

Session locking ensures correctness at the cost of effectively serialising concurrent requests accessing the session. If you have some concurrent requests that don't use the session, disabling session middleware on those requests allows them to still be concurrent.

Installation

composer require rairlie/laravel-locking-session

In your Laravel app, edit config/app.php and replace the default session handler with the locking one:

config/app.php:
- Illuminate\Session\SessionServiceProvider::class,
+ Rairlie\LockingSession\LockingSessionServiceProvider::class,

By default, lock files are written to the system temp dir, in a subdir 'sessionlocks'. You can specify an alternative path with:

config/session.php:
'lockfile_dir' => '/path/to/my/lockdir'

The directory will be created if it doesn't exist.

Requirements

  1. Write access to the lock dir
  2. POSIX file system locking e.g. *NIX, Windows (untested).

Compatibility

Laravel Locking Session Version PHP Version
2.x >=7.4
1.x 5.5 - 8.1

All versions of laravel-locking-session with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
illuminate/session Version >=5.0
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 rairlie/laravel-locking-session contains the following files

Loading the files please wait ....