Download the PHP package pijler/user-devices without Composer

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

📱 Laravel User Devices

This package provides support for managing user devices in Laravel. Track login devices, detect new logins, send notifications, and allow users to block suspicious devices—useful for security monitoring, session management, and multi-device applications.

🧩 Features

📦 Installation

You can install the package via Composer:

🗄️ Publishing

Publish the package config (optional):

Publish the package migrations:

Run the migrations:

⚙️ Configuration

Config File

DeviceCreator

The package works out-of-the-box, but you can customize the behavior:

The block link expiration uses auth.verification.expire (default 60 minutes), same as Laravel's email verification.

🧠 Usage

1. Using the HasUserDevices Trait

Add the HasUserDevices trait to your User model. Your User model must also use the Notifiable trait for notifications:

2. Saving User Devices

The package automatically saves user devices when auth events fire. No manual setup required—just add the HasUserDevices trait to your User model.

All three events use firstOrNew by IP + user agent, so the same device is updated across requests.

To skip saving the device entirely for a request (e.g. in middleware or controller before authentication):

To ignore only the new login notification (device is still saved, but no email is sent):

To control notifications globally (e.g. disable in local/staging, or custom logic per user/device):

3. Block Device Route

When a user receives the new login notification email, they can click a link to block the device. Register a route that handles this request. Blocking invalidates the device's session when using session-based auth. The route must be signed and named user-devices.block:

You can use any path you prefer as long as the route is named user-devices.block and includes the {id} and {hash} parameters. All three notification types (Authenticated, Attempting, Failed) include a block link in the email.

4. Check Blocked Device Before Login

To prevent blocked devices from attempting login, call isCurrentDeviceBlocked() after resolving the user (e.g. by email) and before validating the password. In a custom login controller or FormRequest:

Or in a FormRequest's authorize or custom validation:

5. Using the Middleware

The package includes middleware to block requests from devices the user has blocked:

When a blocked device tries to access a protected route, the middleware returns 423 Locked.

6. Working with the UserDevice Model

7. Sending Notifications Manually

8. Customizing Attempting & Failed Login Notifications

🧩 API Reference

DeviceCreator

UserDevice Model

HasUserDevices Trait

AuthenticatedLoginNotification

AttemptingLoginNotification & FailedLoginNotification

BlockDeviceRequest

📝 License

Open-source under the MIT license.

🚀 Thanks!


All versions of user-devices with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework 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 pijler/user-devices contains the following files

Loading the files please wait ...