Vendasta PHP Citations SDK
The PHP SDK is available on Packagist. This allows for simple composer installation. Check out our PHP packages at https://packagist.org/packages/vendasta/citations
Creating a Client
You'll use the client to interact with either our test or production servers.
$client = new Client(Environments::TEST, $token);
Quickstart
- Follow the installation instructions in the root README, paste the static token we gave you into test_client.php, then run:
php example/test_client.php
Objects
Environment
This is an enumerator with two options: TEST
, PRODUCTION
.
Client
- The Client you'll use to interact with the citations server.
function Client($environment, $token);
-
token
string: A static token we give you for authentication. -
environment
Environment: An Environment Enum (includesTEST
,PRODUCTION
)
Methods
// Returns the list of citations that occurred between $startTime and $endTime
function GetByRange($accountId, $startTime, $endTime);
-
accountId
string: The accountId to retrieve the citations for. (i.e: AG-1234) -
startTime
\google\protobuf\Timestamp: A Timestamp object representing the start date you want to retrieve citations for. -
endTime
\google\protobuf\Timestamp: A Timestamp object representing the end date you want to retrieve citations for.
Citation
The Citation class represents a mention of a business outside of an explicit business listing.
Fields
-
accountId
: string => This is the ID for the account the citation is associated with. -
url
: string => The URL where the citation can be found. -
title
: string => The title of the citation. This is just the citation location's HTML page title. -
created
: Timestamp => The time we discovered the citation.
Empty
This is an empty object from gRPC.
gRPC docs: https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Empty
- It has no fields.
- We have had to modify the gRPC library, as Empty is a reserved word in php. The class is renamed to
RealEmpty
.
Timestamp
A Timestamp object representing time as seconds since Epoch.
-
seconds
: number => The number of seconds after (positive) or before (negative) the 1970 Epoch. -
nanos
: number => The fractional portion of the last second, in nanoseconds. This number must always be positive or zero, even for negative timestamps.
Development
- Clone the repository
- run
composer install
- follow the install instructions in the ROOT.