定制 andreataide/nfsesaquarema-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

andreataide/nfsesaquarema-php

Composer 安装命令:

composer require andreataide/nfsesaquarema-php

包简介

Lib to communicate with web services to generate NFS-e (Nota Fiscal de Serviços Eletrônica)

README 文档

README

Developed from the NFSePHP project - Nota Carioca by Pedro Casado. https://github.com/pedrocasado/nfse-php

NFSePHP - Saquarema

Lib to communicate with SOAP web services and generate NFS-e (Nota Fiscal de Serviços Eletrônica). Under development. Still not Working!

Operations Supported

  • Saquarema
    • GerarNfse
    • ConsultarNfsePorRps
    • ConsultarNfse
    • CancelarNfse

Install

composer require andreataide/nfsesaquarema-php

Usage

Check examples/ folder

You must have a valid certificate to use NFSe staging environment.

GerarNfse

use NotaSaquarema\NotaSaquaremaFactory;
use NotaSaquarema\SoapHandler;

$rps = [
    'IdentificacaoRps' => [
        'Numero' => 119,
        'Serie' => 'A',
        'Tipo' => 1,
        // 1 - RPS
        // 2 – Nota Fiscal Conjugada (Mista)
        // 3 – Cupom
    ],
    'DataEmissao' => date('Y-m-d').'T'.date('H:i:s'),
    'NaturezaOperacao' => 1,
    // 1 – Tributação no município
    // 2 - Tributação fora do município
    // 3 - Isenção
    // 4 - Imune
    // 5 – Exigibilidade suspensa por decisão judicial
    // 6 – Exigibilidade suspensa por procedimento administrativo

    'RegimeEspecialTributacao' => 3, // optional
    // 1 – Microempresa municipal
    // 2 - Estimativa
    // 3 – Sociedade de profissionais
    // 4 – Cooperativa
    // 5 – MEI – Simples Nacional
    // 6 – ME EPP – Simples Nacional

    'OptanteSimplesNacional' => 2, // 1 - Sim 2 - Não
    'IncentivadorCultural' => 2, // 1 - Sim 2 - Não
    'Status' => 1, // 1 – Normal  2 – Cancelado

    'Prestador' => [
        'Cnpj' => '111111',
        'InscricaoMunicipal' => '11111', // optional
    ],

    'Tomador' => [
        'IdentificacaoTomador' => [ // optional
            'CpfCnpj' => [
                'Cpf' => '111',
                // 'Cnpj' => '111',
            ],
        ],
        'RazaoSocial' => 'Fulano de tal', // optional
        'Endereco' => [ // optional
            'Endereco' => 'Rua 1111', // optional
            'Numero' => '1', // optional
            'Complemento' => 'ap 1', // optional
            'Bairro' => '1', // optional
            'CodigoMunicipio' => 1111111, // optional
            'Uf' => 'RJ', // optional
            'Cep' => 11111111, // optional
        ],
    ],

    'Servico' => [
        'ItemListaServico' => '1002', // First 4 digits
        'CodigoTributacaoMunicipio' => '100203', // 6 digits
        'Discriminacao' => 'Pedido #1111 - Itens: #123 , #124',
        'CodigoMunicipio' => 1111111,
        'Valores' => [
            'ValorServicos' => 228.6,
            'ValorDeducoes' => 10.0, // optional
            'ValorPis' => 10.0, // optional
            'ValorCofins' => 10.0, // optional
            'ValorInss' => 10.0, // optional
            'ValorIr' => 10.0, // optional
            'ValorCsll' => 10.0, // optional
            'IssRetido' => 2, // 1 para ISS Retido - 2 para ISS não Retido,
            'ValorIss' => 10.0, // optional
            'OutrasRetencoes' => 10.0, // optional
            'Aliquota' => 5, // optional
            'DescontoIncondicionado' => 10.0, // optional
            'DescontoCondicionado' => 10.0, // optional
        ],
    ],

    'IntermediarioServico' => [ // optional
        'RazaoSocial' => 'Fulano de tal',
        'CpfCnpj' => [
            'Cnpj' => '11111',
            // 'Cpf' => '1111',
        ],
        'InscricaoMunicipal' => '11111', // optional
    ],

    'ConstrucaoCivil' => [ // optional
        'CodigoObra' => '111',
        'Art' => '111',
    ],
];

$env = 'dev'; // dev - prod
$notaCariocaFactory = new NotaCariocaFactory();
$gerarOperation = $notaCariocaFactory->createOperation('gerar-nfse', $env);
$gerarOperation->setRps($rps);

$soapHandler = new SoapHandler(['cert_path' => '/path/to/valid/cert.pfx', 'cert_pass' => 'certpassword']);

// Send SOAP xml
$response = $soapHandler->send($gerarOperation);

if ($soapHandler->isSuccess($response)) {
    $nfs = $gerarOperation->formatSuccessResponse($response);
    var_dump($nfs);
} else {
    var_dump($soapHandler->getErrors($response));
}

/* Response

array (size=1)
  'nfse' =>
    array (size=14)
      'Numero' => string '43' (length=2)
      'CodigoVerificacao' => string 'VZW2-EJIB' (length=9)
      'DataEmissao' => string '2020-02-28T09:09:55' (length=19)
      'IdentificacaoRps' =>
        array (size=3)
          'Numero' => string '1' (length=1)
          'Serie' => string 'A' (length=2)
          'Tipo' => string '1' (length=1)
      'DataEmissaoRps' => string '2020-02-28' (length=10)
      'NaturezaOperacao' => string '1' (length=1)
      'RegimeEspecialTributacao' => string '3' (length=1)
      'OptanteSimplesNacional' => string '2' (length=1)
      'IncentivadorCultural' => string '2' (length=1)
      'Competencia' => string '2020-02-28T00:00:00' (length=19)
      'Servico' =>
        array (size=5)
          'Valores' =>
            array (size=3)
              'ValorServicos' => string '228.6' (length=5)
              'IssRetido' => string '2' (length=1)
              'ValorLiquidoNfse' => string '228.6' (length=5)
          'ItemListaServico' => string '1002' (length=4)
          'CodigoTributacaoMunicipio' => string '100203' (length=6)
          'Discriminacao' => string 'Pedido #1111 - Itens: #123 , #124' (length=33)
          'CodigoMunicipio' => string '3304557' (length=7)
      'PrestadorServico' =>
        array (size=4)
          'IdentificacaoPrestador' =>
            array (size=2)
              'Cnpj' => string '11111111111111' (length=14)
              'InscricaoMunicipal' => string '1111111' (length=7)
          'RazaoSocial' => string '11111111' (length=48)
          'Endereco' =>
            array (size=7)
              'Endereco' => string '11111' (length=39)
              'Numero' => string '1111' (length=3)
              'Complemento' => string '11111' (length=15)
              'Bairro' => string '11111' (length=7)
              'CodigoMunicipio' => string '3304557' (length=7)
              'Uf' => string 'RJ' (length=2)
              'Cep' => string '1111111' (length=8)
          'Contato' => string '' (length=0)
      'TomadorServico' =>
        array (size=2)
          'IdentificacaoTomador' => string '' (length=0)
          'Endereco' => string '' (length=0)
      'OrgaoGerador' =>
        array (size=2)
          'CodigoMunicipio' => string '3304557' (length=7)
          'Uf' => string 'RJ' (length=2)
*/

TODO's

  • Add missing operations (ConsultarLoteRps, ConsultarSituacaoLoteRps, EnviarLoteRps)
  • Add tests

andreataide/nfsesaquarema-php 适用场景与选型建议

andreataide/nfsesaquarema-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「nfse」 「nfse-php」 「nota fiscal de servicos eletronica」 「saquarema」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 andreataide/nfsesaquarema-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 andreataide/nfsesaquarema-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 andreataide/nfsesaquarema-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2025-03-12