Download the PHP package akika/laravel-mpesa without Composer

On this page you can find all versions of the php package akika/laravel-mpesa. 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 laravel-mpesa

Laravel Mpesa Package by Akika Digital

This Laravel package provides convenient methods for integrating Mpesa Daraja API's functionalities into your Laravel application.

Installation

You can install the package via composer:

After installing the package, publish the configuration file using the following command:

This will generate a mpesa.php file in your config directory where you can set your Mpesa credentials and other configuration options.

.env file Setup

Add the following configurations into the .env file

NOTE: The mpesa.php config file sets the default MPESA_ENV value to sandbox. This will always load sandbox urls.

Function Responses

All responses, except the token generation response, conform to the responses documented on the daraja portal.

Usage

Initializing Mpesa

Fetching Token

You can fetch the token required for Mpesa API calls as follows:

Getting Account Balance

You can fetch mpesa account balance as follows:

C2B Transactions

Registering URLs for C2B Transactions

You can register validation and confirmation URLs for C2B transactions:

You can register the C2B URLs using the provided command below:

The above command requires you to have set the below variables in your env or in the config file:

Simulating C2B Transactions

You can simulate payment requests from clients:

Initiating STK Push

You can initiate online payment on behalf of a customer:

Querying STK Push Status

You can query the result of a STK Push transaction:

Reversing Transactions

You can reverse a C2B M-Pesa transaction:

Business to Customer (B2C) Transactions

You can perform Business to Customer transactions:

B2C Topup

This API enables you to load funds to a B2C shortcode directly for disbursement. The transaction moves money from your MMF/Working account to the recipient’s utility account.

Business to Business (B2B) Transactions

B2B Paybill

You can perform Business to Business transactions:

B2B Buy Goods

This api accepts variables as provided in section B2B Paybill above.

B2B Express Checkout

QR Code Generation

You can generate QR codes for making payments:

Bill Manager

You can optin to the bill manager service and send invoices:

Tax Remittance

You can remit tax to the government:

Mpesa Ratiba

The Standing Order APIs enable teams to integrate with the standing order solution by initiating a request to create a standing order on the customer profile.

Mpesa Transaction History

The following API takes in the start and and end dates and returns the transactions between that period.

Successful Response

API Response Body

$response has the following as a json object

Succssful result body

A successful result body has the following structure

Unsuccessful reusult body

An unsuccessful result body has the following structure

License

The Laravel Mpesa package is open-sourced software licensed under the MIT license. See the LICENSE file for details.


All versions of laravel-mpesa with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1|^8.2
illuminate/support Version ^8.0 | ^9.0 | ^10.0 | ^11.0
illuminate/http Version ^8.0 | ^9.0 | ^10.0 | ^11.0
guzzlehttp/guzzle Version ^7.5
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 akika/laravel-mpesa contains the following files

Loading the files please wait ....