Skip to content
This repository was archived by the owner on Aug 28, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
composer.phar
composer.lock
.DS_Store
.idea/
6 changes: 6 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/laravel-wp-api.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
}
],
"require": {
"php": ">=5.5.0",
"illuminate/support": "~5.2",
"php": "^7.2",
"illuminate/support": "^6|^7",
"guzzlehttp/guzzle": "~6.0"
},
"require-dev": {
"phpunit/phpunit": "4.8.*"
"phpunit/phpunit": "^8.0"
},
"autoload": {
"psr-0": {
"psr-4": {
"Threesquared\\LaravelWpApi\\": "src/"
}
},
Expand Down
13 changes: 5 additions & 8 deletions src/Threesquared/LaravelWpApi/LaravelWpApiServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ public function boot()
*/
public function register()
{
$this->app->singleton(WpApi::class, function ($app) {

$endpoint = $this->app['config']->get('wp-api.endpoint');
$auth = $this->app['config']->get('wp-api.auth');
$client = $this->app->make('GuzzleHttp\Client');

return new WpApi($endpoint, $client, $auth);

$this->app->bind(WpApi::class, function ($app) {
return new WpApi(
$this->app['config']->get('wp-api.endpoint'),
$this->app['config']->get('wp-api.auth')
);
});
}

Expand Down
6 changes: 3 additions & 3 deletions src/Threesquared/LaravelWpApi/WpApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class WpApi
* @param Client $client
* @param string $auth
*/
public function __construct($endpoint, Client $client, $auth = null)
public function __construct($endpoint, $auth = null)
{
$this->endpoint = $endpoint;
$this->client = $client;
$this->auth = $auth;
$this->client = new Client();
}

/**
Expand Down Expand Up @@ -100,7 +100,7 @@ public function page($slug)
*/
public function categories()
{
return $this->get('taxonomies/category/terms');
return $this->get('categories');
}

/**
Expand Down