egeatech/app-updater

A package to handle mobile applications self-update

3.0.1 2024-01-09 16:18 UTC

This package is auto-updated.

Last update: 2024-11-09 18:01:08 UTC


README

Latest Version on Packagist Total Downloads

A package to handle updates distribution of mobile applications which are not published in the official stores.

Installation

This package supports Laravel 7 and 8.

Via Composer

$ composer require egeatech/app-updater

Usage

Route registration

To use this package you simply have to register its routes. An example would be in your app RouteServiceProvider: just paste this in the boot() method

EgeaTech\AppUpdater\Facades\AppUpdater::routes();

and you will be ready to go.

Optionally, you can define custom per-route middlewares or change the prefix of the routes defined by the package: simply pass to the routes() function a EgeaTech\AppUpdater\Http\Routing\RoutingOptions object defining your settings of choice. An example usage is this:

EgeaTech\AppUpdater\Facades\AppUpdater::routes(
    new EgeaTech\AppUpdater\Http\Routing\RoutingOptions([
        'middleware' => ['api'],
        'prefix' => 'api'
    ],[
        'client-credentials',
        'throttle:60,1',
        'my-custom-middleware-name',
    ])
);

Configuration publishing

The package comes with a small configuration file which configures some little aspects. To publish it, run

 php artisan vendor:publish --tag app-updater.config

Migrations publishing

The package will add an extra table to your database, to save all available applications. Publish its migration to get started by running

 php artisan vendor:publish --tag app-updater.migrations

NOTE: The published file can be modified but be aware that updating the structure will require to update the dependency injection defined by the package (more on this later).

Dependency injection

The package is highly configurable, as most of its components are handled via interfaces wired by Laravel DI mechanism to concrete classes. In order to override the components of the package (Form Requests, JSON resources, Eloquent Model, Service and Repository classes) you'll have to create a new ServiceProvider class to bind package own interface to your own custom class. In this example we'll reassign the Application model to another entity.

class DependencyInjectionHandler extends ServiceProvider {
    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        app()->bind(ApplicationModelContract::class, MyCustomApplication::class);
    }
}

After defining the new ServiceProvider class, don't forget to add it to your config/app.php file, in the providers array.

Change log

Please see the changelog for more information on what has changed recently.

Contributing

Please see contributing.md for details.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

The software is licensed under MIT. Please see the license file for more information.