protacon/vf-rest 问题修复 & 功能扩展

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

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

protacon/vf-rest

最新稳定版本:0.5.0

Composer 安装命令:

composer require protacon/vf-rest

包简介

ValueFrame REST API component

README 文档

README

MIT licensed Total Downloads Latest Stable Version Latest Unstable Version

Simple library for ValueFrame REST API.

Basically this is a wrapper for guzzlehttp/guzzle - this library just adds necessary headers to each request.

Table of Contents

Requirements

Installation

The recommended way to install this library is with Composer. Composer is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project.

# Install Composer
curl -sS https://getcomposer.org/installer | php

You can add this library as a dependency to your project using following command:

composer require protacon/vf-rest

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

Note that this is only needed if you're using this library as a stand-alone component - usually your framework (eg. Symfony) is already handling this part for you.

Usage

First of all you should read official documentation about ValueFrame REST API.

Simple usage example:

<?php
declare(strict_types=1);

namespace App;

use GuzzleHttp\Exception\BadResponseException;
use ValueFrame\Rest\Factory as Client;
use function json_decode;
use function var_dump;

require __DIR__ . '/vendor/autoload.php';

$customer = 'asiakas';            // X-VF-REST-USER , see docs
$token    = 'siirtoavain';        // {SIIRTOAVAIN} , see docs
$resource = 'tehtavan_kommentti'; // {REST_resurssi} , see docs

$client = Client::build($customer, $token, $resource);

try {
    $response = $client->get('');

    var_dump($response->getStatusCode());
    var_dump(json_decode($response->getBody()->getContents()));
} catch (BadResponseException $exception) {
    var_dump($exception->getResponse()->getStatusCode());
    var_dump(json_decode($exception->getResponse()->getBody()->getContents()));
}

Development

IDE

We highly recommend that you use "proper" IDE to development your application. Below is short list of some popular IDEs that you could use.

PHP Code Sniffer

It's highly recommended that you use this tool while doing actual development to application. PHP Code Sniffer is added to project dev dependencies, so all you need to do is just configure it to your favorite IDE. So the phpcs command is available via following example command.

./vendor/bin/phpcs -i

If you're using PhpStorm following links will help you to get things rolling.

Testing

Library uses PHPUnit for testing. You can run all tests by following command:

./vendor/bin/phpunit

Or you could easily configure your IDE to run those for you.

Metrics

Library uses PhpMetrics to make static analyze of its code. You can run this by following command:

./vendor/bin/phpmetrics --junit=build/logs/junit.xml --report-html=build/phpmetrics .

And after that open build/phpmetrics/index.html with your favorite browser.

Authors

Tarmo Leppänen

License

The MIT License (MIT)

Copyright (c) 2018 Pinja

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固