GithubHelp home page GithubHelp logo

nexmo / nexmo-laravel Goto Github PK

View Code? Open in Web Editor NEW
317.0 39.0 80.0 63 KB

Add Vonage functionality such as SMS and voice calling to your Laravel app with this Laravel Service Provider.

License: MIT License

PHP 100.00%
library laravel sms laravel-package laravel-service-provider telephony vonage developer-destination

nexmo-laravel's Introduction

THIS PACKAGE IS DEPRECATED We have moved to: https://github.com/Vonage/vonage-laravel, so please raise any new issues or Pull Requests in this repository.

Nexmo Package for Laravel

Latest Stable Version Latest Unstable Version License Total Downloads

Nexmo is now known as Vonage

Introduction

This is a simple Laravel Service Provider providing access to the Nexmo PHP Client Library.

Installation

To install the PHP client library using Composer:

composer require nexmo/laravel

Alternatively, add these two lines to your composer require section:

{
    "require": {
        "nexmo/laravel": "^2.0"
    }
}

Laravel 5.5+

If you're using Laravel 5.5 or above, the package will automatically register the Nexmo provider and facade.

Laravel 5.4 and below

Add Nexmo\Laravel\NexmoServiceProvider to the providers array in your config/app.php:

'providers' => [
    // Other service providers...

    Nexmo\Laravel\NexmoServiceProvider::class,
],

If you want to use the facade interface, you can use the facade class when needed:

use Nexmo\Laravel\Facade\Nexmo;

Or add an alias in your config/app.php:

'aliases' => [
    ...
    'Nexmo' => Nexmo\Laravel\Facade\Nexmo::class,
],

Using Nexmo-Laravel with Lumen

Nexmo-Laravel works with Lumen too! You'll need to do a little work by hand to get it up and running. First, install the package using composer:

composer require nexmo/laravel

Next, we have to tell Lumen that our library exists. Update bootstrap/app.php and register the NexmoServiceProvider:

$app->register(Nexmo\Laravel\NexmoServiceProvider::class);

Finally, we need to configure the library. Unfortunately Lumen doesn't support auto-publishing files so you'll have to create the config file yourself by creating a config directory and copying the config file out of the package in to your project:

mkdir config
cp vendor/nexmo/laravel/config/nexmo.php config/nexmo.php

At this point, set NEXMO_KEY and NEXMO_SECRET in your .env file and it should be working for you. You can test this with the following route:

$router->get('/', function () use ($router) {
    app(Nexmo\Client::class);
});

Dealing with Guzzle Client issues

By default, this package uses nexmo/client, which includes a Guzzle adapter for accessing the API. Some other libraries supply their own Guzzle adapter, leading to composer not being able to resolve a list of dependencies. You may get an error when adding nexmo/laravel to your application because of this.

The Nexmo client allows you to override the HTTP adapter that is being used. This takes a bit more configuration, but this package allows you to use nexmo/client-core to supply your own HTTP adapter.

To do this:

  1. composer require nexmo/client-core to install the Core SDK

  2. Install your own httplug-compatible adapter. For example, to use Symfony's HTTP Client:

    1. composer require symfony/http-client php-http/message-factory php-http/httplug nyholm/psr7
  3. composer require nexmo/laravel to install this package

  4. In your .env file, add the following configuration:

    NEXMO_HTTP_CLIENT="Symfony\\Component\\HttpClient\\HttplugClient"

You can now pull the Nexmo\Client object from the Laravel Service Container, or use the Facade provided by this package.

Configuration

You can use artisan vendor:publish to copy the distribution configuration file to your app's config directory:

php artisan vendor:publish

Then update config/nexmo.php with your credentials. Alternatively, you can update your .env file with the following:

NEXMO_KEY=my_api_key
NEXMO_SECRET=my_secret

Optionally, you could also set an application_id and private_key if required:

NEXMO_APPLICATION_ID=my_application_id
NEXMO_PRIVATE_KEY=./private.key

Private keys can either be a path to a file, like above, or the string of the key itself:

NEXMO_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n[...]\n-----END PRIVATE KEY-----\n"
NEXMO_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
[...]
-----END PRIVATE KEY-----
"

Usage

To use the Nexmo Client Library you can use the facade, or request the instance from the service container:

Nexmo::message()->send([
    'to'   => '14845551244',
    'from' => '16105552344',
    'text' => 'Using the facade to send a message.'
]);

Or

$nexmo = app('Nexmo\Client');

$nexmo->message()->send([
    'to'   => '14845551244',
    'from' => '16105552344',
    'text' => 'Using the instance to send a message.'
]);

If you're using private key authentication, try making a voice call:

Nexmo::calls()->create([
    'to' => [[
        'type' => 'phone',
        'number' => '14155550100'
    ]],
    'from' => [
        'type' => 'phone',
        'number' => '14155550101'
    ],
    'answer_url' => ['https://example.com/webhook/answer'],
    'event_url' => ['https://example.com/webhook/event']
]);

For more information on using the Nexmo client library, see the official client library repository.

nexmo-laravel's People

Contributors

afolson avatar danielebarbaro avatar dragonmantank avatar driesvints avatar dwightwatson avatar elstamey avatar leggetter avatar lornajane avatar mheap avatar omranic avatar percymamedy avatar secondejk avatar tjlytle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nexmo-laravel's Issues

nexmo/client 0.4.0 error

After Composer Update,..

`Problem 1

  • nexmo/laravel 0.4.0 requires nexmo/client 0.4.0 -> satisfiable by nexmo/client[0.4.0].
  • nexmo/laravel 0.4.0 requires nexmo/client 0.4.0 -> satisfiable by nexmo/client[0.4.0].
  • Conclusion: remove nexmo/client 0.4.0
  • Installation request for nexmo/laravel ^0.4.0 -> satisfiable by nexmo/laravel[0.4.0].`

Any idea how to solve of this? we are using laravel 5.7

Support Laravel 9

update please

"illuminate/support": "^5.2|^6.0|^7.0|^8.0",
"illuminate/support": "^5.2|^6.0|^7.0|^8.0|^9.0",

@new Verification returns an exception

Expected Behavior

I was looking and debugging the code after having an exception, then suddenly I saw you try to hide the errors using the "@" symbol; first, that is an evil and dangerous practice, and also that is not a solution (like in my case).

protected function createVerificationFromArray($array): Verification
    {
        if (!is_array($array)) {
            throw new RuntimeException('verification must implement `' . VerificationInterface::class .
                '` or be an array`');
        }

        foreach (['number', 'brand'] as $param) {
            if (!isset($array[$param])) {
                throw new InvalidArgumentException('missing expected key `' . $param . '`');
            }
        }

        $number = $array['number'];
        $brand = $array['brand'];

        unset($array['number'], $array['brand']);

        return @new Verification($number, $brand, $array);
    }

Current Behavior

Possible Solution

The error thrown in the Verification class should be removed, or the https://github.com/Nexmo/nexmo-php/blob/master/src/Verify/Client.php class should be modified (the start function).

Steps to Reproduce (for bugs)

I tried to verify the user's phone number as follow:

Nexmo::verify()->start(new Request('hier_the_phone_number', 'MyApp'))

Then the exception ArgumentCountError is shown.
The problem is the function start in the class /Verify/Client.php.

Context

I want to verify the user's phone number after its registration, but currently, it is not possible.

Your Environment

I am using laravel sail.

Issue with getting api_key/secret

I had an issue after php artisan vendor:publish
After adding The right credential to nexemo.php config file it keeps showing
Bad credentials error

So i had to edit Vendor\Nexmo\Client\Credentials\Basic and change the variables $key and $secret with the credential string to make this work.

shouldnt this be something like this?

class Basic extends AbstractCredentials implements CredentialsInterface
{
    public function __construct($key, $secret)
    {
        $this->credentials['api_key'] = $key ?: config('nexmo.api_key');
        $this->credentials['api_secret'] = $secret ?: config('nexmo.api_secret');
    }
}

Driver [nexmo] not supported Laravel 6

I am using the Nexmo notifications library for Laravel and it's all of a sudden stopped working since I upgraded to Laravel 6.

Here is the error:

(1/1) InvalidArgumentException
Driver [nexmo] not supported.

Any ideas why this is?

I have the library installed properly through my composer file:

"nexmo/laravel": "^2.1.0",

It seems to not be autoloading the library properly.

Below is my config/app.php file:

'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Illuminate\Auth\AuthServiceProvider::class,
        Illuminate\Broadcasting\BroadcastServiceProvider::class,
        Illuminate\Bus\BusServiceProvider::class,
        Illuminate\Cache\CacheServiceProvider::class,
        Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
        Illuminate\Cookie\CookieServiceProvider::class,
        Illuminate\Database\DatabaseServiceProvider::class,
        Illuminate\Encryption\EncryptionServiceProvider::class,
        Illuminate\Filesystem\FilesystemServiceProvider::class,
        Illuminate\Foundation\Providers\FoundationServiceProvider::class,
        Illuminate\Hashing\HashServiceProvider::class,
        Illuminate\Mail\MailServiceProvider::class,
        Illuminate\Notifications\NotificationServiceProvider::class,
        Illuminate\Pagination\PaginationServiceProvider::class,
        Illuminate\Pipeline\PipelineServiceProvider::class,
        Illuminate\Queue\QueueServiceProvider::class,
        Illuminate\Redis\RedisServiceProvider::class,
        Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
        Illuminate\Session\SessionServiceProvider::class,
        Illuminate\Translation\TranslationServiceProvider::class,
        Illuminate\Validation\ValidationServiceProvider::class,
        Illuminate\View\ViewServiceProvider::class,
		Collective\Html\HtmlServiceProvider::class,
		
        /*
         * Package Service Providers...
		 
         */
		 

		Yajra\Datatables\DatatablesServiceProvider::class,
		ConsoleTVs\Charts\ChartsServiceProvider::class,
		SimpleSoftwareIO\SMS\SMSServiceProvider::class,
		Spatie\GoogleCalendar\GoogleCalendarServiceProvider::class,
		Nexmo\Laravel\NexmoServiceProvider::class,
		Propaganistas\LaravelPhone\PhoneServiceProvider::class,
		Barryvdh\Debugbar\ServiceProvider::class,
		DrawMyAttention\XeroLaravel\Providers\XeroServiceProvider::class,
        /*
         * Application Service Providers...
         */
        App\Providers\AppServiceProvider::class,
        App\Providers\AuthServiceProvider::class,
        App\Providers\BroadcastServiceProvider::class,
        App\Providers\EventServiceProvider::class,
        App\Providers\RouteServiceProvider::class,
		App\Providers\DropboxServiceProvider::class,
		App\Providers\ExtendedXeroServiceProvider::class,

    ],

enter image description here

Send SMS for two different phone numbers

A have a booking model, which collects client phone address and has an assigned thru foreign key employee id, that has it's own phone number. When a booking is created, an observer triggers 2 notifications. With the first notification, I am sending an SMS to client, and with the second I want to inform the employee about received booking thru SMS.
How do I send notifications for two different phone numbers from the same booking model? Any help is appreciated!

public function routeNotificationForNexmo() { return [$this->client_phone, $this->employee->phone]; }

Your Environment

  • Version used: Laravel 8

Laravel 8 compatibility

Laravel 8 requires Guzzle 7.0.1 but the nexmo-laravel package appears to require 6.5.

You CAN follow the configuration guide to install a custom HTTP provider besides Guzzle, but this package should natively support the newest version of Laravel.

web monetization

Definition
Web monetization
It is a new way to be paid from your content you created

nexmo not worked with lumen

(1/1) FatalThrowableErrorCall to undefined function Nexmo\Laravel\config_path()

in NexmoServiceProvider.php (line 16)
at NexmoServiceProvider->boot()
at call_user_func_array(array(object(NexmoServiceProvider), 'boot'), array())in BoundMethod.php (line 29)
at BoundMethod::Illuminate\Container{closure}()in BoundMethod.php (line 87)
at BoundMethod::callBoundMethod(object(Application), array(object(NexmoServiceProvider), 'boot'), object(Closure))in BoundMethod.php (line 31)
at BoundMethod::call(object(Application), array(object(NexmoServiceProvider), 'boot'), array(), null)in Container.php (line 549)
at Container->call(array(object(NexmoServiceProvider), 'boot'))in Application.php (line 197)
at Application->register(object(NexmoServiceProvider))in app.php (line 111)
at require('/app/bootstrap/app.php')in index.php (line 14)

Lumen 5.5

Use of Bunq API in Laravel project

I am working on a project based on cryptocurreny transactions, my client is from Netherlander. He want to implement bunq API for transactions, Bunq is not supported in India so client sent me sandbox API key and doc key.
I have went through doc.bunq.com but did not understand how to implement. what should i do next to integrate bunq API.
I have only Sandbox API and doc key provided by client.
I don't know how to install-> Installation post and next two installation.
Can someone please help me to solve this problem?

failed on production

to reproduce this bug remove your vendor folder and try :

composer install --prefer-dist --no-scripts --no-dev

this issue only happens on production

Class 'Http\Adapter\Guzzle6\Client' not found

I solved it by adding guzzle adapter to dependency

Error in installation

Hi, I have created fresh laravel project 5.4. Im getting error when enter "composer composer require nexmo/laravel 1.0.0-beta3". I tried several times but failed. Error shows as below.

Problem 1

  • Can only install one of: nexmo/client[1.0.0-beta3, 1.0.0-beta4].

Ambigious Class Resolution

Ive been using this package in our project for about a year or so. Originally as nexmo/laravel. It seems running composer update has pulled the new version into my code, vonage/client.

Now when deploying to laravel forge, I have an issue with Ambiguous class resolutions. I get messages like the following, and a report that deployment failed.

Warning: Ambiguous class resolution, "Vonage\Network" was found 2x: in "/home/forge/cpadirectory.graphicdesignelite.net/vendor/nexmo/client-core/src/Network.php" and "/home/forge/cpadirectory.graphicdesignelite.net/vendor/vonage/client-core/src/Network.php", the first will be used.
Warning: Ambiguous class resolution, "Vonage\Response" was found 2x: in "/home/forge/cpadirectory.graphicdesignelite.net/vendor/nexmo/client-core/src/Response.php" and "/home/forge/cpadirectory.graphicdesignelite.net/vendor/vonage/client-core/src/Response.php", the first will be used.

Larastan warnings

I'm analyzing my project with Larastan (https://github.com/nunomaduro/larastan) and it's complaining about my Nexmo code. Not sure if this is an error within nexmo-laravel or within the Larastan check.

The warning is "Call to an undefined static method Nexmo\Laravel\Facade\Nexmo::message()", which seems quite right to me, since I can't find any message() method in that facade. However, my code (pasted below) using that same method works fine, I get the feeling my php knowledge is too limited to understand why.

My simple code:
Nexmo::message()->send([ 'to' => $number, 'from' => $sender, 'text' => $message ]);

So, the code works, but the test of it fails. Is there any more meta information that's needed in the facade for it to pass?

Your Environment

  • Version used: 2.4.1
  • Environment name and version (e.g. PHP 7.2 on nginx 1.19.1): PHP 7.4.18, Laravel v8.63.0, Larastan v0.7.12
  • Operating System and version: Ubuntu 20.04.2 LTS

message is garbled

hi,
i have an issue while i was sending message
i've got garbled message in chinese, how to set nexmo message type to unicode???

thank you

Tag a point-release so we can do a stable install...

Even a 0.1 would be good, and still indicates the library is in a state of flux. The benefit is that early adopters can have the version they've coded against in their lock file (vs. a reference to dev-master).

Nexmo API credentials error

I had an issue regarding with the API Credentials whereas I already used the given credentials then I got an error that says:

Please provide Nexmo API credentials. Possible combinations: api_key + api_secret, api_key + signature_secret, private_key + application_id, api_key + api_secret + private_key + application_id, api_key + signature_secret + private_key + application_id .

I already added it on my .env and config/nexmo.php files.
I'm currently using Laravel 5.5

Different Nexmo Accounts

Hello,

I've been using your plugin for my laravel projects for a while now and it works very good, but i have a problem with the newest update in another project i'm working on.

This update lets administrators of their instance add their nexmo api key and secret to the database aswell as the numbers they want to add but as far as i can see the key and secret are only set in the .env file or the config file.

Is there a way i can use the nexmo api key and secret in the array i pass too Nexmo::message()->send();

Vonage Voyagers application: Create a more detailed SMS log

I have had an issue before where I've sent an SMS which hasn't been delivered and I couldn't drill into the actual API request for the SMS with a response. I figured the issue out which was that I hadn't formatted the number correctly but this was through a more manual trial / error process.

Nexmo Issue with getting api_key/secret

I had an issue regarding with the API Credentials whereas I already used the given credentials then I got an error that says: "Please provide Nexmo API credentials. Possible combinations: api_key + api_secret, api_key + signature_secret, private_key + application_id, api_key + api_secret + private_key + application_id, api_key + signature_secret + private_key + application_id ".

Thing is I already added it on my .env and config/nexmo.php files.

Using Nexmo in Laravel with Multi-tenancy

I'm currently using Spatie's multi-tenancy package to implement multi-tenancy on my laravel app. Before migrating to multi-tenancy, my Nexmo SMS implementation was working fine, but after implementing Spatie's multi-tenancy package (and consequently starting to use mutliple databases per tenant), I am no longer able to send SMSs. I don't get any error messages, but the SMS just doesn't send. I didn't expect this as I don't believe Nexmo uses my database..

Expected Behavior

The SMS to send using Nexmo and using my code as implemented prior to migrating to mutli-tenancy. Below is an example of a Nexmo call in a notification. Also note that I have both NEXMO_KEY and NEXMO_SECRET set in .env:

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\NexmoMessage;
use Nexmo\Laravel\Facade\Nexmo;

class ShiftTwoHourSMSNotification extends Notification
{
    use Queueable;

    public $content;
    public $phone_number;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($content, $phone_number)
    {
        $this->content = $content;
        $this->phone_number = $phone_number;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['nexmo'];
    }

    /**
     * Get the Nexmo / SMS representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return NexmoMessage
     */
    public function toNexmo($notifiable)
    {
        return Nexmo::message()->send([
            'to'   => $this->phone_number,
            'from' => '[my_number]',
            'text' => $this->content,
        ]);
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}

Current Behavior

No SMS is being sent, no error is appearing, and I have nothing coming up in laravel log. I can currently send an SMS using normal Nexmo code as described in the Get Started section of the docs, but my feeling is that maybe this has something to do with the Laravel Nexmo Facade?

Possible Solution

I don't even know where to start, as I have limited understanding of the Nexmo laravel package under the hood.

Steps to Reproduce (for bugs)

Implement Spatie's multi-tenancy package and use a mutliple database setup. Then try to send an sms with nexmo

Context

Your Environment

  • Version used:
    Laravel 7
  • Environment name and version (e.g. PHP 7.2 on nginx 1.19.1):
    PHP 7.4
  • Operating System and version:

confusing documentation

Hello,

for Laravel 5.5, the Notification documentation says to add nexmo config in config/services.php
https://laravel.com/docs/5.5/notifications#sms-notifications

not in config/nexmo.php

I ran php artisan vendor:publish but still no config/nexmo.php

And I receive this error :

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

any idea ?

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

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

Package zendframework/zend-diactoros is abandoned

Hi

when I installed the package on my Laravel project, I faced this message in cmd:

Package zendframework/zend-diactoros is abandoned, you should avoid using it. Use laminas/laminas-diactoros instead.

PHP: v7.2
Laravel: v6.2

"At sign" replaced by "inverted question mark sign"

Hi,

The "at sign" of my contact email address is being replaced by an "inverted question mark sign" (escaped?).

Expected
[email protected]

Actual result
contact¿propertysumo.com

The @ sign is part of the SMS default supported characters:
https://en.wikipedia.org/wiki/GSM_03.38#GSM_7-bit_default_alphabet_and_extension_table_of_3GPP_TS_23.038_.2F_GSM_03.38

So I don't believe it is being escaped.

Oddly enough, if I try to send the same SMS via Curl, the email address does not get escaped, I receive the SMS normally.

So I figured the problem must come from the Laravel/PHP package.

Any help appreciated. Cheers.

Error sending SMS

I am trying to send an SMS message using this package, following the example laid out in the documentation, but I get an error that I cannot figure out.

Expected Behavior

Here is the code I'm using

$nexmo = app('Vonage\Client');

$nexmo->message()->send([
  'to' => '516...',
  'from' => 'John Doe',
  'text' => 'Test message',
]);

NEXMO_KEY and NEXMO_SECRET are both set in the .env file

I would expect the message to be sent to my phone.

Current Behavior

When I run the code above I get the following error:
TypeError: Too few arguments to function Vonage/Client::Vonage/{closure}(), 4 passed and exactly 5 expected

Your Environment

  • Version used:
  • PHP 8
  • Lumen 8

Migrate to Vonage/vonage-php-sdk-core before 10/01/2021

As written in the first paragraph of the Nexmo/nexmo-php readme:

This library and it's associated packages, nexmo/client and nexmo/client-core have transitioned into a "Maintenance Only" mode. For the next twelve (12) months, this library will only receive bug or security fixes. This library will officially be End of Life as of October 1st, 2021.

We recommend users begin migrating over to https://github.com/vonage/vonage-php-sdk-core and the vonage/client and vonage/client-core packages for their applications. The Vonage packages fully support the \Nexmo namespace and should be a drop-in replacement for the Nexmo packages.

How im supposed to catch exceptions?

Im doing this:

   try {
           Nexmo::message()->send([
               'to' => $user->getPhoneWithCode(),
               'from' => '16105552344',
               'text' => 'CMM te saluda '. $user->name . ', tu numero de socio es: ' . $user->credential . ''
           ]);

       } catch (Exception $e) {
           Log::error('Nexmo error:' . $e->getMessage());
       }

but i still get the exception in the browser.

Can't find Nexmo/Client in a job

I must be missing the obvious. Probably been staring at this for too long! lol

I have a queueable job that I want to send an SMS via Nexmo. Installed nexmo/laravel on Laravel 5.5, so I'm assuming the Facade and provider were auto-discovered.

Whenever I try to use the Facade in my handle() method in the job, I keep getting this in the Laravel log:

Class 'App\Jobs\Nexmo\Client' not found

Any ideas? I've tried using use Nexmo;, et al, but no matter what I do, it just can't seem to find the class! Thanks in advance. Maybe I need more coffee ... or less. Who knows lol.

Missing ability to search landline-toll-free

You are unable to search for type landline-toll-free as the protected parameter is missing from the file.

Expected Behavior

Availability search for toll free numbers

Current Behavior

When running a search for toll free numbers the following error is produced:

InvalidArgumentException: Invalid type of number in file /vendor/vonage/client-core/src/Numbers/Filter/AvailableNumbers.php on line 219

#0 //vendor/vonage/client-core/src/Numbers/Filter/AvailableNumbers.php(86): Vonage\Numbers\Filter\AvailableNumbers->setType('landline-toll-f...')
#1 /vendor/vonage/client-core/src/Numbers/Client.php(236): Vonage\Numbers\Filter\AvailableNumbers->__construct(Array)

When looking in the Filter file I noticed that only mobile-lvn and landline are accepted types to search by.

Possible Solution

Steps to Reproduce (for bugs)

  1. set type to 'landline-toll-free'

Context

Your Environment

  • Version used: "nexmo/laravel" 2.4.1
  • Environment name and version (e.g. PHP 7.2 on nginx 1.19.1): PHP 7.4|8
  • Operating System and version:

How to make Nexmo to throw errors in Json

I am trying to find a way of using Nexmo in a Laravel setup to throw errors in json so that they can be easily handled by my rest client but with no success so far.

Agrinnovation

Receive an information about your activities and what innovation you can apply for.

Upgrade vonage/client

Please, upgrade vonage/client to version 3.0.0

For PHP 8.1:

Return type of Vonage\Client\Credentials\AbstractCredentials::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/vendor/vonage/client-core/src/Client/Credentials/AbstractCredentials.php on line 31

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.