Polyscope——面向 Laravel 的以代理为先的开发环境

Manage Software Licenses in Laravel with Laravel Licensing

最后更新于 经过

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.

主要特点

  • 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.)

用法

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 工匠 licensing:keys:make-root
php 工匠 licensing:keys:issue-signing --kid signing-key-1

--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 = 执照 :: createWithKey ([
'licensable_type' => 用户 ::班级 ,
'licensable_id' => $用户 -> ID,
'max_usages' => 5 ,
'expires_at' => 现在 () -> 添加年份 (),
]);
$licenseKey = $license -> license_key; // e.g., "LIC-A3F2-B9K1-C4D8-E5H7"

Register a device against a license:

$usage = Licensing :: 登记
$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 :: 发行令牌 ($license, $usage, [ 'ttl_days' => 7 ]);

Check license status:

如果 ($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 的照片

Laravel News 的特约撰稿人和全栈 Web 开发人员。

归档于:
立方体

Laravel 时事通讯

加入超过 4 万名开发者的行列,不错过任何新的技巧、教程等内容。

图像
Laravel 代码审查

几天内即可获得 Laravel 代码审查方面的专家指导

访问 Laravel 代码审查
Tinkerwell 徽标

廷克威尔

Laravel 开发者必备的代码运行器。可在本地和生产环境中体验 AI、自动补全和即时反馈功能。

廷克威尔
几天内即可获得 Laravel 代码审查徽标的专家指导

几天内即可获得 Laravel 代码审查方面的专家指导

专家级代码审查!两位拥有 10 年以上 Laravel 开发经验的开发者将为您提供清晰、实用的反馈,帮助团队构建更优质的应用程序。

几天内即可获得 Laravel 代码审查方面的专家指导
PhpStorm 标志

PhpStorm

首选的 PHP IDE,对 Laravel 及其生态系统提供广泛的开箱即用支持。

PhpStorm
Laravel Cloud 标志

Laravel 云

轻松创建和管理服务器,并在几秒钟内部署 Laravel 应用程序。

Laravel 云
了解 Softtech 的标志

了解软科技

Acquaint Softtech 提供 AI 就绪的 Laravel 开发人员,48 小时内即可上手,每月费用为 3000 美元,没有冗长的销售流程,并提供 100% 退款保证。

了解软科技
Kirschbaum 标志

樱桃树

提供创新和稳定性,确保您的Web应用程序取得成功。

樱桃树
Shift 标志

转移

还在运行旧版本的 Laravel?立即实现 Laravel 自动升级和代码现代化,让您的应用程序保持最新状态。

转移
鱼叉:新一代时间跟踪和发票标志

Harpoon:新一代时间跟踪和发票系统

新一代时间跟踪和计费软件,帮助您的机构规划和预测盈利的未来。

Harpoon:新一代时间跟踪和发票系统
Lucky Media 标志

幸运传媒

Get Lucky Now——拥有十余年经验的 Laravel 开发理想之选!

幸运传媒
SaaSykit:Laravel SaaS 入门套件徽标

SaaSykit:Laravel SaaS 入门套件

SaaSykit 是一个多租户 Laravel SaaS 入门套件,包含运行现代 SaaS 所需的所有功能,例如支付、美观的结账界面、管理面板、用户仪表盘、身份验证、现成组件、统计数据、博客、文档等等。

SaaSykit:Laravel SaaS 入门套件
MongoDB 徽标

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
Ship AI with Laravel: Stop Your AI Agent from Guessing image

Ship AI with Laravel: Stop Your AI Agent from Guessing

阅读文章
Laravel Cloud Adds Path Blocking to Prevent Bots From Waking Hibernated Apps image

Laravel Cloud Adds Path Blocking to Prevent Bots From Waking Hibernated Apps

阅读文章
Making Laravel MongoDB Operations Idempotent: Safe Retries for Financial Transactions image

Making Laravel MongoDB Operations Idempotent: Safe Retries for Financial Transactions

阅读文章
FormRequest Strict Mode and Queue Job Inspection in Laravel 13.4.0 image

FormRequest Strict Mode and Queue Job Inspection in Laravel 13.4.0

阅读文章
Pretty PHP Info: A Modern Replacement for `phpinfo()` image

Pretty PHP Info: A Modern Replacement for `phpinfo()`

阅读文章
Laracon US 2026 Announced image

Laracon US 2026 Announced

阅读文章