Skip to content

Commit 8b06e4b

Browse files
committed
README fixes [ci skip]
1 parent 6677259 commit 8b06e4b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ Simplest possible use case:
2525

2626
```php
2727
$diffbot = new Diffbot('my_token');
28-
29-
$articleApi = $diffbot->createArticleAPI('http://www.sitepoint.com/diffbot-crawling-visual-machine-learning/');
28+
$url = 'http://www.sitepoint.com/diffbot-crawling-visual-machine-learning/';
29+
$articleApi = $diffbot->createArticleAPI($url);
3030

3131
echo $articleApi->call()->author; // prints out "Bruno Skvorc"
3232
```
@@ -66,8 +66,8 @@ All APIs can also be tested on http://diffbot.com
6666

6767
The API you picked can be spawned through the main Diffbot instance:
6868

69-
```
70-
$api = $diffbot->createArticleAPI('http://www.sitepoint.com/diffbot-crawling-visual-machine-learning/');
69+
```php
70+
$api = $diffbot->createArticleAPI($url);
7171
```
7272

7373
### API configuration
@@ -90,12 +90,15 @@ All config methods are chainable:
9090
$api->setMeta(true)->setDiscussion(false);
9191
```
9292

93+
For an overview of all the config fields and the values each API returns, see [here](https://www.diffbot.com/dev/docs).
94+
9395
### Calling
9496

9597
All API instances have the `call` method which returns a collection of results. The collection is iterable:
9698

9799
```php
98-
$imageApi = $diffbot->createImageAPI('http://smittenkitchen.com/blog/2012/01/buckwheat-baby-with-salted-caramel-syrup/');
100+
$url = 'http://smittenkitchen.com/blog/2012/01/buckwheat-baby-with-salted-caramel-syrup/';
101+
$imageApi = $diffbot->createImageAPI($url);
99102
/** @var Image $imageEntity */
100103
foreach ($imageApi->call() as $imageEntity) {
101104
echo 'Image dimensions: ' . $imageEntity->getHeight() . ' x ' . $imageEntity->getWidth() . '<br>';
@@ -114,7 +117,7 @@ Image dimensions: 333 x 500
114117
*/
115118
```
116119

117-
In cases where only one entity is returned, like Article or Product, iterating works all the same, it just iterates through through the one single elements. The return data is **always** a collection!
120+
In cases where only one entity is returned, like Article or Product, iterating works all the same, it just iterates through the one single elements. The return data is **always** a collection!
118121

119122
However, for brevity, you can access properties directly on the collection, too.
120123

0 commit comments

Comments
 (0)