https://github.com/shutterstock/php-shutterstock-api
PHP Client to interact with the Shutterstock API
https://github.com/shutterstock/php-shutterstock-api
guzzle php php-client shutterstock-api
Last synced: 7 months ago
JSON representation
PHP Client to interact with the Shutterstock API
- Host: GitHub
- URL: https://github.com/shutterstock/php-shutterstock-api
- Owner: shutterstock
- License: other
- Created: 2016-03-04T17:48:06.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T18:27:58.000Z (over 2 years ago)
- Last Synced: 2025-04-13T11:49:55.361Z (9 months ago)
- Topics: guzzle, php, php-client, shutterstock-api
- Language: PHP
- Homepage: https://developers.shutterstock.com/
- Size: 50.8 KB
- Stars: 7
- Watchers: 22
- Forks: 5
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Demo Client for Shutterstock API
PHP client that utilizes Guzzle to interact with the [Shutterstock API](https://developers.shutterstock.com/).
[](https://travis-ci.org/jacobemerick/php-shutterstock-api)
[](https://codeclimate.com/github/jacobemerick/php-shutterstock-api)
[](https://codeclimate.com/github/jacobemerick/php-shutterstock-api/coverage)
[](https://scrutinizer-ci.com/g/jacobemerick/php-shutterstock-api/?branch=master)
## Installation
Use [Composer](https://getcomposer.org/) to install the dependencies.
```bash
$ composer require shutterstock/api
```
## Usage
Instantiating the client requires passing in your client id and secret, which you can register for on the [Shutterstock Developers site](https://developers.shutterstock.com/).
```php
get('images/search', array('query' => 'puppies'));
// retrieve details for a handful of image ids
$client->get('images', array('id' => array(1, 2, 3)));
// create a lightbox
$client->post('images/collections', array('name' => 'Lightbox Name Here'));
```
Each request will return a PSR-7 response object, which you can read about on the [Guzzle/PSR7 repo](https://github.com/guzzle/psr7). The response object bodies have been decorated with a JsonSerializable interface to allow easier handling of the default API responses.
```php
$imageResponse = $client->get('images', array('id' => array(1, 2, 3)));
if ($imageResponse->getStatusCode() != 200) {
// error handler
}
$images = $imageResponse->getBody()->jsonSerialize()['data'];
// etc
```
If your application is setup to handle async CURL requests, you can also make `Client::getAsync` and `Client::postAsync` calls, which return [Guzzle Promises](https://github.com/guzzle/promises).
For more examples and a demo application using this client, see [LINK HERE].
## License
[Apache 2.0](LICENSE) © 2016-2017 Shutterstock Images, LLC