binomeway/laravel-keep-alive

Keep your laravel applications through updates.

dev-main 2023-07-03 04:41 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Installation

You can install the package via composer:

composer require binomeway/laravel-keep-alive

You can publish the config file with:

php artisan vendor:publish --tag="laravel-keep-alive-config"

This is the contents of the published config file:

return [
    /**
     * This represents the latest version of the application
     * Whenever the app requires to run updates, bump this version.
     */
    'version' => '0.0.0',

    'repository' => \BinomeWay\KeepAlive\Repositories\FileRepository::class,

    'install' => [
        RunMigrationsAction::class,
        SummaryAction::class,
    ],

    'updates' => [
        //  '1.0.0' => [Update100::class], // or just the class Update100::class
    ],

];

Usage

Keep Alive extends the about command showing details about the app version state.

php artisan about

To install the application use app:install

php artisan app:install

To run updates use app:update

php artisan app:update

Extending

Keep Alive can be used outside of a console context too.

For example if you want to call the install or update function you can use the Installer and Updater facades.

use BinomeWay\KeepAlive\Facades;

function someMethod() {
    
    $result = Facades\Installer::run();
    
    // or same with Updater...
    
    $result = Facades\Updater::run();
    
    
    if($result->isSuccessful()) {
        // do something
        echo $result->message();
    }
    
    
}

Repositories

In order to persist the app's version you can use one of the default repositories or implement your own

Default repositories:

  • FileRepository (Default)
  • CacheRepository
  • RedisRepository (TODO)
  • EnvRepository (TODO)

Testing

composer test

Roadmap

  • Add support for prerequisites for Installer and Updater
  • Add database transactions feature flag
  • Add support to separate actions for each environment
  • Add RedisRepository
  • Add EnvRepository
  • Add Filament extension
  • Add Install/Update UI extension

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.