Download the PHP package freespoke/partner without Composer
On this page you can find all versions of the php package freespoke/partner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download freespoke/partner
More information about freespoke/partner
Files in freespoke/partner
Package partner
Short Description A client library for interacting with the Freespoke Partner API
License MIT
Informations about the package partner
Freespoke Partner API PHP Client
A lightweight PHP client for the Freespoke Partner API REST gateway.
Requirements
- PHP 8.0+
- Guzzle 7.10+
- league/oauth2-client 2.7+ (for client credentials auth)
Installation
If installing from GitHub, add a VCS repository entry and require it:
Quickstart
Client construction
API key (static token)
Use the static helper:
Or inject your own Guzzle instance (for custom timeouts, retries, proxies, etc):
OAuth2 client credentials
For service accounts, use createWithClientCredentials(). The client will exchange the client ID and secret for an access token automatically and refresh it when it expires.
Both tokenURL and baseURL can be overridden if needed (e.g. for testing or local development).
Authentication
Both authentication modes produce the same HTTP header on every request:
With Client::create(), you provide the token directly. With Client::createWithClientCredentials(), the token is obtained (and refreshed) from the OAuth2 token endpoint automatically.
Data model
Article
Required fields:
url(string)title(string)content(string)publish_time(DateTimeInterface)authors(set viasetAuthors())
Optional fields:
description(string)keywords(string[])image_url(string)
Person
Optional fields:
id(string)name(string)url(string)bias(float)twitter_id(string)facebook_id(string)
API methods
Index content
Submit an article to Freespoke for indexing. The API responds with a job token you can poll for completion.
Returns IndexResult with job_id and workflow_id when successful. Returns null if the API responds with errorMessage/error_message or if required fields are missing in the response body.
Check indexing status
Poll the status of a previously submitted indexing job.
Returns IndexStatusResult or null if the response body does not include a job object. The status field maps to the Partner API job status values (JOB_STATUS_PENDING, JOB_STATUS_COMPLETE, JOB_STATUS_FAILED).
Epoch
Check whether the indexing requirements have changed so you can decide when to re-submit content.
Returns the API epoch as an int. If the response body is missing the field, the client returns 0.
An epoch is a unix timestamp. If the most recent moment at which a URL was published to the Freespoke API is before the epoch value, the URL should be resubmitted.
Error handling
The client does not swallow HTTP or network errors. Guzzle will throw a RequestException for non-2xx responses and transport failures. Wrap calls in try/catch if you want to handle these explicitly.
Further Reading
Visit the Integration Guide for more information.
Testing
License
MIT