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

ActiveLibrary[API Development](/categories/api)

novaday-co/moadian
==================

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

v1.2.0(1y ago)0140[1 PRs](https://github.com/novaday-co/moadian/pulls)GPL-3.0PHPPHP ^7.4|^8.0

Since May 3Pushed 1y agoCompare

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

READMEChangelog (1)Dependencies (8)Versions (19)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

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.

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

[](#requirements)

This package requires Laravel 8 and PHP 7.4 or higher.

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

[](#installation)

To install this package, simply run the following command:

```
composer require novaday-co/moadian
```

Usage
-----

[](#usage)

To use this package, you will need to obtain a username, private key and certificate from [intamedia.ir](https://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

```

Note

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 Novaday\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 Novaday\Moadian\Invoice as MoadianInvoice;
use Novaday\Moadian\InvoiceHeader;
use Novaday\Moadian\InvoiceItem;
use Novaday\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/novaday-co/moadian/issues) or [create a pull request](https://github.com/novaday-co/moadian/pulls).

License
-------

[](#license)

This package is open source software licensed under the [GPL-3.0 license](./LICENSE).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.6% 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 ~39 days

Recently: every ~114 days

Total

14

Last Release

598d ago

Major Versions

v0.6 → v1.02023-05-21

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

PHP version history (2 changes)v0.1PHP ^7.4|^8.0

v1.x-devPHP ^7.1|^8.0

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laravelmoadianintamedia

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[laravel/socialite

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

5.7k96.9M674](/packages/laravel-socialite)[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)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[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)[jooyeshgar/moadian

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

395.7k](/packages/jooyeshgar-moadian)

PHPackages © 2026

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