Send Sms in laravel PHP


Send Sms in laravel PHP : We often need to send Sms for implementing some specific tasks such as sending verification code on user’s phone for confirmation. For implementing sms we need third party service which can provide us services to send sms using their api’s . For now we are going to demonstrate this with the well known twilio sms services – https://www.twilio.com/try-twilio


How to Send Sms in laravel PHP

Here are the steps to send sms in laravel php-

Step 1 :

Create Account on twilio – https://www.twilio.com/try-twilio

Step 2 :

Open composer.json and add the following lines –

"aloha/twilio": "~1.0"

Step 3 :

Now Run The two Commands Below –

  • composer update
  • php artisan config:publish aloha/twilio

Step 4 :

Now open – /app/config/packages/aloha/twilio/twilio.php and the required configuration. You can find the settings on https://www.twilio.com/user/account/voice-messaging

Step 5 :

Now you are ready to send the message as in below example –

$phone = 9112312312**;
Twilio::message($phone, "Hi Thanks For Registration! ");

Advertisements

Add Comment

📖 Read More