arturmamedov/w-api 问题修复 & 功能扩展

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

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

arturmamedov/w-api

Composer 安装命令:

composer require arturmamedov/w-api

包简介

Simple PHP Class for call an REST API endpoint and get JSON data with CURL

README 文档

README

REST PHP API Consumer

Simple PHP Class for call an REST API endpoint and get JSON data with CURL

Example

<?php
$endpoint = 'blog/posts'; // relative to what set in $host and $version in MyApi Class
// so result: http://api.test/api/v1/blog/posts

# 1 - Include and init
require_once 'src'.DIRECTORY_SEPARATOR.'api.php';
$w_api = new wApi('testuser', 'testpassword');

# 2 - Make call
$json_response = $w_api->http($endpoint, 'GET');

# 3 - Read Response
if ($response === false) {
    $response = [ 'status' => false, 'error' => 'CURL_ERR' ];
    exit(print_r($response)); // for debug reason, to remove in production
}else {
    $response = json_decode($json_response);
}

// Use $response ...
foreach ($response as $post){
    // do things with your resource
}

Author: Artur Mamedov

Inspired by: https://github.com/abraham/twitteroauth

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固