Sending SMS in Laravel application with nexmo package
Hello guys, In this quick tutorial I am going to tell you. How to send Sms in Laravel using nexmo package. In many projects, you may need to integrate some API’s to send msgs to the people to perform the operation like send notifications on Mobile. So How can you do that here we will discuss How to send Sms in laravel application.
First You’ll need a Nexmo account, the Nexmo CLI (Command Line Interface) and setup.
Introduction and Installation.
let’s create our Laravel SMS application:
Simply install laravel with composer.
composer create-project --prefer-dist laravel/laravel laravel-project
Here You’ll notice that in the above code the from value is set to a string with the value of @shouters. This will work in the UK, but may not work in other countries. It really depends on the country.
Listing, Searching and Actually send sms
TheNexmo CLI. We can use this to working with phone numbers. Here you need to do the settings like API key and API secret. you can install it by the following command.
$ php artisan serve
Laravel development server started on http://localhost:8000/
you can hit URL like http://localhost:8000/sms/send/YOUR_NUMBER where YOUR_NUMBER should be replaced with your real number including the country code in an e.164 format, the same format that has been shown in all the examples above.