am2tec / support-sdk
Laravel SDK for the am2tec support_api (widget token issuer + HTTP client).
Requires
- php: ^8.3
- illuminate/http: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- livewire/livewire: ^3.0
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/pest-plugin-testbench: ^3.3
- orchestra/testbench: ^10.0
- pestphp/pest: ^3.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-17 00:34:59 UTC
README
SDK Laravel para o support_api (server-side: usa X-App-Key / X-App-Secret).
composer require am2tec/support-sdk
Fonte canônica: git.am2tec.com:am2tec/sdks/support-sdk. Espelho público (Packagist): github.com/alberto-morais-oliveira-f/support-sdk.
SUPPORT_API_URL=https://support.am2tec.com SUPPORT_API_APP_KEY=... SUPPORT_API_APP_SECRET=...
$token = app(\Am2tec\SupportSdk\SupportSdk::class)->mintWidgetToken( ['external_user_id' => $user->id, 'name' => $user->name, 'email' => $user->email], ['external_id' => $tenant->id, 'name' => $tenant->name, 'slug' => $tenant->slug], );
SupportSdk::client() devolve o SupportClient (post/get em /api/v1/*).
Nunca exponha app key/secret ao browser — só o token resultante.
Widget Livewire
Requer Livewire 3 no host. Registrado como support-chat-widget:
@livewire('support-chat-widget', ['token' => $token, 'apiUrl' => config('support.api_url')])
Estados: idle | otp | chat | notify. Polling usa polling_interval_ms de /widget/config (padrão 3s).
Publicar views: php artisan vendor:publish --tag=support-views; assets (Echo opcional): --tag=support-assets.