Nexmo / nexmo-laravel

Add Vonage functionality such as SMS and voice calling to your Laravel app with this Laravel Service Provider.
MIT License
318 stars 79 forks source link

Target [Nexmo\Client\Credentials\CredentialsInterface] is not instantiable while building [Nexmo\Client]. #6

Closed ghost closed 6 years ago

ghost commented 7 years ago

When I try using the Facade: Nexmo::message()->send([ 'to' => '14845551244', 'from' => '16105552344', 'text' => 'Using the facad to send a mesage.' ]);

Note: I have added:

Nexmo\Laravel\NexmoServiceProvider::class to my providers array

'Nexmo' => \Nexmo\Laravel\Facade\Nexmo::class to my alias

Am using Laravel 5.3

atapatel commented 7 years ago

+1 i am also facing this issue.

tjlytle commented 7 years ago

@aliuwahab21 @atapatel see this related issue.

leandrit1 commented 7 years ago

Hi @tjlytle , I am having the same problem, and furthermore I have noticed that the nexmo.php even though I followed all the steps, when I run php artisan vendor:publish the nexmo.php file can not be found on the config/nexmo.php as we see it in some tutorials but we find it just in the vendor/nexmo/laravel/config/nexmo.php

Target [Nexmo\Client\Credentials\CredentialsInterface] is not instantiable while building [Nexmo\Client].

tjlytle commented 7 years ago

@LeandritGo What version of Laravel are you using?

leandrit1 commented 7 years ago

Laravel 5.3

On 27 Mar 2017 18:10, "Tim Lytle" notifications@github.com wrote:

@LeandritGo https://github.com/LeandritGo What version of Laravel are you using?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Nexmo/nexmo-laravel/issues/6#issuecomment-289502366, or mute the thread https://github.com/notifications/unsubscribe-auth/AXrR6EeAGQWhVgj2xwVaJaeHE0Nu2zDvks5rp9-NgaJpZM4LKUvb .

leandrit1 commented 7 years ago

Are there any news regarding the issue?

tjlytle commented 7 years ago

@LeandritGo I can't replicate, but if it's not creating config/nexmo.php just copy the file from vendor/nexmo/laravel/config/nexmo.php to your config directory.

And if artisan vendor:publish isn't creating the config file, seems like there's something missing in your config/app.php (Laravel doesn't know about the Nexmo Service Provider).

tjlytle commented 7 years ago

@afolson See @enasellithy's comment in the closed thread (https://github.com/Nexmo/nexmo-laravel/issues/3). I can't replicate unless I drop the client from the providers config. Any ideas? I'm sure there could be better error handling as well.

afolson commented 7 years ago

I tried just now and was unable to reproduce on L5.3 or L5.4 unless I dropped the client from the providers array in config/app.php. Additionally, I was able to verify that artisan vendor:publish puts a nexmo.php file in the config directory.

It seems like people are using various versions of the Laravel package AND the client, or possibly just using nexmo/client instead of nexmo/laravel. Would someone mind running composer update nexmo/laravel and making sure that "nexmo/laravel": "^0.4.0" appears in composer.json and that you see a block similar to this in composer.lock:

screenshot 2017-06-18 13 54 57

Note that nexmo/laravel is pulling in nexmo/client and they have the same version number here. In theory, adding/removing packages via composer should re-generate the autoload file, but for good measure you may want to run composer dump-auto just in case.

If it's still not working after all of that we can debug deeper 🐛

tjlytle commented 7 years ago

@afolson Wonder if there's a way to catch that (including nexmo/client but trying to invoke using the service provider, and provide a better error message.

leandrit1 commented 7 years ago

I fixed my issue by running php artisan config:clear , it took me a bunch of time as I ran cache:clear and was not thinking of using config:clear.

mheap commented 6 years ago

As we've not been able to reproduce this, I'm going to close the issue. We can link and reopen in future if required.

erickbrz commented 6 years ago

solved for me, i had in my config/nexmo.php ('signature_secret' => xxxxxx), after deleted the line, send sms!