diff --git a/.gitignore b/.gitignore
index 5826402..225319b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
composer.phar
composer.lock
.DS_Store
+.idea/
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..450e5b3
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,6 @@
+# Default ignored files
+<<<<<<< Updated upstream
+/workspace.xml
+=======
+/workspace.xml
+>>>>>>> Stashed changes
diff --git a/.idea/laravel-wp-api.iml b/.idea/laravel-wp-api.iml
new file mode 100644
index 0000000..67c1c91
--- /dev/null
+++ b/.idea/laravel-wp-api.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..28a804d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..f94f9fd
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
new file mode 100644
index 0000000..07f31c0
--- /dev/null
+++ b/.idea/php.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 0bb77a8..53bdfa1 100755
--- a/composer.json
+++ b/composer.json
@@ -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/"
}
},
diff --git a/src/Threesquared/LaravelWpApi/LaravelWpApiServiceProvider.php b/src/Threesquared/LaravelWpApi/LaravelWpApiServiceProvider.php
index edafa52..84f29b1 100755
--- a/src/Threesquared/LaravelWpApi/LaravelWpApiServiceProvider.php
+++ b/src/Threesquared/LaravelWpApi/LaravelWpApiServiceProvider.php
@@ -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')
+ );
});
}
diff --git a/src/Threesquared/LaravelWpApi/WpApi.php b/src/Threesquared/LaravelWpApi/WpApi.php
index 74971dc..99a0f51 100755
--- a/src/Threesquared/LaravelWpApi/WpApi.php
+++ b/src/Threesquared/LaravelWpApi/WpApi.php
@@ -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();
}
/**
@@ -100,7 +100,7 @@ public function page($slug)
*/
public function categories()
{
- return $this->get('taxonomies/category/terms');
+ return $this->get('categories');
}
/**