PHPackages                             vonage/vonage\_drupal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. vonage/vonage\_drupal

ActiveDrupal-module[API Development](/categories/api)

vonage/vonage\_drupal
=====================

Drupal module for setting up the Vonage PHP SDK

0.1.1(5y ago)0671[1 issues](https://github.com/Nexmo/vonage-php-drupal-module/issues)Apache-2.0PHP

Since Dec 6Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Nexmo/vonage-php-drupal-module)[ Packagist](https://packagist.org/packages/vonage/vonage_drupal)[ Docs](https://developer.nexmo.com)[ RSS](/packages/vonage-vonage-drupal/feed)WikiDiscussions 0.x Synced 6d ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Vonage Client Module for Drupal
===============================

[](#vonage-client-module-for-drupal)

[![Contributor Covenant](https://camo.githubusercontent.com/2757a9db291c5ceda172e31d4fa5f3c4048a6e6257ee0b7113f80de277074b91/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6e7472696275746f72253230436f76656e616e742d76322e3025323061646f707465642d6666363962342e737667)](CODE_OF_CONDUCT.md)[![Apache 2.0 licensed](https://camo.githubusercontent.com/b29de0acdfd19013f1f02689b15c933e4a6c145be9efa718288f88ba3280b1c5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d626c75652e737667)](./LICENSE.txt)

[![Nexmo is now known as Vonage](https://camo.githubusercontent.com/ccd17f652c73446c29e6b56a04f6b5c66ad6aaa85abd041db374e5d2a6b55d3f/68747470733a2f2f646576656c6f7065722e6e65786d6f2e636f6d2f6173736574732f696d616765732f566f6e6167655f4e65786d6f2e737667)](https://camo.githubusercontent.com/ccd17f652c73446c29e6b56a04f6b5c66ad6aaa85abd041db374e5d2a6b55d3f/68747470733a2f2f646576656c6f7065722e6e65786d6f2e636f6d2f6173736574732f696d616765732f566f6e6167655f4e65786d6f2e737667)

This is the Vonage API PHP client module for use with the Drupal CMS. To use this, you'll need a Vonage account. Sign up [for free at nexmo.com](https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=php-drupal-module).

**This bundle is currently in development/beta status, so there may be bugs**

- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)

Installation
------------

[](#installation)

### Step 1: Add the module to your composer.json

[](#step-1-add-the-module-to-your-composerjson)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this module:

```
$ composer require vonage/vonage_drupal
```

### Step 2: Install the Module

[](#step-2-install-the-module)

The module will automatically be detected by Drupal, and can be enabled by logging in as a user with permissions to enable modules. Go to the "Extend" page and either search for "Vonage", or scroll down to the "Communications" section. Check the box next to "Vonage API SDK", and click the "Install" button.

### Step 3: Configuration

[](#step-3-configuration)

You can configure the bundle with your application details by goint to the "Configuration" page and click on "Vonage API Settings" under the "System" section.

You can then fill in the needed credentials from your \[Vonage Dashboard\]\[dashboard\]. The module allows you to enter your Vonage API key and secret, and if you are using Application-based APIs like the Voice API you can enter an Application ID as well as a private key to use.

Once you have entered either set of credentials, you can test basic functionlity using the "Vonage SMS API Testing" or "Vonage Voice API Testing" tabs. These allow you to send a test SMS and test voice call.

After you have entered your credentials, you can use any of the APIs that are available in our PHP SDK.

Usage
-----

[](#usage)

### Calling the Vonage APIs

[](#calling-the-vonage-apis)

This bundle takes care of all the client creation needed for making the Vonage client, and adds it to the service container. You can pull the class from the service container or use it as a service in other service declarations.

```
namespace Drupal\my_module\Controller;

use Vonage\Client;
use Vonage\SMS\Message\SMS;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;

class MyController extends ControllerBase
{
    /**
     * @var Client
     */
    protected $client;

    public function __construct($client)
    {
        $this->client = $client;
    }

    public static function create(ContainerInterface $container)
    {
        return new static($container->get(Client::class));
    }

    public function controllerAction(): array
    {
        $this->client->sms()->send(
            new SMS($to, from, $message)
        );

        $build = [
            '#markup' => 'Hello World!',
        ];

        return $build;
    }
}
```

### Working with Incoming Webhooks

[](#working-with-incoming-webhooks)

Many of the Vonage APIs, especially the SMS and Voice API, work with your application through a concept of a Webhook. This is where the Vonage API servers make a request to YOUR application, instead of your application making a request to Vonage.

The Vonage API provides a way to interpret the incoming web request, and will generate an appropriate object. All you need to do is know which kind of request, either SMS or Voice, is coming to a specific route.

#### Incoming SMS Messages

[](#incoming-sms-messages)

When you elect to have a number accept SMS, Vonage will ask for the URL to send the information to. You can create a controller in your module with a route that can accept the incoming request, and use the `\Vonage\SMS\Webhook\Factory`to convert that request into an object.

```
namespace Drupal\my_module\Controller;

use Vonage\SMS\Webhook\Factory;
use Vonage\SMS\Webhook\InboundSMS;
use Drupal\Core\Controller\ControllerBase;

class MyController extends ControllerBase
{
    public function incomingSMS(): array
    {
        /** @var InboundSMS $inboundSMS */
        $inboundSMS = Factory::createFromGlobals();

        $to = $inboundSMS->getTo();
        $from = $inboundSMS->getFrom();
        $text = $inboundSMS->getText();

        // ...
    }
}
```

#### Incoming Voice Calls

[](#incoming-voice-calls)

If you are building an interactive voice application, you can set up an Answer Webhook in the Application Settings on the Vonage Dashboard. You can create a controller in your module with a route that can accept the incoming call and use the `\Vonage\Voice\Webhook\Factory` to convert that request into an object.

```
namespace Drupal\my_module\Controller;

use Vonage\Voice\Webhook\Factory;
use Vonage\Voice\Webhook\Answer;
use Drupal\Core\Controller\ControllerBase;

class MyController extends ControllerBase
{
    public function answerCall(): array
    {
        /** @var Answer $inboundCall */
        $inboundCall = Factory::createFromGlobals();

        $to = $inboundCall->getTo();
        $from = $inboundCall->getFrom();
        $uuid = $inboundCall->getUuid();

        // ...
    }
}
```

#### Incoming Voice Events

[](#incoming-voice-events)

In addition to being able to answer a call, the Voice API is heavily event driven. You can set up an Event Webhook in the Application Settings on the Vonage Dashboard in addition to the Answer webhook. You can create a controller in your module with a route that can accept the events and use the `\Vonage\Voice\Webhook\Factory` to convert that request into an object.

When working with the objects, you will want to inspect the type of object that is generated as there are many types of events with their own object structure.

You can see all the available event types at .

```
namespace Drupal\my_module\Controller;

use Vonage\Voice\Webhook\Factory;
use Vonage\Voice\Webhook\Answer;
use Vonage\Voice\Webhook\Event;
use Drupal\Core\Controller\ControllerBase;

class MyController extends ControllerBase
{
    public function voiceEventHandler(): array
    {
        $event = Factory::createFromGlobals();

        if ($event instanceof Event) {
            // ...
        } elseif ($event instanceof Notification) {
            // ...
        }

        // ...
    }
}
```

Contributing
------------

[](#contributing)

This library is actively developed, and we love to hear from you! Please feel free to [create an issue](https://github.com/nexmo/vonage-php-drupal-module/issues) or [open a pull request](https://github.com/nexmo/vonage-php-drupal-module/pulls) with your questions, comments, suggestions and feedback.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

1984d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c2583b67d4e1a4ade23b6ce271980d18bf3facb4ea3f0610fded770f380d17d?d=identicon)[dragonmantank](/maintainers/dragonmantank)

![](https://avatars.githubusercontent.com/u/2683897?v=4)[Vonage](/maintainers/Vonage)[@Vonage](https://github.com/Vonage)

![](https://www.gravatar.com/avatar/efc1f4119b02a988612122f19b2e021c8e919e5018f645d453a62b47064790b2?d=identicon)[SecondeJK](/maintainers/SecondeJK)

---

Top Contributors

[![dragonmantank](https://avatars.githubusercontent.com/u/108948?v=4)](https://github.com/dragonmantank "dragonmantank (2 commits)")

### Embed Badge

![Health badge](/badges/vonage-vonage-drupal/health.svg)

```
[![Health](https://phpackages.com/badges/vonage-vonage-drupal/health.svg)](https://phpackages.com/packages/vonage-vonage-drupal)
```

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)[hubspot/api-client

Hubspot API client

23414.2M16](/packages/hubspot-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
