ValueFrame REST API component

0.4.1 2018-01-18 14:07 UTC

This package is not auto-updated.

Last update: 2020-05-21 17:08:46 UTC


MIT licensed Build Status Scrutinizer Code Quality Code Coverage 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



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 | 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.


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

Simple usage example:


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('');

} catch (BadResponseException $exception) {



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.


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


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


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.


Tarmo Leppänen


The MIT License (MIT)

Copyright (c) 2018 Protacon