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

Commit

Permalink
Merge pull request #9 from findbrok/master
Browse files Browse the repository at this point in the history
Refactoring and Laravel 5.5 prep work
  • Loading branch information
percymamedy authored Jun 6, 2017
2 parents 04a776d + cba353b commit 2fd1877
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ all your responses will be instances of ```GuzzleHttp\Psr7\Response```
### Integration with Laravel 5
As of version 1.1.x, PHP Watson API bridge adds a new Service Provider which integrates easily with Laravel 5.

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

```php
Expand All @@ -64,6 +68,17 @@ First add the ServiceProvider to your ```app.php``` file:
]
```

You can also add the following aliases to you ```app.php``` file:

```php
'aliases' => [
...
'Bridge' => FindBrok\WatsonBridge\Facades\Bridge::class,
'BridgeStack' => FindBrok\WatsonBridge\Facades\BridgeStack::class,
'Carpenter' => FindBrok\WatsonBridge\Facades\Carpenter::class,
]
```

Now publish the config file:

```bash
Expand Down
12 changes: 11 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
"dev-master": "1.2.x-dev"
},
"laravel": {
"providers": [
"FindBrok\\WatsonBridge\\WatsonBridgeServiceProvider"
],
"aliases": {
"Bridge": "FindBrok\\WatsonBridge\\Facades\\Bridge",
"BridgeStack": "FindBrok\\WatsonBridge\\Facades\\BridgeStack",
"Carpenter": "FindBrok\\WatsonBridge\\Facades\\Carpenter"
}
}
},
"minimum-stability": "dev",
Expand Down
File renamed without changes.
13 changes: 8 additions & 5 deletions src/WatsonBridgeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public function boot()
{
// Publish Config.
$this->publishes([
__DIR__.'/config/watson-bridge.php' => config_path('watson-bridge.php'),
], 'watson-api-bridge');
__DIR__.'/../config/watson-bridge.php' => config_path('watson-bridge.php'),
], 'watson-api-bridge');
}

/**
Expand All @@ -31,7 +31,7 @@ public function boot()
public function register()
{
// Merge configs.
$this->mergeConfigFrom(__DIR__.'/config/watson-bridge.php', 'watson-bridge');
$this->mergeConfigFrom(__DIR__.'/../config/watson-bridge.php', 'watson-bridge');

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

return $carpenter->constructBridge($config->get('watson-bridge.default_credentials'), null,
$config->get('watson-bridge.default_auth_method'));
return $carpenter->constructBridge(
$config->get('watson-bridge.default_credentials'),
null,
$config->get('watson-bridge.default_auth_method')
);
});
}
}

0 comments on commit 2fd1877

Please sign in to comment.