Skip to content

Add package auto discovery #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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