Closed leonardeveloper closed 6 years ago
Thanks @leonardeveloper.
Do you have a nexmo
entry in config/services.php
?
Your config/nexmo.php
file should look like the following (generated by running php artisan vendor:publish
:
<?php
return [
/*
|--------------------------------------------------------------------------
| API Credentials
|--------------------------------------------------------------------------
|
| If you're using API credentials, change these settings. Get your
| credentials from https://dashboard.nexmo.com | 'Settings'.
|
*/
'api_key' => function_exists('env') ? env('NEXMO_KEY', '') : '',
'api_secret' => function_exists('env') ? env('NEXMO_SECRET', '') : '',
/*
|--------------------------------------------------------------------------
| Signature Secret
|--------------------------------------------------------------------------
|
| If you're using a signature secret, use this section. This can be used
| without an `api_secret` for some APIs, as well as with an `api_secret`
| for all APIs.
|
*/
'signature_secret' => function_exists('env') ? env('NEXMO_SIGNATURE_SECRET', '') : '',
/*
|--------------------------------------------------------------------------
| Private Key
|--------------------------------------------------------------------------
|
| Private keys are used to generate JWTs for authentication. Generation is
| handled by the library. JWTs are required for newer APIs, such as voice
| and media
|
*/
'private_key' => function_exists('env') ? env('NEXMO_PRIVATE_KEY', '') : '',
'application_id' => function_exists('env') ? env('NEXMO_APPLICATION_ID', '') : '',
];
Here is my config/services.php
`<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, SparkPost and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
],
'ses' => [
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => 'us-east-1',
],
'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
],
'stripe' => [
'model' => App\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
];
And yes my
config/nexmo.php` is the same with your code.
I've just created a new Laravel 5.5 project and things seem to be working fine.
Bootstrap the project:
composer create-project --prefer-dist laravel/laravel blog "5.5.*"
cd blog
composer require nexmo/laravel
Update routes/web.php
to send an SMS to test:
Route::get('/', function () {
Nexmo::message()->send(['from' => "TEST", 'to' => "<number>", 'text' => "Hello World"]);
return view('welcome');
});
php artisan serve
Visit http://127.0.0.1:8000/ - we should get the error you described
Edit .env
and add your credentials:
NEXMO_KEY=
NEXMO_SECRET=
Visit http://127.0.0.1:8000/ again - the message should be sent fine
I've just created a new Laravel project using the guide from above and got this new error message.
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
Weird. Unsure what I've missed.
Fixed my last error message. Perhaps it's some sort of installation issue on my end that the API credentials didn't worked.
All good now. Thanks a lot.
I had an issue regarding with the API Credentials whereas I already used the given credentials then I got an error that says:
I already added it on my .env and config/nexmo.php files. I'm currently using Laravel 5.5