shahkochaki / moadian
Laravel package for interacting with the Iranian Tax Authority (Moadian) API
dev-main
2026-04-19 13:20 UTC
Requires
- php: ^7.4|^8.0
- ext-openssl: *
- firebase/php-jwt: ^6.9
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
- nesbot/carbon: ^2.0|^3.0
- phpseclib/phpseclib: ^3.0
- ramsey/uuid: ^4.2
- symfony/cache: ^5.3|^6.0
Requires (Dev)
- mockery/mockery: ^1.5
- orchestra/testbench: ^6.0|^7.0|^8.0|^9.0
- phpunit/phpunit: ^9.0 || ^10.0
This package is auto-updated.
Last update: 2026-04-19 13:21:42 UTC
README
Laravel Moadian - Iranian Tax Authority API
A professional Laravel package for seamless integration with the Iranian Tax Authority (سامانه مودیان) API. Handles authentication, digital signing, encryption, invoice submission, and inquiry all out of the box.
Features
- Send invoices to the Moadian system with full JWS/JWE signing and encryption
- Inquiry by UID or reference number
- Get fiscal info and registration code information
- Automatic token management with nonce
- Supports encrypted private keys (password-protected .pem files)
- Laravel Facade support for clean, expressive syntax
- Laravel auto-discovery (no manual provider registration)
Requirements
| Dependency | Version |
|---|---|
| PHP | ^7.4 or ^8.0 |
| Laravel | ^8.0, ^9.0, ^10.0, or ^11.0 |
| ext-openssl | * |
Installation
Install via Composer:
composer require shahkochaki/moadian-iranian-tax
The service provider and facade are registered automatically via Laravel package auto-discovery.
Publish the config file
php artisan vendor:publish --provider="Shahkochaki\Moadian\MoadianServiceProvider" --tag=config
Configuration
Add the following variables to your .env file:
MOADIAN_USERNAME=your-username-here # Path to your private key file (default: storage/app/keys/private.pem) MOADIAN_PRIVATE_KEY_PATH=/path/to/private.pem # Optional: password for encrypted private key MOADIAN_PRIVATE_KEY_PASSWORD=your-private-key-password # Path to your certificate file (default: storage/app/keys/certificate.crt) MOADIAN_CERTIFICATE_PATH=/path/to/certificate.crt # Optional: override the API base URL MOADIAN_BASE_URI=https://tp.tax.gov.ir/requestsmanager/api/v2/
Default key locations:
- Private key:
storage_path('app/keys/private.pem')- Certificate:
storage_path('app/keys/certificate.crt')
Usage
Use the Moadian facade anywhere in your application:
use Shahkochaki\Moadian\Facades\Moadian;
Get Server Info
$ esponse = Moadian::getServerInfo(); if ($ esponse->isSuccessful()) { $data = $ esponse->getBody(); }
Get Fiscal Info
$ esponse = Moadian::getFiscalInfo();
Get Registration Code Information
// 11 digits for legal entities, 14 digits for natural persons $ esponse = Moadian::getRegistrationCodeInformation('12345678901');
Inquiry by UID
$ esponse = Moadian::inquiryByUid( uid: 'your-uid', start: '2023-05-14T00:00:00.000000000+03:30', end: '2023-05-14T23:59:59.123456789+03:30' );
Inquiry by Reference Number
$ esponse = Moadian::inquiryByReferenceNumbers('your-reference-number');