gotrex/laravel-voipnow

A Laravel wrapper for the VoipNow API

1.0.0 2018-12-18 10:51 UTC

This package is auto-updated.

Last update: 2024-05-18 23:01:22 UTC


README

Latest Stable Version Total Downloads License

A Laravel 5 wrapper for the VoipNow SystemAPI.

Note: The token credential information is stored in a JSON file for application wide usage. If you prefer multi user usage please refer to the Multiuser Support section of the readme.

Installation

You can install the package via composer:

composer require gotrex/laravel-voipnow

From the command-line run:

php artisan vendor:publish --provider="Gotrex\VoipNow\VoipNowServiceProvider"

Add the following keys to your .env file.

VOIPNOW_VERSION=
VOIPNOW_DOMAIN=
VOIPNOW_MULTI_USER=false
VOIPNOW_KEY=
VOIPNOW_SECRET=

The following key is optional

VOIPNOW_PARENT_IDENTIFIER=

Usage

You can call a VoipNow SystemAPI method directly by using the facace (e.g. VoipNow::{VOIPNOWFUNCTION}). For a full reference of all the available functions refer to the VoipNow SystemAPI documenatation.

Examples

Retrieve a list of all the service providers

use VoipNow;

return VoipNow::GetServiceProviders();

Retrieve the organization account details

use VoipNow;

return VoipNow::GetOrganizationDetails(['identifier' => 'XXX']);

If you do not use the Facade, you can call it with the app() helper.

$voipNow = app('voipnow');

return $voipNow->GetOrganizationDetails(['identifier' => 'XXX']);

Multiuser support

Out of the box this package stores the token information in a JSON file. This means every request uses the same token credentials. If you would like to give your users the opportunity to make individual requests you can do so by setting the following parameter inside your .env file:

VOIPNOW_MULTI_USER=true

Currently the package does not provide a migration. Add the following definition to the user migration - or create the fields directly in the database table.

$table->text('voipnow_access_token')->nullable();
$table->integer('voipnow_expires_in')->nullable();
$table->timestamp('voipnow_expired_at')->nullable();

Add the fields to the $fillable property of the User model.

protected $fillable = [
    'name', 'email', 'password', 'voipnow_access_token', 'voipnow_expires_in', 'voipnow_expired_at'
];

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email development@go-trex.com instead of using the issue tracker.

Credits

Support

Please open an issue in github

License

The MIT License (MIT). Please see License File for more information.