- How do I install vonage/client-core in a Laravel application?
- Run composer require vonage/client, which pulls in vonage/client-core plus a PSR-18/PSR-17 HTTP implementation so the SDK works immediately. If your app already provides a PSR-18 client, you can require vonage/client-core directly instead. PHP 8.1 or newer is required, which matches the Laravel 10 and 11 baseline.
- What is the difference between vonage/client and vonage/client-core?
- vonage/client-core is the HTTP-agnostic core: credential value objects, the Vonage\Client facade, and resource clients such as sms(), messages(), verify() and verify2(). vonage/client is a thin wrapper that pins a concrete HTTP client (Guzzle) so everything works out of the box. In most Laravel apps the wrapper is the simplest default unless you deliberately want to reuse an existing HTTP client.
- Which Laravel and PHP versions does the Vonage PHP SDK support?
- The library requires PHP 8.1 or higher, so it runs cleanly on Laravel 10 and 11. It is framework-agnostic PHP, so there is no Laravel-specific constraint beyond the PHP version your app already runs. Check the package's composer.json before adopting if you are on an older Laravel release.
- How do I bind the Vonage client as a singleton in a Laravel service provider?
- Create a dedicated VonageServiceProvider and register Vonage\Client as a singleton, reading VONAGE_KEY, VONAGE_SECRET and VONAGE_SIGNATURE_SECRET from config/services.php backed by .env. Inside the closure, build a Vonage\Client\Credentials\Basic value object and return new Vonage\Client($credentials, $options). The client is stateless, so a singleton is safe for queue workers and horizontally scaled deployments.
- How do I send an SMS with the Vonage SDK in Laravel?
- Resolve the client from the container, then call $client->sms()->send(new Vonage\SMS\Message\SMS($to, $from, $text)) and inspect the returned messages for per-recipient status. Because 4xx and 5xx responses throw API exceptions, wrap the call in a queued job and add your own retry and backoff logic. There is no built-in retry or rate-limit handling in the SDK.
- Should I use the Vonage SMS API or the unified Messages API?
- The SMS API is the older, text-only surface, while the Messages API covers SMS, MMS, WhatsApp, Messenger and Viber through one endpoint. Choose Messages if multi-channel delivery is anywhere on the roadmap, and SMS only if you are certain text is the sole requirement. Switching later means reworking message objects, webhook payloads and tests.
- Should I use Verify v1 or Verify v2 for OTP and two-factor authentication?
- Verify v2 is webhook-driven with fallback workflows across SMS, voice and WhatsApp, which is more powerful but couples your OTP flow to Vonage's workflow engine. Verify v1 is simpler and request/response based, so it is easier to reason about and test. If owning the OTP flow matters, generate and check codes yourself and use the SDK purely for delivery.
- How do I handle inbound Vonage webhooks and signature verification in Laravel?
- The SDK exposes \Vonage\SMS\Webhook\Factory::createFromGlobals(), which reads PHP superglobals and bypasses Laravel's request lifecycle. Bridge it by constructing the webhook from $request->all() and the raw request body instead, so signature checks run against exactly the bytes Vonage sent. Validate inbound signatures with \Vonage\Client\Signature before acting on the payload, and make handlers idempotent.
- How can I test Vonage API calls without hitting the real API?
- The Vonage\Client constructor accepts options including base_api_url and base_rest_url, so you can point the SDK at a local mock server or a sandbox during tests. Combine that with a fake HTTP client in your container binding to assert outgoing requests. This keeps CI fast and avoids burning real SMS credits.
- Is vonage/client-core actively maintained, and how do I migrate from nexmo/client?
- It is Vonage's official first-party SDK under Apache-2.0, with an active release cadence and a public build badge; low dependent counts on some trackers reflect namespace churn, not abandonment. Migration from the legacy nexmo/client package is largely a namespace rename from Nexmo to Vonage. Move channel by channel rather than in a single cutover, and keep your own SmsSender and Verifier interfaces so controllers and jobs never import Vonage classes directly.