PHPackages                             semantics3/semantics3-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. [API Development](/categories/api)
4. /
5. semantics3/semantics3-php

AbandonedArchivedLibrary[API Development](/categories/api)

semantics3/semantics3-php
=========================

PHP library bindings for the Semantics3 APIs

2482.2k↓46.9%21[2 PRs](https://github.com/Semantics3/semantics3-php/pulls)PHP

Since Jul 13Pushed 5y ago7 watchersCompare

[ Source](https://github.com/Semantics3/semantics3-php)[ Packagist](https://packagist.org/packages/semantics3/semantics3-php)[ RSS](/packages/semantics3-semantics3-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

semantics3-php
==============

[](#semantics3-php)

semantics3-php is the PHP bindings for accessing the Semantics3 Products API, which provides structured information, including pricing histories, for a large number of products. See  for more information.

Quickstart guide: API documentation can be found at

Installation
------------

[](#installation)

semantics3-php can be installed through composer:

```
php composer.phar install
```

To install the latest source from the repository

```
git clone https://github.com/Semantics3/semantics3-php.git
```

Getting Started
---------------

[](#getting-started)

In order to use the client, you must have both an API key and an API secret. To obtain your key and secret, you need to first create an account at You can access your API access credentials from the user dashboard at .

### Setup Work

[](#setup-work)

Let's lay the groundwork.

```
require('lib/Semantics3.php');

# Set up a client to talk to the Semantics3 API using your Semantics3 API Credentials
$key = 'SEM3xxxxxxxxxxxxxxxxxxxxxx';
$secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

$requestor = new Semantics3_Products($key,$secret);
```

### First Request aka 'Hello World':

[](#first-request-aka-hello-world)

Let's run our first request! We are going to run a simple search fo the word "iPhone" as follows:

```
# Build the request
$requestor->products_field( "search", "iphone" );

# Run the request
$results = $requestor->get_products();

# View the results of the request
echo $results;
```

Sample Requests
---------------

[](#sample-requests)

The following requests show you how to interface with some of the core functionality of the Semantics3 Products API. For more detailed examples check out the Quickstart guide:

### Pagination

[](#pagination)

The example in our "Hello World" script returns the first 10 results. In this example, we'll scroll to subsequent pages, beyond our initial request:

```
# Build the request
$requestor->products_field( "search", "iphone" );

# Run the request
$results = $requestor->get_products();

# View the results of the request
echo $results;

$page = 0
while ($results = $requestor->iterate_products()) {
    $page++;
    echo "We are at page = $page\n";
    echo "The results for this page are:\n";
    echo $results;
}
```

### UPC Query

[](#upc-query)

Running a UPC/EAN/GTIN query is as simple as running a search query:

```
# Build the request
$requestor->products_field( "upc", "883974958450" );
$requestor->products_field( "field", ["name","gtins"] );

# Run the request
$results = $requestor->get_products();

# View the results of the request
echo $results;
```

### URL Query

[](#url-query)

Get the picture? You can run URL queries as follows:

```
$requestor->products_field( "url", "http://www.walmart.com/ip/15833173" );
$results = $requestor->get_products();
echo $results;
```

### Price Filter

[](#price-filter)

Filter by price using the "lt" (less than) tag:

```
$requestor->products_field( "search", "iphone" );
$requestor->products_field( "price", "lt", 300 );
$results = $requestor->get_products();
echo $results;
```

### Category ID Query

[](#category-id-query)

To lookup details about a cat\_id, run your request against the categories resource:

```
# Build the request
$requestor->categories_field("cat_id", "4992");

# Run the request
$results = $requestor->get_products();

# View the results of the request
echo $results;
```

Webhooks
--------

[](#webhooks)

You can use webhooks to get near-real-time price updates from Semantics3.

### Creating a webhook

[](#creating-a-webhook)

You can register a webhook with Semantics3 by sending a POST request to `"webhooks"` endpoint. To verify that your URL is active, a GET request will be sent to your server with a `verification_code` parameter. Your server should respond with `verification_code` in the response body to complete the verification process.

```
$params["webhook_uri"] = "http://mydomain.com/webhooks-callback-url";

$results = $requestor->run_query("webhooks", $params, "POST");
echo $results;
```

To fetch existing webhooks

```
$results = $requestor->run_query("webhooks", null);
echo $results;
```

To remove a webhook

```
$webhook_id = "7JcGN81u";

$endpoint = "webhooks/" . $webhook_id;

$results = $requestor->run_query($endpoint, null, "DELETE");
echo $results;
```

### Registering events

[](#registering-events)

Once you register a webhook, you can start adding events to it. Semantics3 server will send you notifications when these events occur. To register events for a specific webhook send a POST request to the `"webhooks/{webhook_id}/events"` endpoint

```
$params = array(
    "type" => "price.change",
    "product" => array(
        "sem3_id" => "1QZC8wchX62eCYS2CACmka"
    ),
    "constraints" => array(
        "gte" => 10,
        "lte" => 100
    )
);

$webhook_id = "7JcGN81u";
$endpoint = "webhooks/" . $webhook_id . "/events";

$results = $requestor->run_query($endpoint, $params, "POST");
echo $results;
```

To fetch all registered events for a give webhook

```
$webhook_id = "7JcGN81u";
$endpoint = "webhooks/" . $webhook_id . "/events";

$results = $requestor->run_query($endpoint, $params, "GET");
echo $results;
```

### Webhook Notifications

[](#webhook-notifications)

Once you have created a webhook and registered events on it, notifications will be sent to your registered webhook URI via a POST request when the corresponding events occur. Make sure that your server can accept POST requests. Here is how a sample notification object looks like

```
{
    "type": "price.change",
    "event_id": "XyZgOZ5q",
    "notification_id": "X4jsdDsW",
    "changes": [{
        "site": "abc.com",
        "url": "http://www.abc.com/def",
        "previous_price": 45.50,
        "current_price": 41.00
    }, {
        "site": "walmart.com",
        "url": "http://www.walmart.com/ip/20671263",
        "previous_price": 34.00,
        "current_price": 42.00
    }]
}
```

Troubleshooting
---------------

[](#troubleshooting)

If you are getting "Exception CURL error: SSL certificate problem, verify that the CA cert is OK" or similar, that indicates problem with the remote SSL certificate.

To fix this, you should just pass array(CURLOPT\_SSL\_VERIFYPEER =&gt; false) as the $curl\_options parameter in OAuthRequester::requestRequestToken.

Or alternatively, if you are using ubuntu, you may do:

```
sudo apt-get install --reinstall ca-certificates
```

Contributing
------------

[](#contributing)

Use GitHub's standard fork/commit/pull-request cycle. If you have any questions, email .

Author
------

[](#author)

- Vinoth Gopinathan

Copyright
---------

[](#copyright)

Copyright (c) 2015 Semantics3 Inc.

License
-------

[](#license)

```
The "MIT" License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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/c279af938ea9856bf9fa18ebc4641b64088a183c2d4852202f88b706445115a4?d=identicon)[vinothgopi](/maintainers/vinothgopi)

---

Top Contributors

[![amarnus](https://avatars.githubusercontent.com/u/206135?v=4)](https://github.com/amarnus "amarnus (2 commits)")[![janhartigan](https://avatars.githubusercontent.com/u/580052?v=4)](https://github.com/janhartigan "janhartigan (1 commits)")[![maggielove](https://avatars.githubusercontent.com/u/14114500?v=4)](https://github.com/maggielove "maggielove (1 commits)")[![sem3admin](https://avatars.githubusercontent.com/u/74282939?v=4)](https://github.com/sem3admin "sem3admin (1 commits)")[![vinothgopi](https://avatars.githubusercontent.com/u/515151?v=4)](https://github.com/vinothgopi "vinothgopi (1 commits)")

### Embed Badge

![Health badge](/badges/semantics3-semantics3-php/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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