PHPackages                             zahidaramai/laravel-myinvois-middleware - 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. zahidaramai/laravel-myinvois-middleware

ActiveLibrary[API Development](/categories/api)

zahidaramai/laravel-myinvois-middleware
=======================================

Laravel client SDK for the MyInvois Middleware Gateway (MyInvois API 1.0). Provides clean PHP integration layer for submitting e-invoices, sessions, submissions, status polling, and TIN validation via Zahid Aramai's MyInvois Middleware.

00PHP

Since Dec 27Pushed 6mo agoCompare

[ Source](https://github.com/zahidaramai/laravel-myinvois-middleware)[ Packagist](https://packagist.org/packages/zahidaramai/laravel-myinvois-middleware)[ RSS](/packages/zahidaramai-laravel-myinvois-middleware/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel MyInvois Middleware
===========================

[](#laravel-myinvois-middleware)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c9c9f1229f93b7bf69424071a8e27163d73eda996a7758d9419f4b89a4d74a97/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a616869646172616d61692f6c61726176656c2d6d79696e766f69732d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zahidaramai/laravel-myinvois-middleware)[![Total Downloads](https://camo.githubusercontent.com/2f07a7f9e89add2caf612bf7de0982ae953db857fe1d49151801a6eaa6dc7140/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a616869646172616d61692f6c61726176656c2d6d79696e766f69732d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zahidaramai/laravel-myinvois-middleware)[![License](https://camo.githubusercontent.com/a620e634b447c0b77073161fc862b47ea0358c8cd4f8bb745241283297514c5e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a616869646172616d61692f6c61726176656c2d6d79696e766f69732d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zahidaramai/laravel-myinvois-middleware)

Laravel client SDK for the MyInvois Middleware Gateway (MyInvois API 1.0). Provides a clean PHP integration layer for submitting e-invoices, managing sessions, tracking submissions, polling status, and validating TINs via Zahid Aramai's MyInvois Middleware.

Features
--------

[](#features)

- Simple and intuitive API for MyInvois operations
- Facade and dependency injection support
- Configurable via environment variables
- Zero business logic duplication - purely a middleware client
- Full support for Laravel 10 and 11
- Auto-discovery ready

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.x or 11.x
- Guzzle HTTP 7.x

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require zahidaramai/laravel-myinvois-middleware
```

The package will auto-register its service provider and facade.

### Publish Configuration

[](#publish-configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=myinvois-config
```

This will create a `config/myinvois.php` file in your application.

Configuration
-------------

[](#configuration)

Add the following environment variables to your `.env` file:

```
MYINVOIS_MIDDLEWARE_BASE_URL=https://your-middleware-server.com
MYINVOIS_MIDDLEWARE_API_KEY=your-api-key-here
MYINVOIS_MIDDLEWARE_TIMEOUT=30
MYINVOIS_MIDDLEWARE_CONNECT_TIMEOUT=10
MYINVOIS_MIDDLEWARE_VERIFY_SSL=true
```

### Configuration Options

[](#configuration-options)

VariableDescriptionDefault`MYINVOIS_MIDDLEWARE_BASE_URL`Base URL of your MyInvois Middleware Gateway`http://localhost:8000``MYINVOIS_MIDDLEWARE_API_KEY`API key for authentication`null``MYINVOIS_MIDDLEWARE_TIMEOUT`Request timeout in seconds`30``MYINVOIS_MIDDLEWARE_CONNECT_TIMEOUT`Connection timeout in seconds`10``MYINVOIS_MIDDLEWARE_VERIFY_SSL`Verify SSL certificates`true`Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use ZahidAramai\MyInvoisMiddleware\Facades\MyInvois;

// Create a session
$session = MyInvois::createSession();

// Submit documents (e-invoices)
$documents = [
    [
        'type' => 'invoice',
        'data' => [
            'invoiceNumber' => 'INV-001',
            'amount' => 1000.00,
            // ... other invoice fields
        ],
    ],
];

$submission = MyInvois::submitDocuments($documents);

// Get submission status
$status = MyInvois::getSubmission($submission['submission_id']);

// Validate a TIN
$validation = MyInvois::validateTin(
    tin: 'C12345678901',
    idType: 'BRN',
    idValue: '202001012345'
);

// Get all submissions with filters
$submissions = MyInvois::getSubmissions([
    'status' => 'completed',
    'page' => 1,
]);

// Cancel a document
$result = MyInvois::cancelDocument('document-uuid', 'Customer requested cancellation');
```

### Using Dependency Injection

[](#using-dependency-injection)

```
use ZahidAramai\MyInvoisMiddleware\MyInvoisClient;

class InvoiceController extends Controller
{
    public function __construct(
        protected MyInvoisClient $myInvois
    ) {}

    public function submit(Request $request)
    {
        $documents = $this->prepareDocuments($request);

        $result = $this->myInvois->submitDocuments($documents);

        return response()->json([
            'submission_id' => $result['submission_id'],
            'status' => $result['status'],
        ]);
    }

    public function status(string $submissionId)
    {
        $status = $this->myInvois->getSubmission($submissionId);

        return response()->json($status);
    }
}
```

### Available Methods

[](#available-methods)

MethodDescription`createSession(array $params = [])`Create a new session with the middleware`submitDocuments(array $documents, array $options = [])`Submit e-invoices for processing`getSubmission(string $submissionId, array $queryParams = [])`Get status of a specific submission`getSubmissions(array $filters = [])`List submissions with optional filters`validateTin(string $tin, string $idType, string $idValue)`Validate a Tax Identification Number`getDocument(string $submissionId, string $documentId)`Get a specific document details`cancelDocument(string $documentId, string $reason)`Cancel a submitted document`getHttpClient()`Get the underlying Guzzle HTTP clientError Handling
--------------

[](#error-handling)

The client throws Guzzle exceptions for HTTP errors. Handle them appropriately:

```
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ServerException;
use ZahidAramai\MyInvoisMiddleware\Facades\MyInvois;

try {
    $result = MyInvois::submitDocuments($documents);
} catch (ClientException $e) {
    // 4xx errors - client-side issue
    $response = $e->getResponse();
    $body = json_decode($response->getBody()->getContents(), true);

    Log::error('MyInvois client error', [
        'status' => $response->getStatusCode(),
        'body' => $body,
    ]);
} catch (ServerException $e) {
    // 5xx errors - server-side issue
    Log::error('MyInvois server error', [
        'message' => $e->getMessage(),
    ]);
}
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Changelog
---------

[](#changelog)

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

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Zahid Aramai](https://github.com/zahidaramai)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance47

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22869261?v=4)[Zahid Aramai](/maintainers/zahidaramai)[@zahidaramai](https://github.com/zahidaramai)

---

Top Contributors

[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (1 commits)")

### Embed Badge

![Health badge](/badges/zahidaramai-laravel-myinvois-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/zahidaramai-laravel-myinvois-middleware/health.svg)](https://phpackages.com/packages/zahidaramai-laravel-myinvois-middleware)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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