Laravel Cloud is here! Zero-config managed infrastructure for Laravel apps. Deploy now.

Manage Software Licenses in Laravel with Laravel Licensing

Last updated on by

Manage Software Licenses in Laravel with Laravel Licensing image

The Laravel Licensing package by Luca Longo brings enterprise-grade license management directly into your Laravel application. It handles seat-based license enforcement, offline verification via cryptographically signed tokens, and full audit logging — everything you need if you're distributing commercial software built on Laravel.

Main Features

  • Offline verification: using PASETO (Platform-Agnostic Security Tokens) v4 tokens signed with Ed25519. This is a modern, safer alternative to JWTs, and clients can verify licenses without a live server connection
  • Seat-based limits: restrict a license to a set number of devices or users, with activation and revocation support
  • License Scopes: isolate multiple products under separate signing keys so a key compromise in one product doesn't affect others. Each product gets its own signing key, meaning you can rotate or revoke one without touching the rest of your lineup
  • Grace periods, renewals, and expiration: full lifecycle management out of the box
  • Audit logging: every license event is recorded automatically
  • Flexible assignment: attach licenses to any model (users, teams, organizations, etc.)

Usage

After installing the package, publishing the config, and running migrations, you'll need to generate a root certificate and at least one signing key before issuing any licenses:

php artisan licensing:keys:make-root
php artisan licensing:keys:issue-signing --kid signing-key-1

The --kid flag sets the key identifier. If you're using License Scopes, you can also pass --scope to tie the signing key to a specific product.

Create a license:

$license = License::createWithKey([
'licensable_type' => User::class,
'licensable_id' => $user->id,
'max_usages' => 5,
'expires_at' => now()->addYear(),
]);
 
$licenseKey = $license->license_key; // e.g., "LIC-A3F2-B9K1-C4D8-E5H7"

Register a device against a license:

$usage = Licensing::register(
$license,
'device-fingerprint-hash',
[
'device_name' => 'MacBook Neo - Personal'
]
);

The device identifier can be any unique string — a hash of hardware attributes, a UUID, or whatever makes sense for your application. The package doesn't enforce a specific format.

Issue an offline verification token:

$token = Licensing::issueToken($license, $usage, ['ttl_days' => 7]);

Check license status:

if ($license->isUsable()) {
$days = $license->daysUntilExpiration();
}

The token is a time-limited, cryptographically signed payload that the client can verify locally without calling back to your server on every request.

Beyond the core workflow, the package also provides options for retrieving existing license keys, verifying their validity, and regenerating them when needed — useful for key rotation or when a key is lost.

Companion Packages

The ecosystem includes two additional packages:

Learn more about the package on GitHub at masterix21/laravel-licensing. Full documentation is also available in the docs folder of the repository.

Yannick Lyn Fatt photo

Staff Writer at Laravel News and Full stack web developer.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Jump24 - UK Laravel Agency

Laravel Developers that Click into Place. Never outsourced. Never offshored. Always exceptional.

Visit Jump24 - UK Laravel Agency
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB

The latest

View all →
A Free Shift to Check If Your App is Ready for Laravel Cloud image

A Free Shift to Check If Your App is Ready for Laravel Cloud

Read article
Laravel Idempotency: HTTP Idempotency Middleware for Laravel image

Laravel Idempotency: HTTP Idempotency Middleware for Laravel

Read article
Polyscope for Windows is Now Available image

Polyscope for Windows is Now Available

Read article
Laravel Sluggable image

Laravel Sluggable

Read article
Ship AI with Laravel: RAG with Embeddings and pgvector in Laravel 13 image

Ship AI with Laravel: RAG with Embeddings and pgvector in Laravel 13

Read article
Laravel Mobile Pass: Generate Apple Wallet and Google Wallet Passes image

Laravel Mobile Pass: Generate Apple Wallet and Google Wallet Passes

Read article