PHPackages                             longinus/sped-nfse - 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. longinus/sped-nfse

ActiveLibrary[API Development](/categories/api)

longinus/sped-nfse
==================

Pacote para emissão NFS-e!

v1.0.1(2y ago)31.1k1MITPHPPHP &gt;=8.0

Since Nov 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Longinus-Ek/sped-nfse)[ Packagist](https://packagist.org/packages/longinus/sped-nfse)[ Docs](https://github.com/Longinus-Ek/sped-nfse)[ RSS](/packages/longinus-sped-nfse/feed)WikiDiscussions main Synced 2d ago

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

sped-nfse
=========

[](#sped-nfse)

Biblioteca criada para emissão de nota fiscal de serviço (em desenvolvimento)

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

[](#utilização)

```
$nfse = new Nfse('1.0', 'UTF-8', 'CIDADE');

            $std = new stdClass();
            $std->Id = 123 [int];
            $std->serie = '123' [string];
            $nfse->taginfNfse($std);
            foreach ($itensNF as $item) {
                $std = new stdClass();
                $std->vLiq = 0.00 [float];
                $std->vDed = 0.00 [float];
                $std->vPis = 0.00; [float]
                $std->vCofins = 0.00; [float]
                $std->vInss = 0.00; [float]
                $std->vIr = 0.00; [float]
                $std->vCsll = 0.00; [float]
                $std->vOutrasRetencoes = 0.00; [float]
                $std->vIss = 0.00; [float]
                $std->descIncondicionado = 0.00; [float]
                $std->descCondicionado = 0.00; [float]

                $std->aIss = 0.00; [float]
            }
            $std->issRetido = 2;  [1 ATIVO, 2 INATIVO]
            $std->responsavelRetencao = 1; [1 ATIVO, 2 INATIVO]

            foreach ($itensNF as $item) {
                $std->itemListaServico = '12' [string];
                $std->codigoTributacaoMunicipio = '123'; [string]
                $std->codigoCnae = '123'; [string]
                $std->discriminacao = '123'; [string]

                $std->codigoMunicipio = '123'; [string]
                $std->codigoPais = '123'; [string]
                $std->exigibilidadeISS = '123'; [string]
                $std->municipioIncidencia = '123'; [string]
                $std->cnpj = '123'; [string]
                $std->logradouro = '123'; [string]
                $std->numero = '123'; [string]
                $std->complemento = '123'; [string]
                $std->bairro = '123'; [string]
                $std->codMP = '123'; [string]
                $std->inscricaoMunicipal = '123'; [string]
                $std->uf = '123'; [string]
                $std->cep = '123'; [string]
                $std->telefone = '123'; [string]
                $std->email = '123'; [string]
                $std->razaosocial = '123'; [string]
                $std->nomefantasia = '123'; [string]
                $std->outrasInformacoes = '123'; [string]
            }
            $std->cidadePrestador = '123'; [string]
            $nfse->tagServico($std);

            $std = new stdClass();
            $std->cpfCnpj = '123'; [string]
            $std->inscricaoMunicipal = '123'; [string]
            $nfse->tagPrestador($std);

            $std = new stdClass();
            $std->cpfCnpj = '123'; [string]
            $std->razaosocial = '123'; [string]
            $std->logradouro = '123'; [string]
            $std->numero = '123'; [string]
            $std->complemento = '123'; [string]
            $std->bairro = '123'; [string]
            $std->codMP = '123'; [string]
            $std->uf = $'123'; [string]
            $std->codPais = '123'; [string]
            $std->cep = '123'; [string]
            $std->telefone = '123'; [string]
            $std->email = '123'; [string]
            $std->inscricaoMunicipal = '123'; [string]
            $nfse->tagTomador($std);

            $std = new stdClass();
            $std->competencia = date('Y-m-d'); [date]
            $std->regimeEspecialTributacao = '123'; [string]
            $std->optanteSimplesNacional = '123'; [string]
            $std->incentivoFiscal = '123'; [string]
            $nfse->tagDeclaracaoPrestacaoServico($std);

            $std = new stdClass();
            $std->numeroLote = 123; [int]
            $std->cnpj = '123'; [string]
            $std->inscricaoMunicipal = '123'; [string]
            $std->quantidadeRps = 1; [int]
            $nfse->tagLoteRps($std);

            //Cria o xml
            $xml = $nfse->monta();

            //Configurações para enviar a nota fiscal de serviço
            $configStd = new stdClass();
            $configStd->versao = "1.0";
            $configStd->siglaUF = $grafica->uf;
            $configStd->cidade = $cidadePrestador->cidadeUP;
            $configStd->tpAmb = $configGrafica->tpAmbiente;

            //Controlador Nota Fiscal de serviço
            $tools = new Tools($configStd, $certificado, $password, 'Cidade que vai ser enviada a nota em UPPERCASE');

            //Envio NFSE
            $resposta = $tools->envioLoteRps($xml);

            //Mensagem resposta
            $st = new Standardize($resposta);
            $arrayResponse = $st->toArray();
            $mensagens = isset($arrayResponse[0]['messages']) ? $arrayResponse[0]['messages'] : array();

            if(count($mensagens) > 0){
                foreach ($mensagens as $msg){
                    if($msg['Codigo'] === "E178"){
                        //SUCESSO
                    }else{
                        //REJEITADA
                    }
                    throw new \Exception('Codigo: ' . $msg['Codigo'] . ' Motivo: ' . $msg['Mensagem'] . ' Correção: ' . $msg['Correcao']);
                }
            }
            if(isset($arrayResponse[0]['Protocolo'])){
                $notaFiscal->protocolo = $arrayResponse[0]['Protocolo'];
                $notaFiscal->save();

                sleep(30);

                $ops = ['Content-Type: text/xml;charset="utf-8"',
                    'Accept: text/xml',
                    'Expect: 100-continue',
                    'Connection: Keep-Alive',
                ];

                $cnpj = $grafica->cnpj;
                $xmlConsultado = $tools->consultaLoteRps($cnpj, $notaFiscal->protocolo, $grafica->inscricaomp, $ops);
                $st2 = new Standardize($xmlConsultado);
                $arrayResponse2 = $st2->toArray();

                $mensagens2 = isset($arrayResponse2[0]['messages']) ? $arrayResponse2[0]['messages'] : array();
                if(count($mensagens2) > 0){
                    foreach ($mensagens2 as $msg){
                        $notaFiscal->status = 'REJEITADA';
                        $notaFiscal->save();
                        throw new \Exception('Codigo: ' . $msg['Codigo'] . ' Motivo: ' . $msg['Mensagem'] . ' Correção: ' . $msg['Correcao']);
                    }
                }
                $filenameXML = $_SERVER['HTTP_HOST'].'/NFSeXML/' . 'nfe_' . time() . '.xml';
                Storage::put($filenameXML, $xmlConsultado);
                $notaFiscal->pathXML = $filenameXML;
                $notaFiscal->numNFSE = $tools->getNumeroFromXML($xmlConsultado);
                $notaFiscal->save();
            }

```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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 ~167 days

Total

2

Last Release

802d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/107449926?v=4)[Erick Dias](/maintainers/Longinus-Ek)[@Longinus-Ek](https://github.com/Longinus-Ek)

---

Top Contributors

[![Longinus-Ek](https://avatars.githubusercontent.com/u/107449926?v=4)](https://github.com/Longinus-Ek "Longinus-Ek (35 commits)")[![ErickDiasLS](https://avatars.githubusercontent.com/u/112422728?v=4)](https://github.com/ErickDiasLS "ErickDiasLS (5 commits)")

### Embed Badge

![Health badge](/badges/longinus-sped-nfse/health.svg)

```
[![Health](https://phpackages.com/badges/longinus-sped-nfse/health.svg)](https://phpackages.com/packages/longinus-sped-nfse)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M992](/packages/statamic-cms)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[bagisto/bagisto

Bagisto Laravel E-Commerce

27.6k172.1k9](/packages/bagisto-bagisto)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)

PHPackages © 2026

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