Skip to content

Commit 5ab8629

Browse files
author
iamquan
committed
Update Usage
1 parent a18f8e6 commit 5ab8629

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Loading Files
3737
You may also seamlessly load a file into the dom instead of a string, which is much more convinient and is how I except most developers will be loading the html. The following example is taken from our test and uses the "big.html" file found there.
3838

3939
```php
40+
// Assuming you installed from Composer:
41+
require "vendor/autoload.php";
4042
use PHPHtmlParser\Dom;
4143

4244
$dom = new Dom;
@@ -68,6 +70,8 @@ Loading Url
6870
Loading a url is very similar to the way you would load the html from a file.
6971

7072
```php
73+
// Assuming you installed from Composer:
74+
require "vendor/autoload.php";
7175
use PHPHtmlParser\Dom;
7276

7377
$dom = new Dom;
@@ -82,6 +86,8 @@ $html = $dom->outerHtml; // same result as the first example
8286
What makes the loadFromUrl method note worthy is the `PHPHtmlParser\CurlInterface` parameter, an optional second parameter. By default, we use the `PHPHtmlParser\Curl` class to get the contents of the url. On the other hand, though, you can inject your own implementation of CurlInterface and we will attempt to load the url using what ever tool/settings you want, up to you.
8387

8488
```php
89+
// Assuming you installed from Composer:
90+
require "vendor/autoload.php";
8591
use PHPHtmlParser\Dom;
8692
use App\Services\Connector;
8793

@@ -98,6 +104,8 @@ Loading Strings
98104
Loading a string directly, with out the checks in `load()` is also easely done.
99105

100106
```php
107+
// Assuming you installed from Composer:
108+
require "vendor/autoload.php";
101109
use PHPHtmlParser\Dom;
102110

103111
$dom = new Dom;
@@ -113,6 +121,8 @@ Options
113121
You can also set parsing option that will effect the behavior of the parsing engine. You can set a global option array using the `setOptions` method in the `Dom` object or a instance specific option by adding it to the `load` method as an extra (optional) parameter.
114122

115123
```php
124+
// Assuming you installed from Composer:
125+
require "vendor/autoload.php";
116126
use PHPHtmlParser\Dom;
117127

118128
$dom = new Dom;

0 commit comments

Comments
 (0)