Download the PHP package akika/laravel-momo without Composer

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

Laravel MTN MoMo

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

An unofficial MTN MoMo integration for Laravel.

Installation

Install via Composer:

Optionally, publish the package config (and optional resources):

Configuration (.env)

You will need:

Set environment variables below in your .env:

Note:
When using sandbox mode, test using the Euro (EUR) currency, as that is the only currency that seems to work in sandbox mode.

For production, set:

The full config file is at config/momo.php.

Creating an API User

You can create an API user using the provided Artisan command. The command will use the configured secondary key and user reference id from your config, or prompt for them.

Interactive (recommended):

Non-interactive (useful for CI or scripts):

After success, the API user will be registered with MTN, and you can retrieve it via php artisan momo:get-api-user (if available) or using the library API.

Creating an API Key

To create an API key for the registered API user run:

The command prints the environment variable you should set (for example MOMO_SANDBOX_API_KEY=...). Add that value to your .env for the current environment.

You can also run non-interactively:

Transferring Funds (Disbursement)

Use the provided MoMo facade or the MoMo class directly to perform disbursements. The disbursement() product exposes transfer() and getTransferStatus().

Example using the facade:

The method returns a reference/transaction id (string). You may use any value you like for externalId, but using a UUID or unique invoice id is recommended.

Checking Transfer Status

Call getTransferStatus() with the reference id returned from transfer():

$status is an array containing the provider response including the status and any metadata:

Inspect the returned array for fields like status, financialTransactionId, etc.

Facade / Programmatic Usage

You can instantiate Akika\\MoMo\\MoMo directly or use the provided facade Akika\\MoMo\\Facades\\MoMo.

Example using Akika\\MoMo\\MoMo:

Example using Akika\\MoMo\\Facades\\MoMo facade:

Checking the Account Balance

You can retrieve the MoMo account balance via the Disbursement product. The method returns an array with the available balance and currency.

Example using the MoMo facade:

Example using the MoMo class directly:

Check the returned array for availableBalance and currency when handling the response.

Overriding configuration programmatically

You can override configuration values at runtime either by constructing a MoMoConfig and passing it to a product, or by using the with() helper on the MoMo facade to create a client with temporary overrides.

Example — instantiate MoMoConfig and pass it to the Disbursement product:

Example — use the with() helper on the facade to create a client with overrides:

Callbacks

You can register an endpoint in your application to receive MoMo callbacks (for example, transfer/disbursement notifications). Add the route to routes/api.php or routes/web.php depending on whether you want it under the api middleware group.

Example route (add to routes/api.php):

Notes:

Sample callback payload for a disbursement:

The route above logs the callback payload with Laravel's info() helper and responds with a JSON success message. Adjust handling according to your application's needs (update transfer status, notify users, etc.).

Tests

Run tests with:

Changelog

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

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). See LICENSE.md.


All versions of laravel-momo with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0
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-momo contains the following files

Loading the files please wait ...