PHPackages                             dazza-dev/dgt-cr-sender - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. dazza-dev/dgt-cr-sender

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

dazza-dev/dgt-cr-sender
=======================

Paquete para enviar documentos electrónicos (Factura, Nota crédito, Nota débito y Tiquete Electrónico) al Ministerio de Hacienda (Costa Rica).

v1.0.0(5mo ago)071MITPHPPHP &gt;=8.0

Since Nov 26Pushed 5mo agoCompare

[ Source](https://github.com/dazza-dev/dgt-cr-sender)[ Packagist](https://packagist.org/packages/dazza-dev/dgt-cr-sender)[ RSS](/packages/dazza-dev-dgt-cr-sender/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

DGT Sender 🇨🇷
=============

[](#dgt-sender-)

Paquete para enviar documentos electrónicos (Factura, Nota crédito, Nota débito y Tiquete Electrónico) al Ministerio de Hacienda (Costa Rica).

Instalación
-----------

[](#instalación)

```
composer require dazza-dev/dgt-cr-sender
```

Uso
---

[](#uso)

```
use DazzaDev\DgtCrSender\Sender;

// Instanciar el sender
$sender = new Sender();

// Entorno de pruebas (true para pruebas, false para producción)
$sender->setTestMode(true);
```

### Token de acceso

[](#token-de-acceso)

```
$token = $sender->auth('usuario_api', 'clave_api');
```

El método `auth` retorna un arreglo con `access_token` y `refresh_token`. El `access_token` tiene una duración de 5 minutos y el `refresh_token` de 10 horas. Si el `access_token` vence, puedes generar uno nuevo usando el `refresh_token` asi:

```
$newToken = $sender->renewToken($token['refresh_token']);
```

Si vas a reutilizar los tokens en solicitudes futuras, almacénalos y configúralos en el `sender`:

```
$sender->setBearerToken($token['access_token']);
$sender->setRefreshToken($token['refresh_token']);
```

Para cerrar la sesión al finalizar el proceso:

```
$sender->logout($token['refresh_token']);
```

### Emisor y Receptor

[](#emisor-y-receptor)

Para realizar operaciones con los documentos electrónicos, debes configurar el emisor y receptor:

```
// Setear Emisor
$sender->setIssuer([
    'identification_type' => '02',
    'identification_number' => 'identification_del_emisor',
]);

// Setear Receptor
$sender->setReceiver([
    'identification_type' => '02',
    'identification_number' => 'identification_del_receptor',
]);
```

### Callback URL

[](#callback-url)

Para recibir notificaciones sobre el estado de los documentos enviados, debes configurar una URL de callback:

```
$sender->setCallbackUrl('https://tu-dominio.com/callback');
```

### Recepción de Documentos

[](#recepción-de-documentos)

```
$sender->send(
    documentType: 'invoice',
    documentKey: $clave,
    date: '2025-11-18T00:00:00-06:00',
    signedXml: base64_encode($xml)
);
```

### Consultar estado del documento enviado

[](#consultar-estado-del-documento-enviado)

Después de enviar un documento, puedes consultar su estado usando el método `checkStatus`:

```
$documentStatus = $sender->checkStatus(
    documentKey: $clave
);
```

### Obtener listado de documentos enviados

[](#obtener-listado-de-documentos-enviados)

Puedes obtener un listado de documentos enviados usando el método `getDocuments`:

```
$documents = $sender->getDocuments(
    offset: 0,
    limit: 50
);
```

### Consulta un documento enviado

[](#consulta-un-documento-enviado)

```
$document = $sender->getDocument(
    documentKey: $clave
);
```

Firmar Documentos
-----------------

[](#firmar-documentos)

Para firmar documentos electrónicos, puedes utilizar el paquete:

- [DGT Signer](https://github.com/dazza-dev/dgt-cr-signer)

Contribuciones
--------------

[](#contribuciones)

Contribuciones son bienvenidas. Si encuentras algún error o tienes ideas para mejoras, por favor abre un issue o envía un pull request. Asegúrate de seguir las guías de contribución.

Autor
-----

[](#autor)

DGT Sender fue creado por [DAZZA](https://github.com/dazza-dev).

Licencia
--------

[](#licencia)

Este proyecto está licenciado bajo la [Licencia MIT](https://opensource.org/licenses/MIT).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance71

Regular maintenance activity

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

164d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a4e49637e94903e3732c3cf0c3e23b2e7a85286ab196f1ff078b0cea058f8b6?d=identicon)[dazza-dev](/maintainers/dazza-dev)

---

Top Contributors

[![dazza-dev](https://avatars.githubusercontent.com/u/21293561?v=4)](https://github.com/dazza-dev "dazza-dev (1 commits)")

---

Tags

Costa Ricadgt

### Embed Badge

![Health badge](/badges/dazza-dev-dgt-cr-sender/health.svg)

```
[![Health](https://phpackages.com/badges/dazza-dev-dgt-cr-sender/health.svg)](https://phpackages.com/packages/dazza-dev-dgt-cr-sender)
```

###  Alternatives

[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)

PHPackages © 2026

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