Skip to main content

Overview

Twilio is used exclusively for phone number verification via the Verify V2 API. No voice calls or general SMS messaging. File: app/Models/Services/Integrations/TwilioService.php SDK: twilio/sdk v6.9

Configuration

Config: config/services.php under twilio key.

How it works

Step 1: Request verification code

Endpoint: GET /api/mobile-numbers/code
Sends a 6-digit SMS code to the provided mobile number via Twilio Verify V2.

Step 2: Verify code

Endpoint: GET /api/mobile-numbers/verify
Validates the code against Twilio’s Verify API. If valid, the MobileNumber model is updated with a verified_at timestamp.

Mobile number model

File: app/Models/v1/MobileNumber.php
Key methods:
  • store() — creates new mobile number record
  • storeAndVerify() — creates and immediately marks as verified
  • isTaken() — checks if number is already registered
  • existsForUserId() — checks if user already has a number
Fires MobileNumberUpdated event on update → triggers UpdatePaymentMobileNumber listener which syncs the phone number to Stripe.

Endpoints

Both verification endpoints are public (no auth required): Legacy v1 equivalents exist at /api/v1/mobile-numbers/code and /api/v1/mobile-numbers/verify.