Skip to content

Commit b09d6d5

Browse files
committed
Readme
1 parent 0aef762 commit b09d6d5

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,53 @@
11
"# wordpress-rest-api-client"
2+
3+
> A Wordpress REST API client for PHP
4+
5+
## Usage
6+
7+
Example:
8+
9+
```php
10+
require 'vendor/autoload.php';
11+
12+
$client = new Reactmore\WordpressClient\Wordpress(new Reactmore\WordpressClient\Request\GuzzleAdapter(new GuzzleHttp\Client()), 'http://domain.com');
13+
14+
// iF WP API DISABLE YOU NEED TO PASS AUTH
15+
// $client->setCredentials(new Reactmore\WordpressClient\Auth\WpBasicAuth('user', 'password'));
16+
17+
// Argument 1 id default Null
18+
// Argumend 2 Array default Null
19+
$posts = $client->posts()->get(1, ['params' => 'Key']);
20+
21+
echo '<pre>';
22+
print_r($posts);
23+
echo '</pre>';
24+
```
25+
26+
Response:
27+
28+
Body = All respon from Wordpress api
29+
Total = Total Item from X-WP-TOTAL
30+
TotalPages = Total Page From X-WP-TOTALPAGE
31+
32+
```Array
33+
Array
34+
(
35+
36+
[body] => Array
37+
(
38+
xxxxxxxxxx
39+
xxxxxxxxxx
40+
)
41+
42+
[total] => Array
43+
(
44+
xxxxxxxxxx
45+
)
46+
47+
[totalpages] => Array
48+
(
49+
xxxxxxxxxx
50+
)
51+
52+
)
53+
```

0 commit comments

Comments
 (0)