shumonpal / laravel-licence-client
Laravel Licence(客户端)是一个强大的Laravel包,旨在简化并确保您的应用程序免受黑客或盗贼的侵害。
v1.0.3
2024-04-08 03:55 UTC
Requires
- php: >=8.0
- guzzlehttp/guzzle: ^7.5
This package is auto-updated.
Last update: 2024-09-08 04:52:20 UTC
README
Laravel Licence(客户端)是一个强大的Laravel包,旨在简化并确保您的应用程序免受黑客或盗贼的侵害。
安装
通过Composer安装。您应该使用Laravel >= 8,PHP >= 8.0。
composer require shumonpal/laravel-licence-client
快速入门
只需3步即可实现此功能
步骤1:运行此命令
php artisan vendor:publish --provider="Shumonpal\ProjectSecurity\ProjectSecurityServiceProvider" --tag="app-licence-config"
步骤2:在config/app-licence.php
中将您的许可证密钥外部URL添加到配置中,您的密钥将在那里进行验证(否则您可以使用我们的laravel-app-tracker)
示例
<?php return [ /** * The Url where licenced key */ 'licence_key_api' => 'https://example.com/api/app-tracker/licence-key-verify', /** * The Url where user details stored if product use illegally */ 'store_user_api' => 'https://example.com/api/app-tracker/licence-users', /** * * This is used to redirect after successfully licence key verified. * */ 'redirect_url' => '/', ];
步骤3:将\Shumonpal\ProjectSecurity\Middleware\LicencedVirifiedMiddleware::class
中间件添加到kernel.php
文件中
示例
<?php namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel { ///// /** * The application's middleware aliases. * * Aliases may be used instead of class names to conveniently assign middleware to routes and groups. * * @var array<string, class-string|string> */ protected $middlewareAliases = [ /// 'verifylicence' => \Shumonpal\ProjectSecurity\Middleware\LicencedVirifiedMiddleware::class, ]; }
就是这样。现在您可以在任何需要的位置使用verifylicence
中间件。