-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,30 @@ | ||
# google-image-search | ||
You're able to query google for images using Google's new Custom Search API. | ||
|
||
``` php | ||
ImageSearch::config()->apiKey('API Goes Here'); | ||
ImageSearch::config()->cx('CX Goes Here'); | ||
|
||
ImageSearch::search('civic'); // returns array of results | ||
``` | ||
|
||
## Installation | ||
Use composer to install | ||
|
||
`composer require odannyc/google-image-search` | ||
|
||
## Usage | ||
Set your API and CX string using the config method: | ||
|
||
```php | ||
ImageSearch::config()->apiKey('API Goes Here'); | ||
ImageSearch::config()->cx('CX Goes Here'); | ||
``` | ||
|
||
Once that's done, use the search method to query a specific string of text | ||
|
||
```php | ||
ImageSearch::search('civic'); | ||
``` | ||
|
||
It'll return an array of results. The images are specifically in the `items` key. |