PHP code example of corevisys / laravel-license-client
1. Go to this page and download the library: Download corevisys/laravel-license-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
corevisys / laravel-license-client example snippets
use CoreVisys\License\Facades\CoreVisysLicense;
$result = CoreVisysLicense::activate($licenseKeyFromUserInput);
if ($result->success) {
// $result->status is a LicenseStatus DTO
} else {
// $result->message, $result->errorCode
}
'ui' => [
'enabled' => env('COREVISYS_LICENSE_UI_ENABLED', true),
'route_prefix' => env('COREVISYS_LICENSE_UI_PREFIX', 'license'), // -> /license/activate
'route_name' => 'corevisys.license.activate',
'middleware' => ['web'], // add 'auth' here to restrict to logged-in admins
],
use CoreVisys\License\Facades\CoreVisysLicense;
CoreVisysLicense::isValid(); // bool
CoreVisysLicense::isActive();
CoreVisysLicense::isExpired();
CoreVisysLicense::isRevoked();
CoreVisysLicense::isSuspended();
CoreVisysLicense::expiresAt(); // ?Carbon
CoreVisysLicense::daysRemaining(); // ?int
CoreVisysLicense::feature('reports'); // bool
CoreVisysLicense::features(); // array
CoreVisysLicense::status(); // ?LicenseStatus (last resolved)
CoreVisysLicense::fingerprint(); // string
CoreVisysLicense::licenseKey(); // ?string (decrypted from cache, or config)
// Force a fresh online check instead of using the cached/interval-gated result:
$status = CoreVisysLicense::check(force: true);
use CoreVisys\License\Contracts\LicenseClientInterface;
public function __construct(private LicenseClientInterface $license) {}
use Illuminate\Support\Facades\Route;
Route::middleware('corevisys.license')->group(function () {
Route::get('/dashboard', DashboardController::class);
});