openprovider/rest-client-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

openprovider/rest-client-php

最新稳定版本:v2.0.2-beta

Composer 安装命令:

composer require openprovider/rest-client-php

包简介

HTTP client for Openprovider API

README 文档

README

PHP client for Openprovider API

Description

This software is a PHP client to operate with the Openprovider API.

At this time the API is stable enough to be used, however please note that during the beta phase we may still make breaking changes.

Please use v1beta branch/version.

Usage

  1. If you do not have composer.json in your project folder, create it with the command
    composer init
  2. Set composer minimum stability to dev
    composer config minimum-stability dev
  3. Include this package as any other PHP library:
    composer require openprovider/rest-client-php:dev-v1beta
  4. Access API via the Client class:
    <?php
    
    // Include autoloader.
    require __DIR__ . '/vendor/autoload.php';
    
    use Openprovider\Api\Rest\Client\Auth\Model\AuthLoginRequest;
    use Openprovider\Api\Rest\Client\Base\Configuration;
    use Openprovider\Api\Rest\Client\Client;
    use GuzzleHttp\Client as HttpClient;
    
    // Create new http client.
    $httpClient = new HttpClient();
    
    // Create new configuration.
    $configuration = new Configuration();
    
    // Build api client for using created client & configuration.
    $client = new Client($httpClient, $configuration);
    
    // Our credentials;
    $username = 'user';
    $password = 'pass';
    
    // Retrieve token for further using.
    $loginResult = $client->getAuthModule()->getAuthApi()->login(
    	new AuthLoginRequest([
    		'username' => $username,
    		'password' => $password,
    	])
    );
    
    // Set token to configuration (it will update the $client).
    $configuration->setAccessToken($loginResult->getData()->getToken());
    
    // Use this client for API calls.
    $result = $client->getTldModule()->getTldServiceApi()->getTld('com');
    
    // Operate with the result.
    print_r($result);
  5. Check the ./examples directory for more complex examples.

统计信息

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

GitHub 信息

  • Stars: 11
  • Watchers: 10
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固