Download the PHP package beliven-it/laravel-lockout without Composer

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

Laravel Lockout


[![Latest Version on Packagist](https://img.shields.io/packagist/v/beliven-it/laravel-lockout.svg?style=for-the-badge&labelColor=2a2c2e&color=0fbccd)](https://packagist.org/packages/beliven-it/laravel-lockout) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/beliven-it/laravel-lockout/run-tests.yml?branch=main&label=tests&style=for-the-badge&labelColor=2a2c2e&color=0fbccd)](https://github.com/beliven-it/laravel-lockout/actions?query=workflow%3Arun-tests+branch%3Amain) [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/beliven-it/laravel-lockout/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=for-the-badge&labelColor=2a2c2e&color=0fbccd)](https://github.com/beliven-it/laravel-lockout/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/beliven-it/laravel-lockout.svg?style=for-the-badge&labelColor=2a2c2e&color=0fbccd)](https://packagist.org/packages/beliven-it/laravel-lockout)

A small, opinionated Laravel package that locks accounts after repeated failed login attempts. It provides both in-memory throttling (cache counters) and optional persistent locks stored in the database, plus unlock notifications via a temporary signed link.


Quick Start (Usage)

These steps get you from install to a working lockout flow in your app.

  1. Install with Composer:

  2. Publish configuration and migration stubs:

  3. Add the trait to your authentication model (e.g. App\Models\User) and implement the LockableModel contract:

  4. Protect your login route with the middleware:

The package also expose an additional middleware for ensure that locked users cannot access to any routes:

  1. Scheduler (recommended)
    • The package includes a console command lockout:prune to remove old records according to the retention values in config('lockout.prune') (prune.lockout_logs_days and prune.model_lockouts_days). In production you should schedule this command to run regularly via Laravel's scheduler (and ensure your cron runs schedule:run).

Example: register scheduled tasks in routes/console.php

Tips

  1. Test manually:

Configuration (summary)

Full options are in config/lockout.php. Here are the most important settings and their defaults:

Recommendation:


Unlock route & controller

The package generates signed unlock links using the route name lockout.unlock.

If you publish the package routes or want to register the route yourself, ensure a route with that name exists and points to the unlock controller:

The unlock link is temporary and validates the signature before performing the unlock action. The link lifetime is configurable via the lockout.unlock_link_minutes configuration key (default: 1440 minutes, i.e. 24 hours).

--

Logout on Login

If you want to ensure that when a locked user attempts to log in, any existing sessions are terminated, you can enable the logout_on_login configuration option. This is particularly useful in scenarios where you want to prevent locked users from maintaining active sessions.

Also, is useful in scenario like third party admin panels (e.g. Filament, Nova) where you can't easily add the lockout middleware to the login route.

You can enable this feature by setting the logout_on_login option to true in your config/lockout.php file:

You can also override the logoutAfterLogin method on your model that uses the HasLockout trait to customize the logout behavior further. The default behavior is:


API Reference (quick)

Use the Lockout facade or the Beliven\Lockout\Lockout service from the container.

These helpers are also used internally by the HasLockout trait; your models can call $model->lock() and $model->unlock() which delegate to the service.


Customization & Extensibility

Example: custom notification class in config/lockout.php:


Troubleshooting


Developing (run tests, coverage & local development)

If you're working on the package itself locally:

  1. Install dev dependencies:

  2. Run tests:

  3. Generate coverage (requires Xdebug or phpdbg):

  4. Useful notes:
    • Use config()->set(...) in tests to override settings (examples in tests).
    • Database migrations for tests are in the test bootstrap; if adding schema changes, update migration stubs and test setup.
    • To run a single test file with Pest:

Events & Examples

Example listener registration is done via your EventServiceProvider if you need to override defaults.

Example. Prevent login on filament

// todo

Example: Laravel Nova Action

If you use Laravel Nova, you can expose an Action that lets administrators unlock a user directly from the Nova resource. The Action can resolve the model and call the trait helper $model->unlock(...), which delegates to the package service.

Example Nova Action (concise):

Add the action to your Nova Resource (e.g. User resource):

Notes:


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-lockout with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4|^8.3
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0||^13.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 beliven-it/laravel-lockout contains the following files

Loading the files please wait ...