Download the PHP package jowusu837/hubtel-ussd-plugin-laravel without Composer

On this page you can find all versions of the php package jowusu837/hubtel-ussd-plugin-laravel. 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 hubtel-ussd-plugin-laravel

Hubtel USSD plugin for Laravel

Latest Release on GitHub Total Downloads

Based on Hubtel's USSD API

About

This package allows you to integrate Hubtel USSD service directly into your existing Laravel application. This allows users to access your application on USSD like *1234#. Check out this link to know how you can acquire a USSD code from Hubtel.

Installation

Require the jowusu837/hubtel-ussd-plugin-laravel package in your composer.json and update your dependencies:

If you're using Laravel 5.5, this is all there is to do.

Should you still be on older versions of Laravel, the final steps for you are to add the service provider of the package and alias the package. To do this open your config/app.php file.

Add the HubtelUssd\ServiceProvider to your providers array:

Usage

Your application should now have an endpoint for USSD access. You can use the Hubtel USSD Simulator to test your it out by supplying your application url as: http://your-application.com/ussd

Customization

Your application should have the default USSD flow just to show you the the plugin is working. You create your own custom USSD flows by simply creating Activities. You can start by creating a new folder in your app directory called USSD. This is where you will store all your USSD related logic.

A USSD activity is just a simple php class that extends the UssdActivity class. Here's how it looks like:

So basically, an activity class such as the one above must implement 2 methods: run() and next(). The run() method is the main entry point for the activity and must always return $this. The next() must just return a reference to the next activity to be executed. You can do this by simply returning a string with the full namespace to the activity class or you can use the ::class approach to have php resolve that for you.

You have access to the current request $this->request, the response to be sent $this->response, and the current USSD session $this->session from within the activity as well. The request and response properties exposes all the properties of a USSD request and response respectively as documented here. The session property however is just an array. Note that the session is implemented on top of your existing Laravel cache. The session allows you to persist state throughout your USSD session. You can store a value in the session like so: $this->session['name'] = 'John Doe', and retrieve it elsewhere like so: $name = $this->session['name'].

Once you have created your activiy files, you need to set your entry point activity in the config file as shown in the next section.

Configuration

The defaults are set in config/hubtel-ussd.php. Copy this file to your own config directory to modify the values. You can publish the config using this command:

License

Released under the MIT License, see LICENSE.


All versions of hubtel-ussd-plugin-laravel with dependencies

PHP Build Version
Package Version
Requires nesbot/carbon Version ^1.22
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 jowusu837/hubtel-ussd-plugin-laravel contains the following files

Loading the files please wait ....