PHPackages                             alvincoded/laravel-mtn-momo-ai - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. alvincoded/laravel-mtn-momo-ai

ActiveLibrary[API Development](/categories/api)

alvincoded/laravel-mtn-momo-ai
==============================

A Laravel package for integrating MTN Mobile Money API with AI capabilities

v1.2.0(1y ago)114[3 PRs](https://github.com/AlvinCoded/laravel-mtn-momo-ai/pulls)MITPHPPHP &gt;=8.1CI passing

Since Jan 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AlvinCoded/laravel-mtn-momo-ai)[ Packagist](https://packagist.org/packages/alvincoded/laravel-mtn-momo-ai)[ Docs](https://github.com/alvincoded/laravel-mtn-momo-ai)[ GitHub Sponsors](https://github.com/sponsors/alvincoded)[ RSS](/packages/alvincoded-laravel-mtn-momo-ai/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (15)Versions (8)Used By (0)

 Laravel MTN MOMO AI
=====================

[](#-laravel-mtn-momo-ai-)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9594a11c9f33d4a97ea4f5d649114ad17e90d11676e86a6cb4e7c9c2743dc5dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c76696e636f6465642f6c61726176656c2d6d746e2d6d6f6d6f2d61692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alvincoded/laravel-mtn-momo-ai)[![Code Style](https://github.com/alvincoded/laravel-mtn-momo-ai/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/alvincoded/laravel-mtn-momo-ai/actions/workflows/php-cs-fixer.yml)[![Security](https://github.com/alvincoded/laravel-mtn-momo-ai/actions/workflows/security.yml/badge.svg)](https://github.com/alvincoded/laravel-mtn-momo-ai/actions/workflows/security.yml)

A powerful Laravel package that integrates [MTN Mobile Money API](https://momodeveloper.mtn.com/) with AI capabilities, providing intelligent transaction analysis, fraud detection, and more!

Features 🌟
----------

[](#features-)

- 💳 Seamless integration with MTN MOMO API (Collections, Disbursements, Remittances)
- 🧠 AI-powered transaction analysis using multiple LLM models (ChatGPT, Claude, Gemini)
- 🕵️ Intelligent fraud detection
- 📊 Cash flow forecasting
- 🔄 Smart retry mechanisms for failed transactions
- 📝 Natural language command parsing
- 📈 Automated reporting
- ⏱️ Smart disbursement scheduling
- 🚨 Anomaly detection in transactions
- 🔧 API call optimization

Prerequisites
-------------

[](#prerequisites)

Before getting started with the MTN MOMO AI package, you'll need:

### MTN MOMO API Requirements

[](#mtn-momo-api-requirements)

1. **MTN MOMO Developer Account**

    - Sign up at [MTN MOMO Developer Portal](https://momodeveloper.mtn.com/signup)
    - Complete the verification process
    - Store your API credentials safely
2. **API Subscription**

    - Subscribe to one or more MTN MOMO products:
        - Collections
        - Disbursements
        - Remittances
    - Get your Subscription Key from your [developer profile](https://momodeveloper.mtn.com/developer)

### AI Model Requirements

[](#ai-model-requirements)

You'll need at least one of these API keys:

- OpenAI API Key (for ChatGPT)
- Anthropic API Key (for Claude)
- Google Gemini API Key (for Gemini)
- Deepseek API Key (for Deepseek)

### System Requirements

[](#system-requirements)

- PHP 8.1 or higher
- Laravel 9.x|10.x|11.x
- Composer

### Environment Setup

[](#environment-setup)

Make sure your server/hosting environment:

- Allows outbound HTTPS connections
- Has sufficient memory for AI operations
- Supports background job processing (for notifications)

Installation 📦
--------------

[](#installation-)

> **Requires [PHP 8.1+](https://php.net/releases/)**

You can install the package via composer:

```
composer require alvincoded/laravel-mtn-momo-ai
```

After installation, run the package's installation command:

```
php artisan mtn-momo-ai:install
```

This command will guide you through the setup process, including publishing the configuration file and setting up your environment variables.

Configuration ⚙️
----------------

[](#configuration-️)

The package configuration file will be published to `config/mtn-momo-ai.php`. You can modify the settings there or use environment variables in your `.env` file.

### Environment Variables

[](#environment-variables)

```
# MTN MOMO API Configuration
MTN_MOMO_API_USER=your_api_user_id # Randomly generated UUID
MTN_MOMO_API_KEY=your_api_key
MTN_MOMO_SUBSCRIPTION_KEY=your_subscription_key
MTN_MOMO_PROVIDER_CALLBACK_HOST=http://localhost
MTN_MOMO_BASE_URL=https://sandbox.momodeveloper.mtn.com
MTN_MOMO_ENVIRONMENT=sandbox
MTN_MOMO_DEFAULT_CURRENCY=EUR

# AI Model API Keys
OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key
GEMINI_API_KEY=your_gemini_key
DEEPSEEK_API_KEY=your_deepseek_key

# Default LLM Configuration
DEFAULT_LLM=ChatGPT
REPORTING_LLM=ChatGPT

# Alerting Configuration
MTN_MOMO_ALERT_EMAIL=alerts@example.com
```

Usage 🛠️
--------

[](#usage-️)

### Basic Usage

[](#basic-usage)

```
use AlvinCoded\MtnMomoAi\Facades\MtnMomoAi;

// Analyze a transaction
$analysis = MtnMomoAi::analyzeTransaction('transaction123');

// Request to pay
$result = MtnMomoAi::requestToPay(100, 'EUR', 'ext123', 'party123', 'Payment', 'Note');

// Transfer (Disbursement)
$result = MtnMomoAi::transfer(100, 'EUR', 'ext123', 'party123', 'Payment', 'Note');

// Remittance
$result = MtnMomoAi::remit(100, 'EUR', 'ext123', 'party123', 'Payment', 'Note');
```

### AI-Enhanced Features

[](#ai-enhanced-features)

```
// Detect fraud
$fraudAnalysis = MtnMomoAi::detectFraud($transactionData);

// Forecast cash flow
$forecast = MtnMomoAi::forecastCashFlow('1month');

// Parse natural language command
$result = MtnMomoAi::parseNaturalLanguageCommand('Send 100 EUR to John Doe');

// Generate report
$report = MtnMomoAi::generateReport($startDate, $endDate);

// Detect anomalies
$anomalies = MtnMomoAi::monitorTransactions();
```

### Currency Configuration

[](#currency-configuration)

```
// Using default currency
MtnMomoAi::scheduleDisbursement(100, 'recipient123');

// Specifying a different currency
MtnMomoAi::scheduleDisbursement(100, 'recipient123', 'EUR');
```

### Transaction Analysis

[](#transaction-analysis)

```
// Detailed transaction analysis
$analysis = MtnMomoAi::analyzeTransaction('transaction123');
// Returns AI-powered insights about the transaction

// Fraud detection with custom parameters
$fraudAnalysis = MtnMomoAi::detectFraud([
    'amount' => 1000,
    'currency' => 'EUR',
    'recipient' => 'user123',
    'timestamp' => now(),
    'location' => 'GH'
]);
```

### Smart Retry Mechanism

[](#smart-retry-mechanism)

```
// Retry failed transaction with AI-optimized strategy
$retryResult = MtnMomoAi::smartRetry([
    'product' => 'collection',
    'amount' => 100,
    'currency' => 'EUR',
    'externalId' => 'ext123',
    'partyId' => 'party123',
    'payerMessage' => 'Payment',
    'payeeNote' => 'Note'
]);
```

### Error Handling

[](#error-handling)

The package includes comprehensive error handling:

```
try {
    $result = MtnMomoAi::requestToPay(100, 'EUR', 'ext123', 'party123', 'Payment', 'Note');
} catch (\AlvinCoded\MtnMomoAi\Exceptions\MtnMomoApiException $e) {
    // Handle API-specific errors
    $errorDetails = $e->getResponseBody();
} catch (\Exception $e) {
    // Handle general errors
}
```

### AI Model Selection

[](#ai-model-selection)

```
// Use default model from config
$analysis = MtnMomoAi::analyzeTransaction('transaction123');

// Specify a particular model
$analysis = MtnMomoAi::analyzeTransaction('transaction123', 'Claude');
$fraudCheck = MtnMomoAi::detectFraud($transactionData, 'Gemini');
$forecast = MtnMomoAi::forecastCashFlow('1month', 'ChatGPT');
```

API Reference 📚
---------------

[](#api-reference-)

### MTN MOMO API Methods

[](#mtn-momo-api-methods)

- `requestToPay($amount, $currency, $externalId, $partyId, $payerMessage, $payeeNote)`
- `getCollectionTransactionStatus($referenceId)`
- `getAccountBalance()`
- `getAccountHolder($accountHolderId, $accountHolderIdType)`
- `transfer($amount, $currency, $externalId, $payee, $payerMessage, $payeeNote)`
- `getDisbursementTransactionStatus($referenceId)`
- `remit($amount, $currency, $externalId, $payee, $payerMessage, $payeeNote)`
- `getRemittanceTransactionStatus($referenceId)`

### AI-Enhanced Methods

[](#ai-enhanced-methods)

- `analyzeTransaction($transactionId)`
- `detectFraud($transactionData)`
- `smartRetry($failedTransaction)`
- `forecastCashFlow($timeframe)`
- `parseNaturalLanguageCommand($command)`
- `generateReport($startDate, $endDate)`
- `scheduleDisbursement($amount, $recipient)`
- `monitorTransactions()`
- `optimizeApiCalls($endpoint)`
- `handleError($errorCode, $context)`

Testing 🧪
---------

[](#testing-)

To run the package tests:

```
composer test
```

Contributing 🤝
--------------

[](#contributing-)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

Security 🔒
----------

[](#security-)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits 👏
---------

[](#credits-)

- OpenAI PHP by [Nuno Maduro](https://github.com/openai-php/laravel)
- Anthropic Laravel by [Mozex](https://github.com/mozex/anthropic-laravel)
- Gemini PHP for Laravel by [Fatih AYDIN](https://github.com/google-gemini-php/laravel)
- DeepSeek PHP Client by [Omar AlAlwi](https://github.com/deepseek-php/deepseek-php-client)

License 📄
---------

[](#license-)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Support 💬
---------

[](#support-)

For support, please open an issue in the GitHub repository.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance46

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Total

3

Last Release

475d ago

PHP version history (3 changes)v1.0.0-betaPHP ^8.1

v1.1.0PHP ^8.1|^8.2

v1.2.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/8d379c04911007be24e6b04ca9d4dcbcf549b58aecfbae5a78a4295bc4ba58e7?d=identicon)[AlvinCoded](/maintainers/AlvinCoded)

---

Top Contributors

[![AlvinCoded](https://avatars.githubusercontent.com/u/112624931?v=4)](https://github.com/AlvinCoded "AlvinCoded (47 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")

---

Tags

artifiical-intelligenceclaudedeepseekdeepseek-apigeminigptlaravelllmmtnmtn-mobile-moneymtnmobilemoneymtnmomoapilaravelaiGeminiclaudegptartificial intelligencemobile-moneymtn

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/alvincoded-laravel-mtn-momo-ai/health.svg)

```
[![Health](https://phpackages.com/badges/alvincoded-laravel-mtn-momo-ai/health.svg)](https://phpackages.com/packages/alvincoded-laravel-mtn-momo-ai)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)[claude-php/claude-php-sdk-laravel

Laravel integration for the Claude PHP SDK - Anthropic Claude API

5010.8k](/packages/claude-php-claude-php-sdk-laravel)[hosseinhezami/laravel-gemini

A production-ready Laravel package to integrate with the Google Gemini API. Supports text, image, video, audio, long-context, structured output, files, caching, function-calling and understanding capabilities.

14010.8k1](/packages/hosseinhezami-laravel-gemini)[gemini-api-php/laravel

Gemini API client for Laravel

8915.7k](/packages/gemini-api-php-laravel)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
