Skip to content

Commit

Permalink
Added package autodiscovery functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
orediggerco committed May 21, 2018
1 parent 14cdcfe commit 8519634
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ composer require razorpay/slack-laravel

Then [create an incoming webhook](https://my.slack.com/services/new/incoming-webhook) for each Slack team you'd like to send messages to. You'll need the webhook URL(s) in order to configure this package.

## Laravel 5.5+

If using Laravel version 5.5 or higher, this package will be automatically discovered by the Framework. No need to register the provider or Alias! Just run `php artisan vendor:publish` to publish the config file to `config/slack.php`.

## Laravel 5

If you are using Laravel between 5.0 and 5.4, you will need to register the provider and alias as usual.

Add the `Razorpay\Slack\Laravel\ServiceProvider` provider to the `providers` array in `config/app.php`:

```php
Expand Down
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,15 @@
"Razorpay\\Slack\\Laravel\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Razorpay\\Slack\\Laravel\\ServiceProviderLaravel5"
],
"aliases": [
"Razorpay\\Slack\\Laravel\\Facade"
]
}
},
"minimum-stability": "stable"
}
5 changes: 5 additions & 0 deletions src/ServiceProviderLaravel5.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class ServiceProviderLaravel5 extends \Illuminate\Support\ServiceProvider
*/
public function boot()
{
if (floatval(\App::version()) > 5.5) {
$this->publishes([__DIR__ . '/config/config.php' => config_path('slack.php')], 'slack-laravel');
return;
}

$this->publishes([__DIR__ . '/config/config.php' => config_path('slack.php')]);
}

Expand Down

0 comments on commit 8519634

Please sign in to comment.