spinque/query-api

PHP query API for spinque desk

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 0

Open Issues: 0

pkg:composer/spinque/query-api

v0.0.1 2023-10-03 14:36 UTC

This package is not auto-updated.

Last update: 2026-01-21 23:19:25 UTC


README

Library to use the Spinque Query API in your PHP project.

The Spinque Query API is an HTTP API to retrieve search results for queries. Also check out the documentation of the Spinque Query API.

Installing

This package can be used through composer. In your composer.json file, specify:

  "require": {
      "spinque/query-api": "dev-main"
  }

then, in order to install the dependencies for your project:

$ php composer.phar update

Documentation

For documentation on the Spinque Query API itself, please see this.

Defining queries

<?php

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

$api = new Api(
    array(
        'workspace' => 'course-chris',
        'config' => 'default',
        'api' => 'movies'
    )
);


$queries = [
    new Query('movie_search', array('query' => 'Keanu Reeves'))
];

try {
    echo $api->fetch($queries);
} catch (Exception $e) {
    echo $e;
}

Authentication

Some Spinque APIs require authentication using OAuth 2.0. Support for the Client Credentials flow (for server applications) is provided through this library:

<?php

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

$api = new Api(
    array(
        'workspace' => 'course-chris',
        'config' => 'default',
        'api' => 'movies',
        'authentication' => array(
            'authServer' => 'https://login.spinque.com',
            'clientId' => '<CLIENT-ID>',
            'clientSecret' => '<CLIENT-SECRET>',
        )
    )
);

Note: the Client ID and Client Secret can be generated by creating a new System-to-System account in the Settings > Team Members section of Spinque Desk.