jhowbhz / apigratis-sdk-php
此软件包免费,可用于API巴西网站功能
0.1.4
2024-03-01 22:02 UTC
Requires
- php: ^8
- guzzlehttp/guzzle: ^7.5
Requires (Dev)
- orchestra/testbench: ^6.25
- phpunit/phpunit: ^9.6
Suggests
- ext-curl: Required by ApiBrasil\ to requests in services.
- guzzlehttp/guzzle: Guzzle is a PHP HTTP client library and framework for building RESTful web service clients.
README
API集合,面向开发者
使用我们的API将您的项目转变为智能解决方案。通过API WhatsApp、地理位置、订单追踪、CPF/CNPJ验证等功能,您可以创建高效且实用的解决方案。现在开始。
支持渠道(社区)
获取您的凭据
使用Composer安装软件包
composer require jhowbhz/apigratis-sdk-php
更多信息
https://packagist.org.cn/packages/jhowbhz/apigratis-sdk-php
可用的API服务
AuthService
使用此API您可获取Bearer Token
用于有效登录1年
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $login = Service::Auth("login", [ "body" => [ "email" => "jhondoe@gmail.com", "password" => "123456" ] ]); var_dump($login); die;
使用此API您可执行登出操作,使Bearer Token失效
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $logout = Service::Auth("logout", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", ]); var_dump($logout); die;
DeviceService
使用此API可创建、编辑和删除设备
创建设备
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $store = Service::Device("store", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "SecretKey" => "f87eb607-a8cc-43ea-b439.....", "body" => [ "type" => "cellphone", "device_name" => "zap1", "device_key" => "zapzap1", "device_ip" => "198.29.10.50", "server_search" => "341d6f36-b888....", "webhook_wh_message" => "", "webhook_wh_status" => "" ] ]); var_dump($store); die;
更新设备
require_once('vendor/autoload.php'); use ApiBrasil\Service; $update = Service::Device("search", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "body" => [ "type" => "cellphone", "search" => "82faab0a-24f4-4b8b-9926-455ea9b3cdb7", "server_search" => "a2c85262-f830-4b90-a8da-ff67b7a7ed6e", "device_name" => "zap2", "device_key" => "zapzap1", "device_ip" => "198.29.10.50", "webhook_wh_message" => "", "webhook_wh_status":"" ] ]); var_dump($update); die;
显示设备
require_once('vendor/autoload.php'); use ApiBrasil\Service; $show = Service::Device("show", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "method" => "GET", "body" => [ "search" => "82faab0a-24f4-4b8b-9926-455ea9b3cdb7", ] ]); var_dump($show); die;
ServerService
使用此API可列出所有活动服务器
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $servers = Service::Server([ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "method" => "GET", ]); var_dump($servers); die;
ProfileService
使用此API可列出您的个人资料详细信息
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $profile = Service::Profile([ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "method" => "GET", ]); var_dump($profile); die;
PlanService
使用此API可列出您的计划详细信息
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $plans = Service::Plan("all", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "method" => "GET", ]); var_dump($plans); die; // ou obter o plano do usuario $plan = Service::Plan("me", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "method" => "GET", ]); var_dump($plan); die;
WhatsAppService
使用此API可发送短信和其他信息
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $sendText = Service::WhatsApp("sendText", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "DeviceToken" => "d019580b-3c8c-40e3-b9a0....", "body" => [ "number" => "5531994359434", "text" => "🟢 Bem vindo ao APIBrasil" ] ]); var_dump($sendText); die;
VehiclesService
使用此API您可获取车辆特征数据(通过车牌号)
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $dados = Service::Vehicles("dados", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "DeviceToken" => "d019580b-3c8c-40e3-b9a0....", "body" => [ "placa" => "HBM6603", ] ]); var_dump($dados); die;
DDDBrasil
获取所有巴西DDD数据的API,由Anatel授权
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $ddd = Service::DDD("ddd", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "DeviceToken" => "d019580b-3c8c-40e3-b9a0....", "body" => [ "ddd" => "31", ] ]); var_dump($ddd); die;
FeriadosBrasil
获取所有国家、州、市和自愿假期的API
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $feriados = Service::HoliDays("feriados", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "DeviceToken" => "d019580b-3c8c-40e3-b9a0....", "body" => [ "type" => "facultativo", "date" => "07/09", "year" => "2024" ] ]); var_dump($feriados); die;
VehiclesService
通过车牌获取Fipe表格数据的API
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $fipe = Service::Vehicles("fipe", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "DeviceToken" => "d019580b-3c8c-40e3-b9a0....", "body" => [ "placa" => "HBM6603", ] ]); var_dump($fipe); die;
CorreiosService
使用此API您可获取邮局订单数据
通过追踪器获取订单数据的API
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $rastreio = Service::Correios("rastreio", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "DeviceToken" => "d019580b-3c8c-40e3-b9a0....", "body" => [ "code" => "NL249695552BR", ] ]); var_dump($rastreio); die;
通过CEP获取地址数据的API
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $address = Service::Correios("address", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "DeviceToken" => "d019580b-3c8c-40e3-b9a0....", "body" => [ "query" => "32146057", ] ]); var_dump($address); die;
CNPJService
通过多种方式通过CNPJ获取地址数据
- 列出CNAES
- 通过CEP获取CNPJ *
- 通过州获取CNPJ *
- 通过CNAE获取CNPJ
- 通过注册资本获取CNPJ *
- 列出CNPJ股东 *
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $cnpj = Service::CNPJ("cnpj", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "DeviceToken" => "d019580b-3c8c-40e3-b9a0....", "body" => [ "cnpj" => "44.959.669/0001-80", ] ]); var_dump($cnpj); die;
CEPService
使用此API您可仅通过CEP获取坐标数据(LAT和LONG)和IBGE代码
- 通过CEP获取Lat和Long
- 通过UF获取城市列表
- 通过城市获取街区列表
- 获取州列表
<?php require_once('vendor/autoload.php'); use ApiBrasil\Service; $cep = Service::CEP("cep", [ "Bearer" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....", "DeviceToken" => "d019580b-3c8c-40e3-b9a0....", "body" => [ "cep" => "32146057", ] ]); var_dump($cep); die;
注意
您可以在每个API的文档中或在此链接中找到更多端点:[https://doc.apibrasil.io](https://doc.apibrasil.io)