Download the PHP package alsoasked/also-asked-php without Composer
On this page you can find all versions of the php package alsoasked/also-asked-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alsoasked/also-asked-php
More information about alsoasked/also-asked-php
Files in alsoasked/also-asked-php
Package also-asked-php
Short Description A PHP library for the AlsoAsked API
License MIT
Homepage https://alsoasked.com
Informations about the package also-asked-php
AlsoAsked PHP Client
For more information, please visit https://developers.alsoasked.com.
Installation & Usage
Requirements
PHP 7.4 and later.
Composer
To install the bindings via Composer, add the following to composer.json
:
Then run composer install
Examples
Create a client
You'll need to begin by creating a client for the API you wish to use, as well as specify the API key you wish to use.
We do this by first creating an HTTP client respecting the PSR-18 standard.
The \Http\Discovery\Psr18ClientDiscovery
class will automatically discover an PSR-18 HTTP client from the installed composer packages, meaning you'll need an HTTP client installed which implements PSR-18 if you don't already.
A common HTTP client which does is Guzzle, we can install this by running composer require guzzlehttp/guzzle:^7.0
.
The example below creates a client for the Live API by setting a base URI using the \Http\Client\Common\Plugin\BaseUriPlugin
plugin. If you wish to use the Sandbox API, you can change the base URI from https://alsoaskedapi.com/v1
to https://sandbox.alsoaskedapi.com/v1
.
You'll need to change the API specified in the \AlsoAsked\Api\Authentication\ApiKeyAuthentication
plugin from your-api-key
to the API key you've created. If you don't have an API key, follow the authentication guide.
Fetch your account details
Use getAccount
to fetch your account details, this calls the GET /v1/account
API endpoint.
Perform a search
Use performSearch
to perform a search request, this calls the POST /v1/search
API endpoint.
Help
If you need more information, see the developer documentation, or get in touch with us at [email protected].