PHPackages                             convenia/afd-reader - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. convenia/afd-reader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

convenia/afd-reader
===================

Pacote para leitura de Arquivo Fonte de Dados (AFD). Especificação do MTE referente a portaria 1.510/2009.

v3.0.5(3y ago)929.5k—8.3%6MITPHPPHP ^7.0|^8.0

Since Sep 22Pushed 1y agoCompare

[ Source](https://github.com/convenia/afd-reader)[ Packagist](https://packagist.org/packages/convenia/afd-reader)[ Docs](https://github.com/convenia/afd-reader)[ RSS](/packages/convenia-afd-reader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

[![logo](afdreader.png)](afdreader.png)

---

Pacote para leitura de Arquivo Fonte de Dados (AFD). Especificação do MTE referente a portaria [1.510/2009](http://www.trtsp.jus.br/geral/tribunal2/ORGAOS/MTE/Portaria/P1510_09.html).

---

[![Latest Stable Version](https://camo.githubusercontent.com/a08bb5e579155ce4defff2727a0ad0abb723aacade8fafeb7a98998b54808269/68747470733a2f2f706f7365722e707567782e6f72672f636f6e76656e69612f6166642d7265616465722f762f737461626c65)](https://packagist.org/packages/convenia/afd-reader)[![Build Status](https://camo.githubusercontent.com/7dbbd18998c2785bda21592f907d7ac370ded66785f7cad4f9feb26756efde1a/68747470733a2f2f7472617669732d63692e6f72672f636f6e76656e69612f6166642d7265616465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/convenia/afd-reader)[![Total Downloads](https://camo.githubusercontent.com/15206e6f9eb490ac769c748399f41d83291a975dcfd98b61711a099fa1faf3a8/68747470733a2f2f706f7365722e707567782e6f72672f636f6e76656e69612f6166642d7265616465722f646f776e6c6f616473)](https://packagist.org/packages/convenia/afd-reader)[![License](https://camo.githubusercontent.com/d344e12f6b2adcd1e61c2fa3e0da9514dbc87518b15735bfa00a8659a29e7d2f/68747470733a2f2f706f7365722e707567782e6f72672f636f6e76656e69612f6166642d7265616465722f6c6963656e7365)](https://packagist.org/packages/convenia/afd-reader)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#)

Arquivos suportados
-------------------

[](#arquivos-suportados)

- Arquivo-Fonte de Dados - AFD
- Arquivo-Fonte de Dados Tratado - AFDT
- Arquivo de Controle de Jornada para Efeitos Fiscais - ACJEF

Métodos
-------

[](#métodos)

- getByUser()
- getAll()

Utilização
----------

[](#utilização)

O AfdReader pode ser instanciado informando apenas o caminho do arquivo, neste caso ele tentará descobrir o tipo:

```
use Convenia\AfdReader\AfdReader;
...

$afdReader = new AfdReader('afdt_test.txt');
```

Informando o tipo do arquivo:

```
use Convenia\AfdReader\AfdReader;
...

$afdReader = new AfdReader('afdt_test.txt', 'Afdt');
```

Obter informações agrupadas por NIS/PIS:

```
$afdReader->getByUser();
```

```
Array
(
    [62915959739] => Array
        (
            [20052015] => Array
                (
                    [01] => Array
                        (
                            [0] => Array
                                (
                                    [sequency] => 000000002
                                    [dateTime] => DateTime Object
                                        (
                                            [date] => 2015-05-20 09:00:00.000000
                                            [timezone_type] => 3
                                            [timezone] => America/Sao_Paulo
                                        )

                                    [reason] =>

                                    [direction] => Entrada
                                    [type] => Original
                                )

                            [1] => Array
                                (
                                    [sequency] => 000000003
                                    [dateTime] => DateTime Object
                                        (
                                            [date] => 2015-05-20 12:04:00.000000
                                            [timezone_type] => 3
                                            [timezone] => America/Sao_Paulo
                                        )

                                    [reason] =>

                                    [direction] => Saída
                                    [type] => Original
                                )

                        )

                    [02] => Array
                        (
                            [0] => Array
                                (
                                    [sequency] => 000000004
                                    [dateTime] => DateTime Object
                                        (
                                            [date] => 2015-05-20 13:14:00.000000
                                            [timezone_type] => 3
                                            [timezone] => America/Sao_Paulo
                                        )

                                    [reason] =>

                                    [direction] => Entrada
                                    [type] => Original
                                )

                            [1] => Array
                                (
                                    [sequency] => 000000005
                                    [dateTime] => DateTime Object
                                        (
                                            [date] => 2015-05-20 18:07:00.000000
                                            [timezone_type] => 3
                                            [timezone] => America/Sao_Paulo
                                        )

                                    [reason] =>

                                    [direction] => Saída
                                    [type] => Original
                                )

                        )

                )

        )

)

```

Obter as ocorrências de um NIS/PIS:

```
$afdReader->getByUser(62915959739);
```

Obter as ocorrências de um NIS/PIS no período especificado:

```
$afdReader->getByUser(62915959739, ['from' => '2015-05-20', 'to' => '2015-05-20']);
```

Obter as informações de todos os registros:

```
$afdReader->getAll();
```

```
Array
(
    [header] => Array
        (
            [sequency] => 000000001
            [type] => 1
            [entityType] => CNPJ
            [entityNumber] => 32041763000177
            [cei] => 000000000000
            [name] => NOME DA EMPRESA - LTDA ME
            [startDate] => 20052015
            [endDate] => 20092015
            [generationDate] => DateTime Object
                (
                    [date] => 2015-09-21 09:57:59.000000
                    [timezone_type] => 3
                    [timezone] => America/Sao_Paulo
                )

            [generationTime] => Array
                (
                    [hour] => 10
                    [minute] => 43
                )

        )

    [trailer] => Array
        (
            [sequency] => 000011305
            [type] => 9
        )

    [detail] => Array
        (
            [62915959739] => Array
                (
                    [20052015] => Array
                        (
                            [01] => Array
                                (
                                    [0] => Array
                                        (
                                            [sequency] => 000000002
                                            [dateTime] => DateTime Object
                                                (
                                                    [date] => 2015-05-20 09:00:00.000000
                                                    [timezone_type] => 3
                                                    [timezone] => America/Sao_Paulo
                                                )

                                            [reason] =>

                                            [direction] => Entrada
                                            [type] => Original
                                        )

                                    [1] => Array
                                        (
                                            [sequency] => 000000003
                                            [dateTime] => DateTime Object
                                                (
                                                    [date] => 2015-05-20 12:04:00.000000
                                                    [timezone_type] => 3
                                                    [timezone] => America/Sao_Paulo
                                                )

                                            [reason] =>

                                            [direction] => Saída
                                            [type] => Original
                                        )

                                )

                            [02] => Array
                                (
                                    [0] => Array
                                        (
                                            [sequency] => 000000004
                                            [dateTime] => DateTime Object
                                                (
                                                    [date] => 2015-05-20 13:14:00.000000
                                                    [timezone_type] => 3
                                                    [timezone] => America/Sao_Paulo
                                                )

                                            [reason] =>

                                            [direction] => Entrada
                                            [type] => Original
                                        )

                                    [1] => Array
                                        (
                                            [sequency] => 000000005
                                            [dateTime] => DateTime Object
                                                (
                                                    [date] => 2015-05-20 18:07:00.000000
                                                    [timezone_type] => 3
                                                    [timezone] => America/Sao_Paulo
                                                )

                                            [reason] =>

                                            [direction] => Saída
                                            [type] => Original
                                        )

                                )

                        )
                )

        )

)

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68% 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 ~174 days

Total

2

Last Release

1160d ago

PHP version history (2 changes)v3.0.4PHP ^7.0

v3.0.5PHP ^7.0|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4175895?v=4)[Convenia](/maintainers/convenia)[@convenia](https://github.com/convenia)

---

Top Contributors

[![andersonls](https://avatars.githubusercontent.com/u/1561038?v=4)](https://github.com/andersonls "andersonls (17 commits)")[![conveniadev](https://avatars.githubusercontent.com/u/19734609?v=4)](https://github.com/conveniadev "conveniadev (8 commits)")

---

Tags

acjefafdafdtcltfiscalpontophpAFDacjefafdtmte

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/convenia-afd-reader/health.svg)

```
[![Health](https://phpackages.com/badges/convenia-afd-reader/health.svg)](https://phpackages.com/packages/convenia-afd-reader)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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