shjordan/api-pncp-php

全国公共采购门户(PNCP)的API REST服务

dev-main 2023-12-12 19:33 UTC

This package is auto-updated.

Last update: 2024-09-12 21:15:20 UTC


README

全国公共采购门户(PNCP)的API REST服务

更多信息,请访问 https://www.serpro.gov.br

安装与使用

需求

PHP 7.4及更高版本。也应适用于PHP 8.0。

Composer

要通过Composer安装绑定,请将以下内容添加到composer.json

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/SHJordan/api-pncp-php.git"
    }
  ],
  "require": {
    "shjordan/api-pncp-php": "*@dev"
  }
}

然后运行composer install

手动安装

下载文件并包含autoload.php

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

入门指南

请按照安装过程进行操作,然后运行以下命令

<?php
require_once(__DIR__ . '/vendor/autoload.php');




$apiInstance = new OpenAPI\Client\Api\AtaApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$cnpj = 'cnpj_example'; // string
$ano = 56; // int
$sequencial = 56; // int
$sequencial_ata = 56; // int
$pagina = 56; // int
$tamanho_pagina = 56; // int

try {
    $result = $apiInstance->consultarHistoricoAta($cnpj, $ano, $sequencial, $sequencial_ata, $pagina, $tamanho_pagina);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AtaApi->consultarHistoricoAta: ', $e->getMessage(), PHP_EOL;
}

API端点

所有URI相对于https://treina.pncp.gov.br/api/pncp

模型

Authorization

API定义的认证方案

bearerAuth

  • 类型:Bearer认证(JWT)

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

css.serpro@serpro.gov.br

关于此包

此PHP包由OpenAPI Generator项目自动生成

  • API版本:1.0
  • 构建包:org.openapitools.codegen.languages.PhpClientCodegen