Skip to content

Commit

Permalink
Merge pull request #55 from codedge/#54-auto-discovery
Browse files Browse the repository at this point in the history
Add package auto discovery
  • Loading branch information
codedge authored Apr 5, 2019
2 parents 69bc73c + a720bfc commit dce1b16
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ $ composer require codedge/laravel-selfupdater

This adds the _codedge/laravel-selfupdater_ package to your `composer.json` and downloads the project.

## Register the package

Since Laravel 5.5 auto-discovery can be used to register packages - this is supported by this package.
So if you run Laravel >=5.5 the steps `[1]` and `[2]` are not needed.

You need to include the service provider in your `config/app.php` `[1]` and optionally the _facade_ `[2]`:
```php
// config/app.php
Expand All @@ -43,12 +48,12 @@ return [
'aliases' => [
// ...

'Updater' => Codedge\Updater\UpdaterManager::class, // [2]
'Updater' => Codedge\Updater\UpdaterFacade::class, // [2]

]
```

Additionally add the listener to your `app/Providers/EventServiceProvider.php`:
Additionally add the listener to your `app/Providers/EventServiceProvider.php` `[3]`:

```php
// app/Providers/EventServiceProvider.php
Expand All @@ -63,10 +68,10 @@ protected $listen = [

\Codedge\Updater\Events\UpdateAvailable::class => [
\Codedge\Updater\Listeners\SendUpdateAvailableNotification::class
],
], // [3]
\Codedge\Updater\Events\UpdateSucceeded::class => [
\Codedge\Updater\Listeners\SendUpdateSucceededNotification::class
],
], // [3]

];

Expand Down
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"Codedge\\Updater\\UpdaterServiceProvider"
],
"aliases": {
"Updater": "Codedge\\Updater\\UpdaterFacade"
}
}
},
"require": {
"php": ">=7.1",
"ext-zip": "*",
Expand Down

0 comments on commit dce1b16

Please sign in to comment.