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

Commit 2fd1877

Browse files
authored
Merge pull request #9 from findbrok/master
Refactoring and Laravel 5.5 prep work
2 parents 04a776d + cba353b commit 2fd1877

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ all your responses will be instances of ```GuzzleHttp\Psr7\Response```
5555
### Integration with Laravel 5
5656
As of version 1.1.x, PHP Watson API bridge adds a new Service Provider which integrates easily with Laravel 5.
5757

58+
> If you are using Laravel >= 5.5, you can skip service registration
59+
> and aliases registration thanks to Laravel auto package discovery
60+
> feature.
61+
5862
First add the ServiceProvider to your ```app.php``` file:
5963

6064
```php
@@ -64,6 +68,17 @@ First add the ServiceProvider to your ```app.php``` file:
6468
]
6569
```
6670

71+
You can also add the following aliases to you ```app.php``` file:
72+
73+
```php
74+
'aliases' => [
75+
...
76+
'Bridge' => FindBrok\WatsonBridge\Facades\Bridge::class,
77+
'BridgeStack' => FindBrok\WatsonBridge\Facades\BridgeStack::class,
78+
'Carpenter' => FindBrok\WatsonBridge\Facades\Carpenter::class,
79+
]
80+
```
81+
6782
Now publish the config file:
6883

6984
```bash

composer.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@
2626
},
2727
"extra": {
2828
"branch-alias": {
29-
"dev-master": "1.1.x-dev"
29+
"dev-master": "1.2.x-dev"
30+
},
31+
"laravel": {
32+
"providers": [
33+
"FindBrok\\WatsonBridge\\WatsonBridgeServiceProvider"
34+
],
35+
"aliases": {
36+
"Bridge": "FindBrok\\WatsonBridge\\Facades\\Bridge",
37+
"BridgeStack": "FindBrok\\WatsonBridge\\Facades\\BridgeStack",
38+
"Carpenter": "FindBrok\\WatsonBridge\\Facades\\Carpenter"
39+
}
3040
}
3141
},
3242
"minimum-stability": "dev",
File renamed without changes.

src/WatsonBridgeServiceProvider.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public function boot()
1919
{
2020
// Publish Config.
2121
$this->publishes([
22-
__DIR__.'/config/watson-bridge.php' => config_path('watson-bridge.php'),
23-
], 'watson-api-bridge');
22+
__DIR__.'/../config/watson-bridge.php' => config_path('watson-bridge.php'),
23+
], 'watson-api-bridge');
2424
}
2525

2626
/**
@@ -31,7 +31,7 @@ public function boot()
3131
public function register()
3232
{
3333
// Merge configs.
34-
$this->mergeConfigFrom(__DIR__.'/config/watson-bridge.php', 'watson-bridge');
34+
$this->mergeConfigFrom(__DIR__.'/../config/watson-bridge.php', 'watson-bridge');
3535

3636
// The Carpenter must be an Instance because we need only one.
3737
$this->app->singleton(Carpenter::class, function () {
@@ -58,8 +58,11 @@ protected function registerDefaultBridge()
5858
/** @var Repository $config */
5959
$config = $app->make(Repository::class);
6060

61-
return $carpenter->constructBridge($config->get('watson-bridge.default_credentials'), null,
62-
$config->get('watson-bridge.default_auth_method'));
61+
return $carpenter->constructBridge(
62+
$config->get('watson-bridge.default_credentials'),
63+
null,
64+
$config->get('watson-bridge.default_auth_method')
65+
);
6366
});
6467
}
6568
}

0 commit comments

Comments
 (0)