Skip to content
This repository was archived by the owner on Aug 28, 2021. It is now read-only.

Commit d2c2c05

Browse files
Ben Speakmanvagrant
authored andcommitted
Rename vendor, update guzzle and add test
1 parent 665191e commit d2c2c05

File tree

9 files changed

+346
-187
lines changed

9 files changed

+346
-187
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: php
22

33
php:
4-
- 5.4
54
- 5.5
65
- 5.6
76
- hhvm

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
# laravel-wp-api
2-
Laravel 5 package for the [Wordpress JSON REST API](https://github.com/WP-API/WP-API)
2+
3+
[![Build Status](https://travis-ci.org/threesquared/laravel-wp-api.svg?branch=master)](https://travis-ci.org/threesquared/laravel-wp-api) [![Latest Stable Version](https://poser.pugx.org/threesquared/laravel-wp-api/v/stable)](https://packagist.org/packages/threesquared/laravel-wp-api)
4+
5+
Laravel 5 package for the [Wordpress JSON REST API](https://github.com/WP-API/WP-API)
36

47
## Install
58

69
Simply add the following line to your `composer.json` and run install/update:
710

8-
"cyberduck/laravel-wp-api": "~1.0"
11+
"threesquared/laravel-wp-api": "~2.0"
912

1013
## Configuration
1114

1215
Publish the package config files to configure the location of your Wordpress install:
1316

1417
php artisan vendor:publish
1518

16-
You will also need to add the service provider and optionally the facade alias to your `app/config/app.php`:
19+
You will also need to add the service provider and optionally the facade alias to your `config/app.php`:
1720

1821
```php
1922
'providers' => array(
20-
'Cyberduck\LaravelWpApi\LaravelWpApiServiceProvider'
23+
Threesquared\LaravelWpApi\LaravelWpApiServiceProvider::class
2124
)
2225

2326
'aliases' => array(
24-
'WpApi' => 'Cyberduck\LaravelWpApi\Facades\WpApi'
27+
'WpApi' => Threesquared\LaravelWpApi\Facades\WpApi::class
2528
),
2629
```
2730

2831
### Usage
2932

3033
The package provides a simplified interface to some of the existing api methods documented [here](http://wp-api.org/).
31-
You can either use the Facade provided or inject the WpApi class.
34+
You can either use the Facade provided or inject the `Threesquared\LaravelWpApi\WpApi` class.
3235

3336
#### Posts
3437
```php
@@ -62,7 +65,19 @@ WpApi::tags();
6265

6366
#### Category posts
6467
```php
65-
WpApi::category_posts($slug, $page);
68+
WpApi::categoryPosts($slug, $page);
69+
70+
```
71+
72+
#### Author posts
73+
```php
74+
WpApi::authorPosts($slug, $page);
75+
76+
```
77+
78+
#### Tag posts
79+
```php
80+
WpApi::tagPosts($slug, $page);
6681

6782
```
6883

composer.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
{
2-
"name": "cyberduck/laravel-wp-api",
2+
"name": "threesquared/laravel-wp-api",
33
"description": "Laravel package for the Wordpress JSON REST API",
44
"keywords": ["laravel", "package", "wordpress", "API", "REST"],
55
"license": "MIT",
66
"authors": [
77
{
88
"name": "Ben Speakman",
9-
"email": "ben@cyber-duck.co.uk"
9+
"email": "ben@3sq.re"
1010
}
1111
],
1212
"require": {
13-
"php": ">=5.4.0",
14-
"illuminate/support": "~5.0|~5.1",
15-
"guzzlehttp/guzzle": "~5.0"
13+
"php": ">=5.5.0",
14+
"illuminate/support": "~5.0",
15+
"guzzlehttp/guzzle": "~6.0"
16+
},
17+
"require-dev": {
18+
"phpunit/phpunit": "4.8.*"
1619
},
1720
"autoload": {
1821
"psr-0": {
19-
"Cyberduck\\LaravelWpApi\\": "src/"
22+
"Threesquared\\LaravelWpApi\\": "src/"
2023
}
2124
},
2225
"minimum-stability": "stable"

src/Cyberduck/LaravelWpApi/LaravelWpApiServiceProvider.php

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/Cyberduck/LaravelWpApi/WpApi.php

Lines changed: 0 additions & 112 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<?php namespace Cyberduck\LaravelWpApi\Facades;
1+
<?php namespace Threesquared\LaravelWpApi\Facades;
22

33
use Illuminate\Support\Facades\Facade;
44

55
class WpApi extends Facade {
66

77
protected static function getFacadeAccessor() { return 'wp-api'; }
88

9-
}
9+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php namespace Threesquared\LaravelWpApi;
2+
3+
use Illuminate\Support\ServiceProvider;
4+
5+
class LaravelWpApiServiceProvider extends ServiceProvider
6+
{
7+
8+
/**
9+
* Indicates if loading of the provider is deferred.
10+
*
11+
* @var bool
12+
*/
13+
protected $defer = false;
14+
15+
/**
16+
* Bootstrap the application events.
17+
*
18+
* @return void
19+
*/
20+
public function boot()
21+
{
22+
$this->publishes([
23+
__DIR__.'/../../config/config.php' => config_path('wp-api.php'),
24+
]);
25+
}
26+
27+
/**
28+
* Register the service provider.
29+
*
30+
* @return void
31+
*/
32+
public function register()
33+
{
34+
$this->app->bindShared('wp-api', function ($app) {
35+
36+
$endpoint = $this->app['config']->get('wp-api.endpoint');
37+
$auth = $this->app['config']->get('wp-api.auth');
38+
$client = $this->app->make('GuzzleHttp\Client');
39+
40+
return new WpApi($endpoint, $client, $auth);
41+
42+
});
43+
44+
$this->app->bind('Threesquared\LaravelWpApi\WpApi', function ($app) {
45+
return $app['wp-api'];
46+
});
47+
}
48+
49+
/**
50+
* Get the services provided by the provider.
51+
*
52+
* @return array
53+
*/
54+
public function provides()
55+
{
56+
return ['wp-api'];
57+
}
58+
}

0 commit comments

Comments
 (0)