Recieve notifications when laravel has pending updates or updates them.
, (*1)
This package allows receive notifications when you have pending updates in Laravel., (*2)
Optionally you can schedule the update of the packages., (*3)
Instalation
This package can be used in Laravel 5.4 or higher., (*4)
You can install the package via composer:, (*5)
composer require cesargb/laravel-update
If you have Laravel 5.4, you must add the service provider in config/app.php file:, (*6)
'providers' => [
// ...
Cesargb\Update\UpdateServiceProvider::class,
];
You can publish config file with:, (*7)
php artisan vendor:publish --provider="Cesargb\Update\UpdateServiceProvider"
This are the contents of the published config/update.php config file:, (*8)
return [
/*
* You can especified the program composer with full path.
*/
'composer_bin' => base_path('vendor').'/bin/composer',
/*
* By default disables installation of require-dev package.
* If you want enable require-dev packages, set this param to true
*/
'require-dev' => false,
'scheduler' => [
'check' => [
'enable' => true,
'cron' => '0 0 * * * *',
],
'update' => [
'enable' => false,
'cron' => '0 0 * * * *',
],
],
'notifications' => [
'via' => [
\Cesargb\Update\Notifications\HasUpdates::class => ['mail'],
\Cesargb\Update\Notifications\Updated::class => ['mail'],
\Cesargb\Update\Notifications\HasError::class => ['mail'],
],
'notifiable' => \Cesargb\Update\Notifications\Notifiable::class,
'mail' => [
'to' => 'email@example.com',
],
'slack' => [
'webhook_url' => '',
/*
* If this is set to null the default channel of the webhook will be used.
*/
'channel' => null,
],
]
];
Using artisan commands
You can check if has any update with this command:, (*9)
php artisan update:check
If you want upgrade the packages run:, (*10)
php artisan update:packages
Optionally you can receive a notification by email and/or Slack, with option --notify, (*11)
php artisan update:check --notify
php artisan update:packages --notfy
Scheduler
You need to add the following Cron entry to your server., (*12)
* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
If you want receive a notification when your system had any upgrade pending, you
can enable it in config file config/update.php, (*13)
'scheduler' => [
'check' => [
'enable' => true,
'cron' => '0 0 * * * *',
],
// ...
],
If prefer upgrade the system, set a true the param scheduler.update.enable:, (*14)
'scheduler' => [
// ...
'update' => [
'enable' => true,
'cron' => '0 0 * * * *',
],
],
Notifications
If you use command with argument --notifiy or with scheduler, you can receive notifications when be necessary., (*15)
You have three type notifications:, (*16)
- When the process have an error
- When have updates pending
- When update was done
each one of this notifications, you can especified the channel of notify in this
part of the config file update.php, (*17)
'via' => [
\Cesargb\Update\Notifications\HasUpdates::class => ['mail'],
\Cesargb\Update\Notifications\Updated::class => ['slack'],
\Cesargb\Update\Notifications\HasError::class => ['mail', 'slack']
],
License
The MIT License (MIT). Please see License File for more information., (*18)