All Projects → codedge → Laravel Selfupdater

codedge / Laravel Selfupdater

Licence: mit
This package provides some basic methods to implement a self updating functionality for your Laravel application. Already bundled are some methods to provide a self-update mechanism via Github or some private repository via http.

Projects that are alternatives of or similar to Laravel Selfupdater

Laraupdater
Enable Laravel App Self-Update. Allow your Laravel Application to auto-update itself.
Stars: ✭ 75 (-55.88%)
Mutual labels:  updater, laravel, laravel-package
Laravel Easypanel
A beautiful and flexible admin panel creator based on Livewire for Laravel
Stars: ✭ 135 (-20.59%)
Mutual labels:  laravel, laravel-package
Laravel Page Speed
Package to optimize your site automatically which results in a 35%+ optimization
Stars: ✭ 2,097 (+1133.53%)
Mutual labels:  laravel, laravel-package
Laravel Scout Postgres
PostgreSQL Full Text Search Engine for Laravel Scout
Stars: ✭ 140 (-17.65%)
Mutual labels:  laravel, laravel-package
Twitter
Twitter Notifications Channel for Laravel
Stars: ✭ 135 (-20.59%)
Mutual labels:  laravel, laravel-package
Laravel Hashslug
Package providing a trait to use Hashids on a model
Stars: ✭ 136 (-20%)
Mutual labels:  laravel, laravel-package
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+1201.18%)
Mutual labels:  laravel, laravel-package
Eloquent Tree
Eloquent Tree is a tree model for Laravel Eloquent ORM.
Stars: ✭ 131 (-22.94%)
Mutual labels:  laravel, laravel-package
Laravel Themer
Multi theme support for Laravel application
Stars: ✭ 142 (-16.47%)
Mutual labels:  laravel, laravel-package
Servermonitor
💓 Laravel package to periodically monitor the health of your server and application.
Stars: ✭ 148 (-12.94%)
Mutual labels:  laravel, laravel-package
Laravelresources
Speed Up package development for Laravel Apps with API's
Stars: ✭ 152 (-10.59%)
Mutual labels:  laravel, laravel-package
Simple Qrcode
An easy-to-use PHP QrCode generator with first-party support for Laravel.
Stars: ✭ 1,923 (+1031.18%)
Mutual labels:  laravel, laravel-package
Laravel Emojione
Laravel package to make it easy to use the gorgeous emojis from EmojiOne
Stars: ✭ 133 (-21.76%)
Mutual labels:  laravel, laravel-package
Laravel Deletable
👾 Gracefully restrict deletion of Laravel Eloquent models
Stars: ✭ 137 (-19.41%)
Mutual labels:  laravel, laravel-package
Laravel Paddle
Paddle.com API integration for Laravel with support for webhooks/events
Stars: ✭ 132 (-22.35%)
Mutual labels:  laravel, laravel-package
Laravel Api Explorer
API explorer for laravel applications
Stars: ✭ 138 (-18.82%)
Mutual labels:  laravel, laravel-package
Laravel Early Access
This package makes it easy to add early access mode to your existing application.
Stars: ✭ 160 (-5.88%)
Mutual labels:  laravel, laravel-package
Nova Belongsto Depend
Larave Nova BelongsTo Field with Dependcy
Stars: ✭ 128 (-24.71%)
Mutual labels:  laravel, laravel-package
Laravel Package Generator
A laravel package generator
Stars: ✭ 128 (-24.71%)
Mutual labels:  laravel, laravel-package
Laravel Db Profiler
Database Profiler for Laravel Web and Console Applications.
Stars: ✭ 141 (-17.06%)
Mutual labels:  laravel, laravel-package

Laravel Application Self-Updater

Latest Stable Version Total Downloads StyleCI Codacy Badge codecov

This package provides some basic methods to implement a self updating functionality for your Laravel 5 application. Already bundled are some methods to provide a self-update mechanism via Github.

Usually you need this when distributing a self-hosted Laravel application that needs some updating mechanism without Composer.

Install

To install the latest version from the master using Composer:

$ composer require codedge/laravel-selfupdater

Configuration

After installing the package you need to publish the configuration file via

$ php artisan vendor:publish --provider="Codedge\Updater\UpdaterServiceProvider"

Note: Please enter correct value for vendor and repository name in your config/self-updater.php if you want to use Github as source for your updates.

ℹ️ Setting the currently installed version

Before starting an update, make sure to set the version installed correctly. You're responsible to set the current version installed, either in the config file or better via the env variable SELF_UPDATER_VERSION_INSTALLED.

tag-based updates

Set the installed version to one of the tags set for a release.

branch-based updates

Set the installed version to to a datetime of one of the latest commits.
A valid version would be: 2020-04-19T22:35:48Z

Running artisan commands

Artisan commands can be run before or after the update process and can be configured in config/self-updater.php:

Example:

'artisan_commands' => [
    'pre_update' => [
        'updater:prepare' => [
            'class' => \App\Console\Commands\PreUpdateTasks::class,
            'params' => []
        ],
    ],
    'post_update' => [
        'postupdate:cleanup' => [
            'class' => \App\Console\Commands\PostUpdateCleanup::class,
            'params' => [
                'log' => 1,
                'reset' => false,
                // etc.
            ]
        ]
    ]
]

Notifications via email

You need to specify a recipient email address and a recipient name to receive update available notifications. You can specify these values by adding SELF_UPDATER_MAILTO_NAME and SELF_UPDATER_MAILTO_ADDRESS to your .env file.

Config name Description
SELF_UPDATER_MAILTO_NAME Name of email recipient
SELF_UPDATER_MAILTO_ADDRESS Address of email recipient
SELF_UPDATER_MAILTO_UPDATE_AVAILABLE_SUBJECT Subject of update available email
SELF_UPDATER_MAILTO_UPDATE_SUCCEEDED_SUBJECT Subject of update succeeded email

Private repositories

Private repositories can be accessed via (Bearer) tokens. Each repository inside the config file should have a private_access_token field, where you can set the token.

Note: Do not prefix the token with Bearer. This is done automatically.

Usage

To start an update process, i. e. in a controller, just use:

Route::get('/', function (\Codedge\Updater\UpdaterManager $updater) {

    // Check if new version is available
    if($updater->source()->isNewVersionAvailable()) {

        // Get the current installed version
        echo $updater->source()->getVersionInstalled();

        // Get the new version available
        $versionAvailable = $updater->source()->getVersionAvailable();

        // Create a release
        $release = $updater->source()->fetch($versionAvailable);

        // Run the update process
        $updater->source()->update($release);
        
    } else {
        echo "No new version available.";
    }

});

Currently, the fetching of the source is a synchronous process. It is not run in background.

Using Github

The package comes with a Github source repository type to fetch releases from Github - basically use Github to pull the latest version of your software.

Just make sure you set the proper repository in your config/self-updater.php file.

Tag-based updates

This is the default. Updates will be fetched by using a tagged commit, aka release.

Branch-based updates

Select the branch that should be used via the use_branch setting inside the configuration.

// ...
'repository_types' => [
    'github' => [
        'type' => 'github',
        'repository_vendor' => env('SELF_UPDATER_REPO_VENDOR', ''),
        'repository_name' => env('SELF_UPDATER_REPO_NAME', ''),
        // ...
        'use_branch' => 'v2',
   ],          
   // ...
];

Using Http archives

The package comes with an Http source repository type to fetch releases from an HTTP directory listing containing zip archives.

To run with HTTP archives, use following settings in your .env file:

Config name Value / Description
SELF_UPDATER_SOURCE http
SELF_UPDATER_REPO_URL Archive URL, e.g. http://archive.webapp/
SELF_UPDATER_PKG_FILENAME_FORMAT Zip package filename format
SELF_UPDATER_DOWNLOAD_PATH Download path on the webapp host server

The archive URL should contain nothing more than a simple directory listing with corresponding zip-Archives.

SELF_UPDATER_PKG_FILENAME_FORMAT contains the filename format for all webapp update packages. I.e. when the update packages listed on the archive URL contain names like webapp-v1.2.0.zip, webapp-v1.3.5.zip, ... then the format should be webapp-v_VERSION_. The _VERSION_ part is used as semantic versionioning variable for MAJOR.MINOR.PATCH versioning. The zip-extension is automatically added.

The target archive files must be zip archives and should contain all files on root level, not within an additional folder named like the archive itself.

Contributing

Please see the contributing guide.

Licence

The MIT License (MIT). Please see Licence file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].