tecnozt/proteczt-client
Composer 安装命令:
composer require tecnozt/proteczt-client
包简介
Laravel client package for Proteczt License Management System - verify and control application licenses remotely.
README 文档
README
Laravel client package for Proteczt — a remote license management system. Install this package in your distributed Laravel applications to control access from a central Proteczt server.
Requirements
| Dependency | Version |
|---|---|
| PHP | ^8.2 |
| Laravel | ^11.0 or ^12.0 |
Installation
composer require tecnozt/proteczt-client
Laravel auto-discovery registers the service provider automatically. No manual registration needed.
Configuration
1. Publish the config file
php artisan vendor:publish --tag=proteczt-config
This creates config/proteczt.php in your application.
2. Add environment variables to .env
PROTECZT_API_URL=https://your-proteczt-server.com PROTECZT_API_TOKEN=your-api-token-here PROTECZT_DOMAIN=your-app-domain.com # Optional — auto-detected if omitted # Optional tuning PROTECZT_AUTO_REGISTER=true PROTECZT_SKIP_LOCAL=true PROTECZT_CACHE_DURATION=0 # 0 = real-time (check every request), 60-300 = reduce API load PROTECZT_TIMEOUT=10 PROTECZT_VERIFY_SSL=true
Get your API token: Login to your Proteczt server dashboard → API Tokens → Generate New Token.
3. Register the middleware
Apply license checking to your routes. In bootstrap/app.php (Laravel 11+):
use Tecnozt\Proteczt\Http\Middleware\CheckProtecztLicense; ->withMiddleware(function (Middleware $middleware) { // Apply to all web routes: $middleware->append(CheckProtecztLicense::class); // Or apply only to specific route groups (recommended): $middleware->alias([ 'proteczt' => CheckProtecztLicense::class, ]); })
Then in your routes:
// routes/web.php Route::middleware('proteczt')->group(function () { // Protected routes });
4. Register your application
php artisan proteczt:register
This sends your application details (name, domain, hostname) to the Proteczt server. This also happens automatically on the first web request if auto_register is enabled.
How It Works
┌─────────────────────┐ Register / Check Status ┌─────────────────────┐
│ Laravel App │ ─────────────────────────────────────────> │ Proteczt Server │
│ (Client) │ │ (License API) │
│ │ { active: true/false } │ │
│ CheckProteczt │ <───────────────────────────────────────── │ │
│ License Middleware │ └─────────────────────┘
└─────────────────────┘
│
├─ active: true → Request continues normally
└─ active: false → 403 License Inactive page (or JSON)
- First boot: Service provider registers the app with Proteczt (stored in
storage/app/.proteczt_registered). - Every request: Middleware checks license status (cached for 1 hour by default).
- If active: Request passes through normally.
- If inactive/expired: Returns 403 with an error page (or JSON for API requests).
- If server is unreachable: Fail-open — request is allowed to prevent downtime.
Artisan Commands
| Command | Description |
|---|---|
php artisan proteczt:register |
Register this app to Proteczt server |
php artisan proteczt:register --force |
Re-register (overwrite existing) |
php artisan proteczt:check |
Check license status (from cache) |
php artisan proteczt:check --fresh |
Check status (bypass cache) |
php artisan proteczt:refresh |
Force-refresh license cache |
Controlling Your App from the Server
Once installed, you control the application entirely from the Proteczt dashboard:
| Action | Effect |
|---|---|
| Set status → Inactive | App blocked within 1 hour (or immediately after proteczt:refresh) |
| Set status → Active | App resumes within 1 hour |
| Set Expired At date | App automatically blocked on that date |
| Delete client | App unregistered — future check-status returns inactive |
Facade
use Tecnozt\Proteczt\Facades\Proteczt; // Check if license is active if (Proteczt::isActive()) { // proceed } // Get full status with data $status = Proteczt::checkStatus(); // $status['active'] → bool // $status['data'] → array|null (app info from server) // $status['fail_open'] → bool (true if server was unreachable) // Force refresh Proteczt::refreshStatus(); // Register (usually automatic) Proteczt::register();
Publishing Views
To customise the "License Inactive" error page:
php artisan vendor:publish --tag=proteczt-views
This copies the view to resources/views/vendor/proteczt/errors/license-expired.blade.php.
Configuration Reference
| Key | Env Variable | Default | Description |
|---|---|---|---|
api_url |
PROTECZT_API_URL |
— | Proteczt server URL (required) |
api_token |
PROTECZT_API_TOKEN |
— | Bearer token from Proteczt (required) |
domain |
PROTECZT_DOMAIN |
null (auto) |
Override domain detection |
auto_register |
PROTECZT_AUTO_REGISTER |
true |
Auto-register on first request |
skip_local |
PROTECZT_SKIP_LOCAL |
true |
Skip check in local/testing env |
cache_duration |
PROTECZT_CACHE_DURATION |
0 |
Cache TTL in seconds (0 = no cache, real-time enforcement) |
timeout |
PROTECZT_TIMEOUT |
10 |
HTTP request timeout in seconds |
verify_ssl |
PROTECZT_VERIFY_SSL |
true |
Verify SSL certificates |
Security
- API token is stored in
.envand never exposed to end users. - Cache keys are SHA-256 hashed (domain + token) to prevent enumeration.
- Fail-open by design: If the Proteczt server is unreachable, your clients will not experience downtime. If you prefer fail-closed, override
isActive()via the service container. - HTTPS strongly recommended in production. The
verify_ssloption should always betrue. - A
401/403response from the server (e.g., invalid token) immediately returnsinactivewithout caching.
Testing
# Check if the package is correctly integrated php artisan proteczt:check # Force block your app to test the error page # → Go to Proteczt dashboard → Clients → Set status to Inactive # → Clear cache: php artisan proteczt:refresh # → Visit any route — you should see the license error page # Re-enable your app # → Set status to Active in the dashboard php artisan proteczt:refresh
Troubleshooting
| Problem | Solution |
|---|---|
| App not registering | Check PROTECZT_API_URL and PROTECZT_API_TOKEN in .env |
| App always blocked | Check client status in Proteczt dashboard |
| Stale status after change | Run php artisan proteczt:refresh |
| SSL error in local | Set PROTECZT_VERIFY_SSL=false (local only) |
| Skip not working | Set PROTECZT_SKIP_LOCAL=true and APP_ENV=local |
Changelog
See CHANGELOG.md.
License
MIT — see LICENSE.
Made with ❤️ by Tecnozt
tecnozt/proteczt-client 适用场景与选型建议
tecnozt/proteczt-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「license」 「saas」 「protection」 「tecnozt」 「proteczt」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tecnozt/proteczt-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tecnozt/proteczt-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tecnozt/proteczt-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
HiDev plugin for license generation
Laravel Plans is a package for SaaS apps that need management over plans, features, subscriptions, events for plans or limited, countable features.
Cpanel Licensing Class
Fantastico Licensing Class
Cloudlinux Licensing Class
LiteSpeed Licensing Class
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2026-02-26