Download the PHP package lowerrocklabs/laravel-lockable without Composer

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

Laravel Lockable provides traits to allow for models to be locked

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This model allows for on-demand locking of models. You can integrate this with your permissions methodology of choice, or leave it stand-alone. This package allows you to determine whether a particular instance of a model is Locked or Not. Or it will independently prevent updating of a model instance.

Installation

Requires [PHP 7.3+ or 8.0+] and [Laravel 8.x or 9.x] (https://laravel.com/docs/8.x/releases or https://laravel.com/docs/9.x/releases)

You can install the package via composer:

You can publish and run the migrations with:

You can publish the config file with:

This is the contents of the published config file, which controls the global lock duration, this is customisable on a per-model basis (see below).

Usage

Model Configuration

In the Model(s) that you wish to be lockable, add the IsLockable Trait

and then set the Trait

In Your Component/Controller

Then use the acquireLock function to attempt to acquire a lock on the model, it will return false if there is an existing lock.

You can override the existing lock by calling the releaseLock() function before acquireLock(), if you are using a permissions-based approach, it is suggested that you restrict this to approriate users.

You can tell if a lock exists as follows, this will acquire the lock if one does not exist.

You can send a Broadcast to the user holding the lock with the following

Lock Duration

You can override the default Lock Duration (in seconds) which is taken from the configuration on a per-model basis by setting the following in your Model, for example, the following would limit the duration of a lock to 600 seconds.

Locks will clear when the Duration has expired, and an attempt is made to access the Model, or you can call the commands below, or add them to a schedule (as you see fit).

Commands

To Flush Expired Locks

To Flush All Locks

Events

Two Events will be fired during the Lock process, that can be used to fire Notifications or Logs if desired On Model Locking

and On Model UnLocking

An additional event will be fired when a user requests the release of the lock and On Model UnLocking

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-lockable with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
illuminate/contracts Version ^8.0|^9.0|^10.0|^11.0
laravel/framework Version ^8.0|^9.19|^10.0|^11.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 lowerrocklabs/laravel-lockable contains the following files

Loading the files please wait ....