定制 prodevcon/dc-api-wrapper 二次开发

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

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

prodevcon/dc-api-wrapper

Composer 安装命令:

composer require prodevcon/dc-api-wrapper

包简介

Buyoda - Data Collector api wrapper

README 文档

README

This library is used to easily consume DataCollector API It takes an API response and maps it to appropriate models (objects) so it can be easily used in any application. Check models for available mathod calls.

Auth Token is required for API calls. Please make sure you accquire the token before using the library.

use DataCollector\Api\Client;
use DataCollector\Api\Service\Url\UrlApiService;
use DataCollector\Api\Service\Company\CompanyApiService;
use DataCollector\Api\Service\Company\CompanyImportApiService;

/* Auhtenticate User */
$authToken = '###auth_token###';
$client = new Client($authToken);

Available Services:

Company Service
/* Initialize service */
$companyApiService = new CompanyApiService($client);

/* Get Company by id */
$request = $companyApiService->get(5347, CompanyApiService::RESPONSE_JSON);

/* Get Company by url string */
$request = $companyApiService->getByUrl('http://www.felbo.ch', CompanyApiService::RESPONSE_JSON);

/* Find Companies by keyword */
$request = $companyApiService->find('Computer Repair', CompanyApiService::RESPONSE_JSON);

/* Get Companies by import name */
$request = $companyApiService->getByImportName([
	'e-fon ag',
	'1 Computer',
	'abraxas informatik ag'
], CompanyApiService::RESPONSE_JSON);

/** Get Companies by import */
$request = $companyApiService->getByImport([
		'name'      => 'e-fon ag',
		'country'   => 'switzerland',
		'in_queue'  => 1
	], 
	CompanyApiService::RESPONSE_JSON);

Company Import Service
/* Initialize service */
$companyImportApiService = new CompanyImportApiService($client);

/* Get Company Import by rule id */
$request = $companyImportApiService->getByRule(54, CompanyImportApiService::RESPONSE_JSON);

/* Get Company Import by rule id with Google Analytics */
$request = $companyImportApiService->getByRuleWithGoogleAnalytics(54, CompanyImportApiService::RESPONSE_JSON);
URL Service
/* Initialize service */
$urlApiService = new UrlApiService($client);

/* Get URL by id */
$request = $urlApiService->get(3011, UrlApiService::RESPONSE_JSON);

/* Get Url by url string */
$request = $urlApiService->getByUrl('http://www.felbo.ch', UrlApiService::RESPONSE_JSON);

/* Find Urls by keyword */
$request = $urlApiService->find('Computer Repair', UrlApiService::RESPONSE_JSON);

Kompass Service
/* Initialize service */
$kompassApiService = new KompassApiService($client);

/* Get Kompass by import */
$request = $kompassApiService->getByImport([
		'name'      => 'e-fon ag',
		'country'   => 'switzerland'
	], KompassApiService::RESPONSE_JSON);

Request

$request will have a \GuzzleHttp\Psr7\Psr7\Request object

/* Get response headers */
$request->getHeaders() /* Array of response header values*/

/* Get response content */
$request->getBody();

Result builder (ex. UrlApiService)

/* Build Result / Serialize API Response to objects/models */

/* Url Service - Get */
$urlApiService->buildResult($request->getBody(), UrlApiService::URL, CompanyApiService::RESPONSE_JSON);
/* Url Service - Get By URL  */
$urlApiService->buildResult($request->getBody(), UrlApiService::URL_BY_URL, CompanyApiService::RESPONSE_JSON);
/* Url Service - Find */
$urlApiService->buildResult($request->getBody(), UrlApiService::URL_FIND, CompanyApiService::RESPONSE_JSON);

Installing

The recommended way to install DataCollector API Wrapper is through Composer.

php composer.phar require prodevcon/dc-api-wrapper

After installing, you need to require Composer's autoloader and register annotation to AnnotationRegistry (required by jms/serializer):

use Doctrine\Common\Annotations\AnnotationRegistry;

$loader = require __DIR__ . '/vendor/autoload.php';
AnnotationRegistry::registerLoader([$loader, 'loadClass']);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固