PHPackages                             aliirfaan/laravel-simple-force-update - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. aliirfaan/laravel-simple-force-update

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

aliirfaan/laravel-simple-force-update
=====================================

Keep application versions in Semantic Versioning (SemVer) format. Compare local and current/published version. Useful to force update mobile applications.

3.0.0(4y ago)170↑233.3%MITPHP

Since Aug 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/aliirfaan/laravel-simple-force-update)[ Packagist](https://packagist.org/packages/aliirfaan/laravel-simple-force-update)[ RSS](/packages/aliirfaan-laravel-simple-force-update/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (1)Versions (7)Used By (0)

Laravel Simple Force Update
===========================

[](#laravel-simple-force-update)

Very often we want clients, especially mobile applications to update to the latest version. To enable force update feature, we need to keep release versions in our database and compare with the version of the device. This package creates a table to keep releases and provides a service to suggest actions based on version comparison.

Features
--------

[](#features)

- Table structure to keep versions with support for multiple applications and platforms
- Uses semantic versioning format to keep versions
- Provides interface so that you can implement your own force update logic
- Throws custom exception when invalid semantic string is encountered

Default force update logic
--------------------------

[](#default-force-update-logic)

- candidate version == max version || candidate version &gt; max version : No action
- candidate version &lt; max version &amp;&amp; candidate version &gt; min version : Action: update available
- candidate version &lt; min version : Action: update required / force update
- candidate version == min version : Action: update available

Requirements
------------

[](#requirements)

- [Composer](https://getcomposer.org/)
- [Laravel](http://laravel.com/)
- [naneau/semver](https://github.com/naneau/semver)

Installation
------------

[](#installation)

You can install this package on an existing Laravel project with using composer:

```
 $ composer require aliirfaan/laravel-simple-force-update
```

Register the ServiceProvider by editing **config/app.php** file and adding to providers array:

```
  aliirfaan\LaravelSimpleForceUpdate\SimpleForceUpdateProvider::class,
```

Note: use the following for Laravel &lt;5.1 versions:

```
 'aliirfaan\LaravelSimpleForceUpdate\SimpleForceUpdateProvider',
```

Publish files with:

```
 $ php artisan vendor:publish --provider="aliirfaan\LaravelSimpleForceUpdate\SimpleForceUpdateProvider"
```

or by using only `php artisan vendor:publish` and select the `aliirfaan\LaravelSimpleForceUpdate\SimpleForceUpdateProvider` from the outputted list.

Apply the migrations:

```
 $ php artisan migrate
```

Usage
-----

[](#usage)

```
