1. Go to this page and download the library: Download genvoris/laravel 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/ */
genvoris / laravel example snippets
use Genvoris\Laravel\Facades\Genvoris;
// Upsert a customer (auto-prefixes the external ID → "laravel_42")
$customer = Genvoris::upsertCustomer('42', ['email' => '[email protected]']);
// Mint a session token for the widget
$session = Genvoris::mintSession($customer->id);
// List your plans
$plans = Genvoris::listPlans();
// Get a customer's usage
$usage = Genvoris::customerUsage($customer->id);
if ($usage->canTryOn()) { /* ... */ }
use Genvoris\Laravel\Genvoris;
class TryOnController extends Controller
{
public function __construct(private readonly Genvoris $genvoris) {}
public function session(Request $request): JsonResponse
{
$session = $this->genvoris->mintSession($request->user()->genvorisCustomerId());
return response()->json(['token' => $session->token]);
}
}
use Genvoris\Laravel\Concerns\HasGenvorisAccess;
class User extends Authenticatable
{
use HasGenvorisAccess;
}
// Returns "laravel_{id}"
$user->genvorisExternalId();
// Upsert the user in the Genvoris platform (auto-syncs email if present)
$customer = $user->syncToGenvoris(['planId' => 'plan_basic']);
// Mint a session token (syncs first if needed)
$session = $user->genvorisSession(expiresIn: 900);
// Usage & entitlement
$usage = $user->genvorisUsage();
$user->canTryOn(); // bool — returns false gracefully on API errors
// Full portal Customer object
$customer = $user->genvorisPortalCustomer();
// In a service provider or EventServiceProvider
use Genvoris\Laravel\Webhooks\Events\CustomerCreated;
use Genvoris\Laravel\Webhooks\Events\GenvorisWebhookReceived;
Event::listen(CustomerCreated::class, function (CustomerCreated $event) {
$payload = $event->payload;
// create local user, send welcome email, etc.
});
// Catch all events
Event::listen(GenvorisWebhookReceived::class, function (GenvorisWebhookReceived $event) {
Log::info("Genvoris webhook: {$event->type} ({$event->id})");
});
use Genvoris\Laravel\Webhooks\WebhookVerifier;
$ok = (new WebhookVerifier())->verify(
$request->getContent(),
$request->header('X-Genvoris-Signature'),
config('genvoris.webhook.secret'),
);