Download the PHP package kirchdev/laravel-device-sessions without Composer

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

# πŸ“± laravel-device-sessions **Device-bound login sessions for Laravel β€” per-device "remember me" tokens, a "where am I signed in" list, and revoke/rename. Privacy-respecting and Fortify-agnostic.** [![Latest Version on Packagist](https://img.shields.io/packagist/v/kirchdev/laravel-device-sessions.svg?style=flat-square&color=4f46e5)](https://packagist.org/packages/kirchdev/laravel-device-sessions) [![Total Downloads](https://img.shields.io/packagist/dt/kirchdev/laravel-device-sessions.svg?style=flat-square&color=4f46e5)](https://packagist.org/packages/kirchdev/laravel-device-sessions) [![Tests](https://img.shields.io/github/actions/workflow/status/kirchDev/laravel-device-sessions/ci.yml?branch=main&style=flat-square&label=tests)](https://github.com/kirchDev/laravel-device-sessions/actions/workflows/ci.yml) [![PHP Version](https://img.shields.io/packagist/dependency-v/kirchdev/laravel-device-sessions/php?style=flat-square&color=8993be)](https://packagist.org/packages/kirchdev/laravel-device-sessions) [![Laravel Version](https://img.shields.io/packagist/dependency-v/kirchdev/laravel-device-sessions/illuminate%2Fsupport?style=flat-square&label=laravel&color=ff2d20)](https://packagist.org/packages/kirchdev/laravel-device-sessions) [![License: MIT](https://img.shields.io/packagist/l/kirchdev/laravel-device-sessions.svg?style=flat-square&color=10b981)](LICENSE)

That's it. Concurrent device-bound remember-me tokens, a "where am I signed in" list, and revoke/rename β€” without touching your login controllers.

πŸ“¦ Install & run

[!IMPORTANT] Publish the config first (--tag=device-sessions-config) and set device-sessions.keys.* + table_names.* before migrating β€” the migrations read config at run time, and keys.user_key_type must match your users-table primary key.

The publish step is required, once: the package does not auto-load its migrations, so nothing schema-related runs until the two files sit in your own database/migrations. Your DDL stays reviewable, in your repository, and on your deploy pipeline's terms.

Upgrading: migrations became publish-only Earlier versions registered the package's migration path themselves, so `php artisan migrate` picked up `create_user_devices_table` and `create_user_device_remember_tokens_table` straight out of `vendor/`. That auto-load is gone β€” publishing is now the only way they reach you: Published copies are stamped with the moment you publish them, so they slot into your own migration timeline rather than carrying the package's dates into your repository. - **Already published?** Nothing to do. Publishing reuses the filenames you already have, so nothing is duplicated and `php artisan migrate` finds nothing new. - **Never published?** This is a breaking change and needs a hand. Your database already has the two tables, but recorded them under the package's own filenames β€” the published copies carry generated ones, which Laravel reads as unrun. The next `migrate` would try to create tables that already exist. Reconcile your `migrations` table with the published filenames before that run.

Add the HasDeviceSessions trait to your authenticatable model and point its auth provider at the device-aware driver:

Then alias the tracking middleware and attach it to your authenticated routes β€” that's the whole wiring; remember-me logins are now device-bound and the device list populates automatically:

✨ Features

πŸ“‹ Managing devices

The package ships no routes β€” every operation is a plain action you call from your own controllers, so the response shape stays yours:

The middleware exposes the active device as the current_device_id request attribute (also $user->currentDevice()), so you can flag "this device" in the list.

🧩 Overridable contracts

Every host-facing behaviour is a contract bound to a Default* β€” rebind any of them in a service provider:

All contracts and their defaults | Contract | Default | Controls | | :-------------------- | :--------------------------- | :------------------------------------- | | `DeviceResolver` | `ResolveOrCreateUserDevice…` | cookie β†’ bootstrap-cache β†’ create flow | | `DeviceNameResolver` | `DefaultDeviceNameResolver` | User-Agent β†’ "Chrome on Windows" | | `OsFamilyDetector` | `DefaultOsFamilyDetector` | User-Agent β†’ `DeviceOsFamily` | | `DeviceCookieFactory` | `DeviceCookieBuilder` | device cookie name / TTL / SameSite | | `IpMasker` | `DefaultIpMasker` | IP minimisation (IPv4 /24, IPv6 /48) | | `RememberTokenHasher` | `Sha256RememberTokenHasher` | at-rest token hashing |

πŸ“‘ Events & Fortify

TouchDeviceLastSeen fires DeviceTouched on a real (throttled) touch β€” listen instead of patching the package, e.g. to stamp your own user column:

Two opt-in integrations:

🧹 Pruning revoked devices

Revoked devices are kept (audit/undo window), then pruned. The command ships unscheduled β€” wire it into your scheduler with Schedule::command('device-sessions:prune')->dailyAt('03:10'):

βš™οΈ Configuration

config/device-sessions.php is parameterised with inline docs β€” e.g. rename the cookie or switch key types:

All configuration keys | Key | What it controls | | :--------------------- | :------------------------------------------------------------------------------- | | `models.*` | Swap the `user` / `device` / `remember_token` Eloquent models. | | `table_names.*` | Override defaults if they collide with existing tables. | | `keys.*` | `id` / `uuid` / `ulid` for device PKs and the user FK. Set **before** migrating. | | `cookie.*` | Device cookie name (default `device`), lifetime, SameSite, secure. | | `cache.*` | Cache store, key prefix, login→2FA bootstrap TTL, last-seen throttle. | | `remember.lifetime` | Minutes until a remember token expires (`null` = never). | | `events.*` | Toggle the core event listeners. | | `prune.retention_days` | Retention window for the prune command (default 180). |

πŸ§ͺ Testing

The test suite runs via Testbench + in-memory SQLite β€” no host app required.

🀝 Contributing

PRs welcome. Conventional Commits required (enforced via commitlint). Husky runs Pint + Larastan + oxlint + oxfmt on git commit, so you can mostly forget about style.

[!TIP] Run pnpm check:fix (Node tooling) and composer pint:fix (PHP) before pushing β€” CI will catch what husky missed.

πŸ›£οΈ Versioning

Semantic Versioning. Release notes in release-please.

πŸ“„ License

IT-Dienstleistungen Titus Kirch


All versions of laravel-device-sessions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/auth Version ^13.0
illuminate/cache Version ^13.0
illuminate/console Version ^13.0
illuminate/contracts Version ^13.0
illuminate/cookie Version ^13.0
illuminate/database Version ^13.0
illuminate/events Version ^13.0
illuminate/http Version ^13.0
illuminate/support Version ^13.0
spatie/laravel-package-tools Version ^1.93.1
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 kirchdev/laravel-device-sessions contains the following files

Loading the files please wait ...