Download the PHP package nickdnk/gatewayapi-php without Composer

On this page you can find all versions of the php package nickdnk/gatewayapi-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package gatewayapi-php

Build Status Coverage Status

GatewayAPI PHP Library

This library will allow you to integrate the GatewayAPI.com API in your project using modern PHP7 and an OOP structure. For full description of their API, error codes and so on, see: https://gatewayapi.com/docs.

Prerequisites

You need an active account at https://www.gatewayapi.com to use this library. Once you have that you need to generate an API key/secret pair under API -> API Keys.

Installation

To include this in your project, install it using Composer.

This library requires PHP >= 7.1 and works on 8.0, 8.1 and 8.2.

composer require nickdnk/gatewayapi-php

How to use

Example #1: Sending SMS

Example #2: Canceling scheduled messages

You can cancel a scheduled SMS based on the ID returned when sending. As this method creates a pool of requests (1 per message ID) it does not throw exceptions but returns an array of CancelResult. Each of these contain the status and (if failed) exception of the request.

Example #3: Parsing webhooks

You can easily parse webhooks sent from GatewayAPI to your server using the Webhook class. This uses the JWT header to ensure that the webhook has not been tampered with and is in fact coming from a trusted source.

To set up webhooks go to API -> Web Hooks -> REST. Specify a JWT secret under Authentication after you've created the webhook.

Two types of webhooks can be sent; delivery status notifications and incoming messages (MO traffic). Both are parsed by Webhook and returned as their corresponding class. To read incoming messages you have to subscribe to a keyword or number under Subscriptions -> Keywords / Numbers and assign the keyword or number to a webhook.

Example #4: Handling SMSMessages or Recipients as JSON

SMSMessage and Recipient are encoded into the the actual JSON sent to the API. If you put this output into a queue, or anything similar, and want them back as PHP objects later, you can use these methods to do so.

Tests

If you want to run the unit tests that don't require credentials, simply run vendor/bin/phpunit from the root of the project.

If you want to test the parts that interact with the API you must provide credentials in GatewayAPIHandlerTest.php and run the above command. Note that this sends out live SMS and will cost you 1 SMS in credits per execution.

Contact

You can reach me at [email protected].

Use this library at your own risk. PRs are welcome :)


All versions of gatewayapi-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1 || ^8.0
ext-json Version *
guzzlehttp/guzzle Version ^6.0 || ^7.0
guzzlehttp/oauth-subscriber Version 0.3.* || 0.4.* || 0.5.* || 0.6.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nickdnk/gatewayapi-php contains the following files

Loading the files please wait ....