PHPackages                             priceva/priceva-api-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. priceva/priceva-api-sdk-php

ActiveLibrary

priceva/priceva-api-sdk-php
===========================

This SDK offers user many instruments needed to interact with Priceva API

013↓66.7%PHP

Since Oct 1Pushed 7mo agoCompare

[ Source](https://github.com/priceva/priceva-api-sdk-php)[ Packagist](https://packagist.org/packages/priceva/priceva-api-sdk-php)[ RSS](/packages/priceva-priceva-api-sdk-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Priceva API (PHP) Software Development Kit.
===========================================

[](#priceva-api-php-software-development-kit)

1. Introduction
---------------

[](#1-introduction)

This SDK offers user many instruments needed to interact with our API in safe and convenient manner. Below is some basic explanation what this SDK is capable of:

- validation of input parameters individually for each API method.
- throwing of Exceptions with detailed information during all stages of processing
- convenient pagination instruments, utilizing Iterator Interface and its methods.
- documented functions, and links to API documentation for all methods.
- integrated capability to work with API`s limits. User has possibility to set rules for waiting and repeating API calls.
- integrated validation of API response, ability to get the response in the form of array or JSON string,
- ability to get response`s detailed service information
- PSR4-compatible realization
- ability to include library using Composer, or php`s `include` command (proprietary autoloader is provided)

2. Getting Started
------------------

[](#2-getting-started)

### Requirements

[](#requirements)

> - PHP &gt;= 7.2
> - cURL library -
> - JSON library () - if you are using PHP version 8 or higher you don't need to install JSON module, as it is included in PHP by default. check below for example of basic `composer.json` file configuration.
> - You have to be registered Priceva user with valid API key in order to use this SDK.

3. Installing
-------------

[](#3-installing)

### Using Composer

[](#using-composer)

in the CLI, from your project root directory run the following command:

```
php composer require priceva/priceva-api-sdk-php
```

Alternatively, you can add this string in `require` section of your `composer.json`:

```
"priceva/priceva-api-sdk-php": "dev-master"

```

so that your composer.json will look like this:

```
{
  "require": {
    "ext-json": "*",
    "ext-curl": "*",
    "php": ">=7.2",
    "priceva/priceva-api-sdk-php": "dev-main"
  },
  "require-dev": {
    "phpunit/php-code-coverage": "9.2.29",
    "phpunit/phpunit": "9.5"
  }
}

```

and run `composer install`.

### Without the Composer

[](#without-the-composer)

1. Download our library at
2. Include files in your php root file, and then call a register() function:

```
include_once __DIR__ .'/path/to/file/priceva-api-sdk-php/PricevaAutoload.php';
PricevaAutoload::register();
```

4. Examples of usage:
---------------------

[](#4-examples-of-usage)

### Basic usage example #1 (ping Priceva API):

[](#basic-usage-example-1-ping-priceva-api)

```
use Priceva\APISDK\PricevaApiConnector;
use Priceva\APISDK\CommonRequestProvider;
use Priceva\APISDK\Exception\PricevaException;

//get your API key from app.priceva.com
$apikey  = 'xxxxxxxxx';
$apiconn = new PricevaApiConnector($apikey);

try {
    // use RequestProvider to get the needed API object and method
    $ping_request = CommonRequestProvider::main()::ping();
    // call() method performs all checks and executes an API call
    $response = $apiconn->call($ping_request);
    if ( $response->is_success() ) {
        echo "Success";
    }
} catch ( PricevaException $e ) {
    // error handler here
}
```

### Basic usage example #2 (requesting list of products with specific filters)

[](#basic-usage-example-2-requesting-list-of-products-with-specific-filters)

```
use Priceva\APISDK\PricevaApiConnector;
use Priceva\APISDK\PriceMonitoringRequestProvider;
use Priceva\APISDK\Exception\PricevaException;

$apikey = 'xxxxxxxxx';
$apiconn = new PricevaApiConnector($apikey);

try {
    $request = PriceMonitoringRequestProvider::product()::list();
    // add your request parameters as an array
    // see a list of VALID_PARAMS in corresponding Request object.
    $request->set_params_array([
                               'filters' => [
                                   'limit' => 10,
                                   'page'  => 3,
                                   'name'  => 'Yamaha',
                               ],
                               'sources' => [
                                   'add' => true,
                               ],
                           ]);

    // or you can add each parameter individually, using each object`s specific methods.
    $request->filters_category_id_set([ '2', '1', '0', 'u' ]);
    $request->filters_brand_id_set([ 'b', 'c' ]);

    $result = $apiconn->call($request);

} catch ( PricevaException $e ) {
    // error handler
}
```

### Basic pagination usage example #3 (requesting list of products page by page):

[](#basic-pagination-usage-example-3-requesting-list-of-products-page-by-page)

for additional info see

```
use Priceva\APISDK\PricevaApiConnector;
use Priceva\APISDK\PriceMonitoringRequestProvider;
use Priceva\APISDK\Exception\PricevaException;
use Priceva\APISDK\Lib\RequestIteratorAggregate;

$apikey = 'xxxxxxxxx';
$apiconn = new PricevaApiConnector($apikey);

try {
    $request = PriceMonitoringRequestProvider::product()::list();
    // add your request parameters as an array
    $request->set_params_array([
                                   'filters' => [
                                       'limit' => 50,
                                       'name'  => 'Fender',
                                   ],
                               ]);

    $iterated_request = new RequestIteratorAggregate($request, $apiconn);
    foreach ( $iterated_request as $page ) {
        ...
    };
} catch ( PricevaException $e ) {
    // error handler
}
```

### basic working with limits example #4:

[](#basic-working-with-limits-example-4)

for additional info see

```
use Priceva\APISDK\PricevaApiConnector;
use Priceva\APISDK\PriceMonitoringRequestProvider;
use Priceva\APISDK\Exception\PricevaException;
use Priceva\APISDK\Lib\ApiCallRepeatsSettings;

$apikey = 'xxxxxxxxx';
/**
 * with ApiCallRepeatsSettings it is possible to set maximum amount of time for which a call can be delayed,
 * total time that can be spent waiting for API calls to be repeated,
 * and maximum number of repeated API calls that can be made.
 * Also, there are individual methods for each parameter,
 * set_max_call_delay_time(), set_max_repeats() and set_max_total_wait_time()
 */

$repeat_settings = new ApiCallRepeatsSettings(20, 10, 2);
$apiconn = new PricevaApiConnector($apikey, $repeat_settings);

try {
    $request = PriceMonitoringRequestProvider::product()::list();
    $list    = $apiconn->call($request);
} catch ( PricevaException $e ) {
    // error handler
}
```

5. File structure and classes
-----------------------------

[](#5-file-structure-and-classes)

### RequestProviders

[](#requestproviders)

Priceva SDK consists of three RequestProvider objects:

1. PriceMonitoringRequestProvider, contains objects for campaign types: "Competitor price monitoring for online stores" and "Price level monitoring (MAP) for brands and manufacturers"
2. AssortmentRequestProvider, contains objects for Digital Shelf Analytics campaigns.
3. CommonRequestProvider, contains objects for API general availability checks and testing.

Each request provider has methods that return corresponding object, which in turn contains specific objects`s methods. For example, PriceMonitoringRequestProvider contains tag() method, which in turn returns Tag object, which in turn contains list(), create(), update(), delete() methods, which return specific Request object. See part 4 (Examples of usage) for detailed syntax.

### Request class

[](#request-class)

Each Request contains `API_OBJECT` field (e.g.`tag`) and 'API\_METHOD' field (e.g. `update`), so basically a call will be made to . All Request objects contain 'VALID\_PARAMS' field, a tree of parameters that can be set for this specific API object and method. Before making an actual API call, these parameters are checked for any potential errors (self\_check() method), these errors (if any occur) are collected to a list of errors, and an Exception with detailed errors information is thrown. If no error occurs, API proceeds with normal API call procedure.

### PricevaApiConnector

[](#pricevaapiconnector)

PricevaApiConnector is a class that executes a call to Priceva API. PricevaApiConnector takes API key (string) as required parameter, and ApiCallRepeatsSettings(explained below) object as optional parameter. A Request object must be provided as an argument for PricevaApiConnector`s call() method. After a call is executed, if call is successful, the Response object (explained below) is returned.

### Response

[](#response)

Response is an object that is produced by PricevaApiConnector after an API call is executed. Beside the 'result' field, which self-explanatory, contains the results of API call, response also contains detailed info on executed call, such as:

- time of execution,
- timestamp on API machine, 'api\_timestamp' field,
- date on API machine,
- timestamp on local machine,
- warnings array and number of warnings,
- errors array and number of errors,
- current page and total number of pages,
- 'has\_errors' flag, if any errors occurred,
- 'raw\_json\_output', that contains original JSON string received from Priceva API.

For all these fields there are getter methods in Response object, so all these fields can be accessed if needed.

### ApiCallRepeatsSettings

[](#apicallrepeatssettings)

In order to restrain the frequency and overuse of Priceva API, the API has some limits. Basically this is amount of calls that can be made in the set time period. See  for more detailed info on Priceva API limits.

When API limits are reached, next API call time is returned is Response`s errors field. This is where ApiCallRepeatsSettings come to action. This SDK allows to delay a call until a next\_call\_time is reached, and then execute a call.

ApiCallRepeatsSettings allows to set maximum amount of time for which a call can be delayed, total time that can be spent waiting for API calls to be repeated, and maximum number of repeated API calls that can be made. These settings can be given as arguments upon class creation, and also there are individual methods for setting each parameter: set\_max\_call\_delay\_time(), set\_max\_repeats() and set\_max\_total\_wait\_time().

In order to make use of ApiCallRepeatsSettings, PricevaApiConnector takes this object as a second (optional) parameter upon its initialization (first being api\_key string). See an example of usage in section #4.

### RequestIterator.

[](#requestiterator)

In order to get multiple pages of objects from Priceva API in one operation, this SDK provides pagination tools. RequestIteratorAggregate is an external iterator for RequestIterator, used to iterate over Request and Response objects. It takes Request object, PricevaApiConnector object as required arguments, and as an optional parameter number of page to start iterations from ($iterator\_start\_page). Iteration is best used in conjunction with ApiCallRepeatsSettings, as it makes possible to execute more API requests in a single operation than otherwise could be possible.

See example in section #4 to see how to make use of RequestIterator.

6. Additional information
-------------------------

[](#6-additional-information)

Read more about our API [here](https://priceva.docs.apiary.io/#introduction).

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance45

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ed7d701bcf29d27f7deb9aa24699227ebdc34dc54a06c7518f06d7dd2c7c04aa?d=identicon)[Priceva](/maintainers/Priceva)

---

Top Contributors

[![Sfairet](https://avatars.githubusercontent.com/u/21312929?v=4)](https://github.com/Sfairet "Sfairet (2 commits)")

### Embed Badge

![Health badge](/badges/priceva-priceva-api-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/priceva-priceva-api-sdk-php/health.svg)](https://phpackages.com/packages/priceva-priceva-api-sdk-php)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
