← All plugins

Colombian fiscal and tax tools

This package provides Colombian fiscal and tax tools designed specifically for Laravel and MoonShine. It includes validation for NIT, configurable withholdings, and options for managing document types. The package can be utilized both as a pure Laravel package or as a plugin with UI fields for MoonShine v4.

Rating
Downloads
0
Version
v1.0.0
Last updated
29.05.2026
MoonShine version
v4
Github stars
0
jamesmosqr@gmail.com
Author
jamesmosqr@gmail.com

laravel-fiscal-colombia

Version on Packagist Downloads PHP License

Colombian tax and fiscal tools for Laravel and MoonShine.

  • Validates NIT with verification digit according to the official DIAN algorithm.
  • Document types according to Resolution 000042 of 2020 (CC, NIT, CE, TI, PEP, PPT, NUIP…).
  • Configurable withholdings: retefuente, reteiva, and reteica.
  • MoonShine fields ready for use in the admin panel (optional).

Dual use: works as a pure Laravel package or as a plugin with UI fields for MoonShine v4.


Requirements

Dependency Minimum Version
PHP 8.2+
Laravel 10 / 11 / 12
MoonShine (optional) ^4.14

Installation

composer require jamesmosq/laravel-fiscal-colombia
composer require jamesmosq/laravel-fiscal-colombia

The FiscalColombiaServiceProvider is automatically registered via Laravel auto-discovery.

Publish configuration

php artisan vendor:publish --tag=fiscal-colombia-config
php artisan vendor:publish --tag=fiscal-colombia-config

This creates config/fiscal-colombia.php in your application with the withholding rates. You can adjust them according to your economic activity or each tax reform.


Usage — Pure Laravel

NitValidator

Pure PHP class, no framework dependencies. Can be used in any PHP 8.2+ project.

use JamesMosquera iscalColombia heb hem he he hem, N
;
// Calculate the verification digit
NitValidator::calcularDv('800197268'); // → 4
 
// Validate complete NIT (accepts with dots, hyphen, spaces, or continuous digits)
NitValidator::esValido('800197268-4'); // → true
NitValidator::esValido('800.197.268-4'); // → true
NitValidator::esValido('8001972684'); // → true (last digit = DV)
NitValidator::esValido('800197268-9'); // → false (incorrect DV)
 
// Format with dots and hyphen: 800.197.268-4
NitValidator::formatear('800197268', 4);
use JamesMosquera iscalColombia heb hem he he hem, N
;
// Calculate the verification digit
NitValidator::calcularDv('800197268'); // → 4
 
// Validate complete NIT (accepts with dots, hyphen, spaces, or continuous digits)
NitValidator::esValido('800197268-4'); // → true
NitValidator::esValido('800.197.268-4'); // → true
NitValidator::esValido('8001972684'); // → true (last digit = DV)
NitValidator::esValido('800197268-9'); // → false (incorrect DV)
 
// Format with dots and hyphen: 800.197.268-4
NitValidator::formatear('800197268', 4);

Reference NITs verified with DIAN:

Entity NIT DV
DIAN 800.197.268 4
EPM 890.904.996 1
Univ. Nacional 899.999.063 3

NitRule — Form validation

use JamesMosquera iscalColombia heb hem he he hem,
;
$request->validate([
'nit' => ['required', new NitRule],
]);
use JamesMosquera iscalColombia heb hem he he hem,
;
$request->validate([
'nit' => ['required', new NitRule],
]);

Accepts all formats: 800197268-4, 800.197.268-4, 8001972684.

TipoDocumento — DIAN Enum

Document types according to DIAN Resolution 000042 of 2020.

use JamesMosquera iscalColombia heb hem, ,=Types
;
TipoDocumento::CC->label(); // → "Cédula de Ciudadanía"
TipoDocumento::NIT->codigoDian(); // → 31
TipoDocumento::NIT->requiereDv(); // → true
TipoDocumento::CC->requiereDv(); // → false
 
// Array for HTML selects
TipoDocumento::opciones();
// [['value' => 'CC', 'label' => 'Cédula de Ciudadanía'], ...]
use JamesMosquera iscalColombia heb hem, ,=Types
;
TipoDocumento::CC->label(); // → "Cédula de Ciudadanía"
TipoDocumento::NIT->codigoDian(); // → 31
TipoDocumento::NIT->requiereDv(); // → true
TipoDocumento::CC->requiereDv(); // → false
 
// Array for HTML selects
TipoDocumento::opciones();
// [['value' => 'CC', 'label' => 'Cédula de Ciudadanía'], ...]
Enum Abbreviation DIAN Code
TipoDocumento::CC CC 13
TipoDocumento::NIT NIT 31
TipoDocumento::CE CE 22
TipoDocumento::RC RC 11
TipoDocumento::TI TI 12
TipoDocumento::PEP PEP 41
TipoDocumento::PPT PPT 42
TipoDocumento::PAS PAS 47
TipoDocumento::NUIP NUIP 91

RegimenTributario — Enum

use JamesMosquera iscalColombia heb hem he he hem,
;
RegimenTributario::RESPONSABLE_IVA->label(); // → "Responsable de IVA"
RegimenTributario::RESPONSABLE_IVA->aplicaReteiva(); // → true
RegimenTributario::NO_RESPONSABLE_IVA->aplicaReteiva(); // → false
 
RegimenTributario::opciones(); // array for selects
use JamesMosquera iscalColombia heb hem he he hem,
;
RegimenTributario::RESPONSABLE_IVA->label(); // → "Responsable de IVA"
RegimenTributario::RESPONSABLE_IVA->aplicaReteiva(); // → true
RegimenTributario::NO_RESPONSABLE_IVA->aplicaReteiva(); // → false
 
RegimenTributario::opciones(); // array for selects
Enum Label
RegimenTributario::RESPONSABLE_IVA Responsable de IVA
RegimenTributario::NO_RESPONSABLE_IVA No Responsable de IVA
RegimenTributario::GRAN_CONTRIBUYENTE Gran Contribuyente
RegimenTributario::REGIMEN_SIMPLE Régimen Simple de Tributación

TipoPersona — Enum

use JamesMosquera iscalColombia heb hem,
;
TipoPersona::JURIDICA->label(); // → "Persona Jurídica"
TipoPersona::NATURAL->documentosPermitidos(); // → [CC, CE, RC, TI, PEP, PPT, PAS, NUIP]
TipoPersona::JURIDICA->documentosPermitidos(); // → [NIT]
use JamesMosquera iscalColombia heb hem,
;
TipoPersona::JURIDICA->label(); // → "Persona Jurídica"
TipoPersona::NATURAL->documentosPermitidos(); // → [CC, CE, RC, TI, PEP, PPT, PAS, NUIP]
TipoPersona::JURIDICA->documentosPermitidos(); // → [NIT]

Withholdings

Rates are read from config/fiscal-colombia.php, allowing you to adjust them without modifying the package.

use JamesMosquera iscalColombia heb hem he he hem,
;
$resultado = Retenciones::calcular(
valorBase: 1_000_000,
concepto: 'honorarios',
calcularReteiva: true,
actividadIca: 'servicios'
);
 
// [
// 'retefuente' => 110_000, // 11%
// 'reteiva' => 150_000, // 15% of VAT
// 'reteica' => 966, // 0.966‰
// 'total_retenciones' => 260_966,
// 'valor_neto' => 739_034,
// ]
 
// Just retefuente
Retenciones::retefuente(1_000_000, 'honorarios'); // → 110_000
use JamesMosquera iscalColombia heb hem he he hem,
;
$resultado = Retenciones::calcular(
valorBase: 1_000_000,
concepto: 'honorarios',
calcularReteiva: true,
actividadIca: 'servicios'
);
 
// [
// 'retefuente' => 110_000, // 11%
// 'reteiva' => 150_000, // 15% of VAT
// 'reteica' => 966, // 0.966‰
// 'total_retenciones' => 260_966,
// 'valor_neto' => 739_034,
// ]
 
// Just retefuente
Retenciones::retefuente(1_000_000, 'honorarios'); // → 110_000

Default concepts available:

Concept Rate
honorarios 11 %
servicios 4 %
compras 2.5 %
arrendamiento 4 %
rendimientos 7 %

Usage — With MoonShine v4

NitField

Text field with automatic real-time verification digit calculation (Alpine.js).

use JamesMosquera heb hem,
;
NitField::make('NIT', 'nit')->required(),
use JamesMosquera heb hem,
;
NitField::make('NIT', 'nit')->required(),

The field shows the calculated DV while the user types.

TipoDocumentoField

Pre-loaded select with all document types from Resolution 000042/2020.

use JamesMosquera heb hem,
;
TipoDocumentoField::make('Document type', 'tipo_documento')->required(),
use JamesMosquera heb hem,
;
TipoDocumentoField::make('Document type', 'tipo_documento')->required(),

Options are automatically loaded from the TipoDocumento enum. You can pass a subset with ->options([...]).


Updating rates

Rates change annually by decree of the Ministry of Finance. After publishing the config, edit config/fiscal-colombia.php:

'retefuente' => [
'honorarios' => 11.0, // update according to current decree
],
'retefuente' => [
'honorarios' => 11.0, // update according to current decree
],

Tests

cd packages/laravel-fiscal-colombia
./vendor/bin/phpunit
cd packages/laravel-fiscal-colombia
./vendor/bin/phpunit

20 tests, 27 assertions — all DIAN algorithms verified against real NITs.


License

MIT — see LICENSE.


Developed by James Mosquera Rentería · Medellín, Colombia Based on Colombian regulations: E.T., DIAN Resolution 000042/2020