PHPackages                             jooyeshgar/moadian - 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. jooyeshgar/moadian

ActiveLibrary[API Development](/categories/api)

jooyeshgar/moadian
==================

Laravel package for interacting with the Moadian API of intamedia.ir

v2.0.1(1y ago)395.7k—0%15[13 issues](https://github.com/Jooyeshgar/moadian/issues)[1 PRs](https://github.com/Jooyeshgar/moadian/pulls)GPL-3.0PHPPHP ^7.4|^8.0

Since May 3Pushed 1y ago5 watchersCompare

[ Source](https://github.com/Jooyeshgar/moadian)[ Packagist](https://packagist.org/packages/jooyeshgar/moadian)[ Docs](https://github.com/Jooyeshgar/moadian)[ RSS](/packages/jooyeshgar-moadian/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (17)Used By (0)

Laravel Moadian API Driver (API Only)
=====================================

[](#laravel-moadian-api-driver-api-only)

This Laravel package provides a convenient way to interact with the API of the "Moadian system" (سامانه مودیان) offered by intamedia.ir. With this package, you can easily make requests to the Moadian API and handle the responses in your Laravel application.

**Important Notice:** This package provides access to the Moadian system API and is not intended for direct user interaction. It's designed for developers integrating Moadian functionality into their applications.

For a user-friendly accounting software experience, we recommend checking out our FreeAmin project (under **development**):

- Link:

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

[](#requirements)

This package requires Laravel 8 or higher. It has been tested with Laravel 8 and PHP 7.4, as well as with Laravel 10 and PHP 8.1.

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

[](#installation)

To install this package, simply run the following command:

```
composer require jooyeshgar/moadian
```

Usage
-----

[](#usage)

To use this package, you will need to obtain a username, private key and certificate from intamedia.ir. Once you have your credentials, you can configure the package in your Laravel application's `.env` file:

```
MOADIAN_USERNAME=your-username-here
MOADIAN_PRIVATE_KEY_PATH=/path/to/private.pem
MOADIAN_CERTIFICATE_PATH=/path/to/certificate.crt

```

The default location to store the private key is: storage\_path('app/keys/private.pem');
The default location to store the certificate is: storage\_path('app/keys/certificate.crt');

You can then use the `Moadian` facade to interact with the Moadian API. Here are some examples:

```
use Jooyeshgar\Moadian\Facades\Moadian;

// Get server info
$info = Moadian::getServerInfo();

// Get fiscal info
$fiscalInfo = Moadian::getFiscalInfo();

// Get economic code information
$info = Moadian::getEconomicCodeInformation('10840096498');

// Inquiry by reference numbers
$info = Moadian::inquiryByReferenceNumbers('a45aa663-6888-4025-a89d-86fc789672a0');
```

### Send Invoice

[](#send-invoice)

To send an invoice to Moadian, you can use the sendInvoice() method provided by the plugin. Here's an example of how to use it:

```
use Jooyeshgar\Moadian\Invoice as MoadianInvoice;
use Jooyeshgar\Moadian\InvoiceHeader;
use Jooyeshgar\Moadian\InvoiceItem;
use Jooyeshgar\Moadian\Payment;

public function sendInvoice($invoiceId = '') {
    $invoiceId = intval($invoiceId);
    $invoice = Invoice::find($invoiceId);

    if (!$invoice) {
        throw new Exception('Invoice not found');
    }

    $timestamp = Carbon::parse($invoice->date)->timestamp * 1000;

    $header = new InvoiceHeader(env('MOADIAN_USERNAME'));
    $header->setTaxID(Carbon::parse($invoice->date), $invoice->number);
    $header->indati2m = $timestamp;
    $header->indatim = $timestamp;
    $header->inty = 1; //invoice type
    $header->inno = $invoiceId;
    $header->irtaxid = null; // invoice reference tax ID
    $header->inp = $invoice->inp; //invoice pattern
    $header->ins = 1;
    $header->tins = env('TAXID');
    $header->tob = 2;
    $header->bid = $invoice->nationalnum;
    $header->tinb = $invoice->nationalnum;
    $header->bpc = $invoice->postal;

    $amount   = $invoice->items->sum('amount');
    $discount = $invoice->items->sum('discount');
    $vat      = $invoice->items->sum('vat');
    $header->tprdis = $amount;
    $header->tdis = $discount;
    $header->tadis = $amount - $discount;
    $header->tvam = $vat;
    $header->todam = 0;
    $header->tbill = $amount - $discount + $vat;
    $header->setm = $invoice->setm;
    $header->cap = $amount - $discount + $vat;

    $moadianInvoice = new MoadianInvoice($header);

    foreach ($invoice->items as $item) {
        $body = new InvoiceItem();
        $body->sstid = $item->seals->sstid;
        $body->sstt = $item->desc;
        $body->am = '1';
        $body->mu = 1627;
        $body->fee = $item->amount;
        $body->prdis = $item->amount;
        $body->dis = $item->discount;
        $body->adis = $item->amount - $item->discount;
        $body->vra = 9;
        $body->vam = $item->vat; // or directly calculate here like floor($body->adis * $body->vra / 100)
        $body->tsstam = $item->amount - $item->discount + $item->vat;
        $moadianInvoice->addItem($body);
    }

    foreach ($invoice->cashes as $cashe) {
        if ($cashe->active == 1) {
            $payment = new Payment();
            $payment->trn = $cashe->code;
            $payment->pdt = Carbon::parse($cashe->date)->timestamp * 1000;
            $moadianInvoice->addPayment($payment);
        }
    }

    $info = Moadian::sendInvoice($moadianInvoice);
    $info = $info->getBody();
    $info = $info['result'][0];

    $invoice->taxID           = $header->taxid;
    $invoice->uid             = $info['uid'] ?? '';
    $invoice->referenceNumber = $info['referenceNumber'] ?? '';
    $invoice->taxResult       = 'send';

    $invoice->save();
}
```

Note that you need to have a valid Moadian account and credentials to use this plugin.

There are other types of invoices (Cancellation, corrective, Sales return) that you can send with this package. For more information about different types of invoices and how to send them, please refer to the official document.

Useful Links
------------

[](#useful-links)

- [The regulation of store terminals](https://www.intamedia.ir/The-regulation-of-store-terminals)
- [Guide to extract public key from digital signature](https://www.intamedia.ir/The-regulation-of-store-terminals/ID/15879/%D8%B1%D8%A7%D9%87%D9%86%D9%85%D8%A7%DB%8C-%D8%A7%D8%B3%D8%AA%D8%AE%D8%B1%D8%A7%D8%AC-%DA%A9%D9%84%DB%8C%D8%AF-%D8%B9%D9%85%D9%88%D9%85%DB%8C-%D8%A7%D8%B2-%D8%A7%D9%85%D8%B6%D8%A7%DB%8C-%D8%AF%DB%8C%D8%AC%DB%8C%D8%AA%D8%A7%D9%84%D9%85%D9%87%D8%B1%D8%B3%D8%A7%D8%B2%D9%85%D8%A7%D9%86%DB%8C-%D9%88-%D8%A8%D8%A7%D8%B1%DA%AF%D8%B0%D8%A7%D8%B1%DB%8C-%D8%A2%D9%86-%D8%AF%D8%B1-%DA%A9%D8%A7%D8%B1%D9%BE%D9%88%D8%B4%D9%87-%D8%B3%D8%A7%D9%85%D8%A7%D9%86%D9%87-%D9%85%D9%88%D8%AF%DB%8C%D8%A7%D9%86)

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

[](#contributing)

If you find a bug or would like to contribute to this package, please feel free to [submit an issue](https://github.com/Jooyeshgar/moadian/issues) or [create a pull request](https://github.com/Jooyeshgar/moadian/pulls).

License
-------

[](#license)

This package is open source software licensed under the [GPL-3.0 license](https://opensource.org/licenses/GPL-3.0).

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.3% 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 ~38 days

Recently: every ~110 days

Total

14

Last Release

615d ago

Major Versions

v0.6 → v1.02023-05-21

V1.1.2 → v2.0.0-beta2023-10-18

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9395832?v=4)[Hadi](/maintainers/hadi60)[@hadi60](https://github.com/hadi60)

---

Top Contributors

[![hbhossein](https://avatars.githubusercontent.com/u/52930093?v=4)](https://github.com/hbhossein "hbhossein (38 commits)")[![hadi60](https://avatars.githubusercontent.com/u/9395832?v=4)](https://github.com/hadi60 "hadi60 (30 commits)")[![amizayi](https://avatars.githubusercontent.com/u/68772394?v=4)](https://github.com/amizayi "amizayi (1 commits)")[![hosseinjarrahi](https://avatars.githubusercontent.com/u/37629053?v=4)](https://github.com/hosseinjarrahi "hosseinjarrahi (1 commits)")

---

Tags

laravelmoadianintamedia

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jooyeshgar-moadian/health.svg)

```
[![Health](https://phpackages.com/badges/jooyeshgar-moadian/health.svg)](https://phpackages.com/packages/jooyeshgar-moadian)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k96.9M674](/packages/laravel-socialite)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k12.2M45](/packages/knuckleswtf-scribe)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[packbackbooks/lti-1p3-tool

A library used for building IMS-certified LTI 1.3 tool providers in PHP.

51438.3k2](/packages/packbackbooks-lti-1p3-tool)

PHPackages © 2026

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