1
- # PHP IBM Watson API Bridge
2
-
3
- [ ![ SensioLabsInsight] ( https://insight.sensiolabs.com/projects/4e21093a-cc60-4a75-b7fe-cb29053faf6c/big.png )] ( https://insight.sensiolabs.com/projects/4e21093a-cc60-4a75-b7fe-cb29053faf6c )
4
-
5
- [ ![ StyleCI] ( https://styleci.io/repos/59507474/shield?style=flat )] ( https://styleci.io/repos/59507474 )
6
- [ ![ Build Status] ( https://travis-ci.org/findbrok/php-watson-api-bridge.svg?branch=master )] ( https://travis-ci.org/findbrok/php-watson-api-bridge )
7
- [ ![ Latest Stable Version] ( https://poser.pugx.org/findbrok/php-watson-api-bridge/v/stable )] ( https://packagist.org/packages/findbrok/php-watson-api-bridge )
8
- [ ![ Total Downloads] ( https://poser.pugx.org/findbrok/php-watson-api-bridge/downloads )] ( https://packagist.org/packages/findbrok/php-watson-api-bridge )
9
- [ ![ Latest Unstable Version] ( https://poser.pugx.org/findbrok/php-watson-api-bridge/v/unstable )] ( https://packagist.org/packages/findbrok/php-watson-api-bridge )
10
- [ ![ License] ( https://poser.pugx.org/findbrok/php-watson-api-bridge/license )] ( https://packagist.org/packages/findbrok/php-watson-api-bridge )
11
-
12
- A simple PHP wrapper for IBM Watson API
1
+ <p align =" center " >
2
+ <img src="https://raw.githubusercontent.com/findbrok/art-work/master/packages/php-watson-api-bridge/php-watson-api-bridge.png">
3
+ </p >
4
+ <h2 align =" center " >
5
+ PHP IBM Watson API Bridge
6
+ </h2 >
7
+
8
+ <p align =" center " >
9
+ <a href="https://packagist.org/packages/findbrok/php-watson-api-bridge"><img src="https://poser.pugx.org/findbrok/php-watson-api-bridge/v/stable" alt="Latest Stable Version"></a>
10
+ <a href="https://packagist.org/packages/findbrok/php-watson-api-bridge"><img src="https://poser.pugx.org/findbrok/php-watson-api-bridge/v/unstable" alt="Latest Unstable Version"></a>
11
+ <a href="https://travis-ci.org/findbrok/php-watson-api-bridge"><img src="https://travis-ci.org/findbrok/php-watson-api-bridge.svg?branch=1.1" alt="Build Status"></a>
12
+ <a href="https://styleci.io/repos/59507474"><img src="https://styleci.io/repos/59507474/shield?branch=1.1" alt="StyleCI"></a>
13
+ <a href="https://packagist.org/packages/findbrok/php-watson-api-bridge"><img src="https://poser.pugx.org/findbrok/php-watson-api-bridge/license" alt="License"></a>
14
+ <a href="https://packagist.org/packages/findbrok/php-watson-api-bridge"><img src="https://poser.pugx.org/findbrok/php-watson-api-bridge/downloads" alt="Total Downloads"></a>
15
+ <a href="https://insight.sensiolabs.com/projects/4e21093a-cc60-4a75-b7fe-cb29053faf6c" alt="medal"><img src="https://insight.sensiolabs.com/projects/4e21093a-cc60-4a75-b7fe-cb29053faf6c/mini.png"></a>
16
+ </p >
17
+
18
+ ## Introduction
19
+ PHP IBM Watson API Bridge, provides a simple and easy to use wrapper around the IBM Watson API. The library makes it easier for us to
20
+ develop PHP apps that use the IBM Watson API.
21
+
22
+ ## License
23
+ PHP IBM Watson API Bridge is open-sourced software licensed under the [ MIT license] ( http://opensource.org/licenses/MIT )
13
24
14
25
### Installation
15
-
16
- ```
17
- composer require findbrok/php-watson-api-bridge
26
+ ``` bash
27
+ $ composer require findbrok/php-watson-api-bridge
18
28
```
19
29
20
30
### Usage
21
-
22
31
Before using the package checkout [ Watson API Explorer] ( https://watson-api-explorer.mybluemix.net/ ) ,
23
32
to get a sense of what you can and cannot do with Watson
24
33
@@ -44,10 +53,9 @@ all your responses will be instances of ```GuzzleHttp\Psr7\Response```
44
53
45
54
---
46
55
### Integration with Laravel 5
47
-
48
56
As of version 1.1.x, PHP Watson API bridge adds a new Service Provider which integrates easily with Laravel 5.
49
57
50
- First add the ServiceProvider to your ``` app.php ``` file.
58
+ First add the ServiceProvider to your ``` app.php ``` file:
51
59
52
60
``` php
53
61
'providers' => [
@@ -56,33 +64,29 @@ First add the ServiceProvider to your ```app.php``` file.
56
64
]
57
65
```
58
66
59
- Now publish the config file.
67
+ Now publish the config file:
60
68
61
- ``` php
69
+ ``` bash
62
70
$ php artisan vendor:publish --tag=watson-api-bridge
63
71
```
64
72
65
73
You will now have a config file ``` watson-bridge.php ``` in your config directory.
66
- You may define in this config file your credentials, auth method to use,
67
- Watson Services and so on.
74
+ You may define in this config file your credentials, auth method to use, Watson Services and so on.
68
75
69
76
### Services
70
-
71
77
The Laravel Integration gives you 3 service classes that are bound to the IoC.
72
78
- FindBrok\WatsonBridge\Bridge (The actual Bridge class for making requests to Watson)
73
79
- FindBrok\WatsonBridge\Support\Carpenter (Which can construct Bridge instances using your credentials and service URL)
74
80
- FindBrok\WatsonBridge\Support\BridgeStack (Essentially a store where you can keep all Bridges you constructed and retrieve them back.)
75
81
76
82
### Bridge
77
-
78
- ``` Bridge ``` class will help you make requests to Watson API using the ``` get ``` , ``` post ``` , ``` put ``` , ``` patch ``` methods
83
+ ``` Bridge ``` class will help you make requests to Watson API using the ``` get ``` , ``` post ``` , ``` put ``` , ``` patch ``` methods:
79
84
80
85
``` php
81
86
$response = $bridge->get('uri', $queryParams);
82
87
```
83
88
84
89
### Carpenter
85
-
86
90
The ``` Carpenter ``` class can build any type of Bridge for you. Use the ``` constructBridge ``` method passing in the desired parameters like
87
91
credentials name, service to use and auth method and so on and the ``` Carpenter ``` will.
88
92
@@ -95,7 +99,6 @@ $bridge = $carpenter->constructBridge('default', 'personality_insights');
95
99
Remember that your credentials names, services and auth methods are all defined in the ``` watson-bridge.php ``` config file.
96
100
97
101
### BridgeStack
98
-
99
102
The ``` BridgeStack ``` is a great place to keep all your Bridges so that you can retrieve them anytime in your app.
100
103
Use the ``` mountBridge ``` method to construct and keep any type of Bridge in the Stack.
101
104
@@ -111,7 +114,6 @@ $response = $stack->conjure('myPIBridge')->post('/v3/profile', $dataToPost);
111
114
The ``` BridgeStack ``` is essentially a Laravel Collection, thus you have access to all Collection methods.
112
115
113
116
### Facades
114
-
115
117
If you are using Laravel version less than 5.4 you have access to 3 Facades for the 3 services Bridge, Carpenter and BridgeStack.
116
118
Since Laravel 5.4 added automatic Facades you won't be needing those classes.
117
119
@@ -122,9 +124,11 @@ Since Laravel 5.4 added automatic Facades you won't be needing those classes.
122
124
Remember that if you are resolving the Bridge directly from the IoC and not constructing it with the Carpenter class a default Bridge will
123
125
be resolved for you using the default credentials and auth methods from your watson-bridge config.
124
126
125
- ## Credits
127
+ ### Credits
128
+ Big Thanks to all developers who worked hard to create something amazing!
126
129
127
- [ ![ Percy Mamedy] ( https://img.shields.io/badge/Author-Percy%20Mamedy-orange.svg )] ( https://twitter.com/PercyMamedy )
130
+ ### Creator
131
+ [ ![ Percy Mamedy] ( https://img.shields.io/badge/Author-Percy%20Mamedy-orange.svg )] ( https://twitter.com/PercyMamedy )
128
132
129
133
Twitter: [ @PercyMamedy ] ( https://twitter.com/PercyMamedy )
130
134
<br />
0 commit comments