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] #3

Closed mvzmvcaof closed 7 years ago

mvzmvcaof commented 7 years ago

sadasdadsasdasdasdasd

i use laravel 5.3 setup 1.add it to composer.json
"nexmo/laravel": "dev-master as 1.0", "nexmo/client": "dev-master as 1.0"

2.composer update

3.add Nexmo\Laravel\NexmoServiceProvider::class to the providers array in config/app.php and alias 'Nexmo' => \Nexmo\Laravel\Facade\Nexmo::class

  1. setup    'api_key' => 'API_KEY',

    'api_secret' => 'API_SECRET', where ? laravel 5.3 config/ ?? not make nexmo.php

  2. routes/web.php
Route::get('/sms/send/{to}', function(\Nexmo\Client $nexmo, $to){
    $message = $nexmo->message()->send([
        'to' => $to,
        'from' => '@leggetter',
        'text' => 'Sending SMS from Laravel. Woohoo!'
    ]);
    Log::info('sent message: ' . $message['message-id']);
});  

or

use use Nexmo\Laravel\Facade\Nexmo;

public function tonexmo($to){ Nexmo::message()->send([ 'to' => $to, 'from' => 'sms test', 'text' => 'ok laravel' ]); }

how to use nexmo

tjlytle commented 7 years ago

I'll try to reproduce, latest beta of the client may have broken something.

mvzmvcaof commented 7 years ago

Let us use composer require nexmo/client:@beta ?? Or you wait Package

i need to use sms laravel nexmo

tjlytle commented 7 years ago

@mvzmvcaof The only way I can duplicate this is to not have this line in config/app.php:

'providers' => [
    //...
    Nexmo\Laravel\NexmoServiceProvider::class,
]

As to the configuration, once the service provider is added, run this to create a config file:

php artisan vendor:publish
enasellithy commented 7 years ago

I have the same error my laravel version 5.4

tjlytle commented 7 years ago

@enasellithy moving discussion to this thread: https://github.com/Nexmo/nexmo-laravel/issues/6