phpcfdi/csf-scraper

根据其RFC和CIFID获取法人或自然人的当前税务数据

v0.1.7 2024-01-10 17:18 UTC

This package is auto-updated.

Last update: 2024-09-10 19:42:19 UTC


README

Source Code Packagist PHP Version Support Discord Latest Version Software License Build Status Reliability Maintainability Code Coverage Violations Total Downloads

根据其RFC和CIFID获取法人或自然人的当前税务数据。

🇺🇸 该项目的文档用西班牙语编写,因为这是目标受众的自然语言。

🇲🇽 该项目的文档用西班牙语编写,因为这是用户的主要语言。

安装

使用 composer

composer require phpcfdi/csf-scraper

此库需要使用实现 GuzzleHttp\ClientInterface; 的客户端,你可以在此处获取更多关于此库的信息:guzzle.

使用示例

<?php

declare(strict_types=1);

use GuzzleHttp\Client;
use PhpCfdi\CsfScraper\Scraper;
use PhpCfdi\Rfc\Rfc;

require 'vendor/autoload.php';

$scraper = Scraper::create();

$rfc = Rfc::parse('YOUR_RFC');

$person = $scraper->obtainFromRfcAndCif(rfc: $rfc, idCIF: 'ID_CIF');

// También puedes obtener los datos de la persona directamente del archivo local PDF
// (Ten en cuenta que esta funcionalidad requiere de tener instalado poppler-utils en tu servidor).
$person = $scraper->obtainFromPdfPath('LOCAl_PDF_FILE_PATH');

// puedes acceder a los datos de la persona (moral o física) usando los métodos incluidos:
if($rfc->isFisica()) {
    echo $person->getNombre();
}
if($rfc->isMoral()) {
    echo $person->getRazonSocial();
}

// o puedes obtener el array de datos usando
echo print_r($person->toArray(), true);

法人示例输出 json_encode($person)

{
  "rfc": "DIM8701081LA",
  "id_cif": "12345678",
  "razon_social": "Mi razón social",
  "regimen_de_capital": "SA DE CV",
  "fecha_constitucion": {
    "date": "2019-02-21 22:50:46.000000",
    "timezone_type": 3,
    "timezone": "UTC"
  },
  "fecha_inicio_operaciones": {
    "date": "2019-02-21 22:50:46.000000",
    "timezone_type": 3,
    "timezone": "UTC"
  },
  "situacion_contribuyente": "ACTIVO",
  "fecha_ultimo_cambio_situacion": {
    "date": "2019-02-21 22:50:46.000000",
    "timezone_type": 3,
    "timezone": "UTC"
  },
  "entidad_federativa": "CIUDAD DE MEXICO",
  "municipio_delegacion": "CUAUHTEMOC",
  "colonia": "CUAUHTEMOC",
  "tipo_vialidad": "Tipo vialidad",
  "nombre_vialidad": "PASEO DE LA REFORMA",
  "numero_exterior": "143",
  "numero_interior": "Piso 69",
  "codigo_postal": "72055",
  "correo_electronico": "example@example.com",
  "al": "CIUDAD DE MEXICO 2",
  "regimenes": [
    {
      "regimen": "Régimen General de Ley Personas Morales",
      "regimen_id": "601",
      "fecha_alta": {
        "date": "2019-02-21 22:50:46.000000",
        "timezone_type": 3,
        "timezone": "UTC"
      }
    }
  ],
  "extra_data": []
}

自然人示例输出 json_encode($person)

{
  "rfc": "COSC8001137NA",
  "id_cif": "1904014102123",
  "curp": "CURP",
  "nombre": "JUAN",
  "apellido_paterno": "PEREZ",
  "apellido_materno": "RODRIGUEZ",
  "fecha_nacimiento": {
    "date": "1973-05-01 22:53:25.000000",
    "timezone_type": 3,
    "timezone": "UTC"
  },
  "fecha_inicio_operaciones": {
    "date": "2004-11-03 22:53:25.000000",
    "timezone_type": 3,
    "timezone": "UTC"
  },
  "situacion_contribuyente": "ACTIVO",
  "fecha_ultimo_cambio_situacion": {
    "date": "2004-11-03 22:53:25.000000",
    "timezone_type": 3,
    "timezone": "UTC"
  },
  "entidad_federativa": "CIUDAD DE MEXICO",
  "municipio_delegacion": "IZTAPALAPA",
  "colonia": "MI COLONIA",
  "tipo_vialidad": "CALLE",
  "nombre_vialidad": "BENITO JUAREZ",
  "numero_exterior": "183",
  "numero_interior": "",
  "codigo_postal": "72000",
  "correo_electronico": "",
  "al": "CIUDAD DE MEXICO 3",
  "regimenes": [
    {
      "regimen": "Régimen de Incorporación Fiscal",
      "regimen_id": "621",
      "fecha_alta": {
        "date": "2014-01-01 22:53:25.000000",
        "timezone_type": 3,
        "timezone": "UTC"
      }
    }
  ],
  "extra_data": []
}

支持

您可以在GitHub上创建一个工单以获取支持。

此外,此库属于 PhpCfdi 社区,因此您可以使用相同的沟通渠道从社区成员那里获得帮助。

兼容性

此库将保持与最新激活支持的 PHP 版本 至少兼容。

我们还使用 语义版本2.0.0,因此您可以放心地使用此库,而不用担心破坏您的应用程序。

贡献

欢迎贡献。请阅读 CONTRIBUTING 获取更多详细信息,并请记住检查待办事项 TODO 和变更日志 CHANGELOG 文件。

版权和许可证

phpcfdi/csf-scraper 库的版权归 PhpCfdi 所有,并按 MIT 许可证(MIT)许可使用。有关更多信息,请参阅 LICENSE