PHPackages                             aurakomputer/laraupdater - 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. aurakomputer/laraupdater

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

aurakomputer/laraupdater
========================

LaraUpdater allows your Laravel application to auto-update itself.

1.3.2(4mo ago)11.4k1MITPHPPHP &gt;=7.0.0 || ^8.0

Since Feb 3Pushed 4mo agoCompare

[ Source](https://github.com/aurakomputer/laraupdater)[ Packagist](https://packagist.org/packages/aurakomputer/laraupdater)[ Docs](https://github.com/aurakomputer/laraupdater)[ RSS](/packages/aurakomputer-laraupdater/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (11)Used By (0)

Author
------

[](#author)

This package originally created by

- **Pietro Cinaglia** - Original Author - Contact using [GitHub](https://github.com/pietrocinaglia) or [LinkedIn](https://linkedin.com/in/pietrocinaglia)

and has been fork and modified by

- **Aura Komputer** - Contact using [GitHub](https://github.com/aurakomputer) or [Website](https://s.id/aurakomputer)

LaraUpdater \[ self-update for your Laravel App \]
==================================================

[](#laraupdater--self-update-for-your-laravel-app-)

LaraUpdater allows your Laravel application to auto-update itself ! ;)

When you release an application is most important maintain it; therefore, could be necessary to publish an update for bugs fixing as well as for new features implementation.

You deploy your App for several users:

WITHOUT LaraUpdate =&gt; Do you want to contact them one by one and send them the update using an email or a link ? ...mmm...very bad becouse each user (with admin role) have to overwrite manually all files on his deployment; or, you have to access manually all deployments (e.g. using FTP) and install for them the update.

#### WITH LaraUpdater =&gt; Let your application (ALONE) detects that a new update is available and notifies its presence to the administrator; furthermore, let your application install it and handles all related steps.

[](#with-laraupdater--let-your-application-alone-detects-that-a-new-update-is-available-and-notifies-its-presence-to-the-administrator-furthermore-let-your-application-install-it-and-handles-all-related-steps)

### NEW VERSION change-log

[](#new-version-change-log)

- Now it can run from artisan command
- Now it supports Laravel 8 and 9;
- New view based on Bootstrap 5;
- Bugs Fix.

**3-2023**

- Support laravel 10
- Support ^php 8.0
- break: move main() function in upgrade.php and use beforeUpdate() and afterUpdate() functionn

Features:
---------

[](#features)

#### &gt; Self-Update

[](#-self-update)

LaraUpdater allows your Laravel Application to self-update :) Let your application (ALONE) detects that a new update is available and notifies its presence to the administrator; furthermore, let your application install it and handles all related steps.

#### &gt; Maintenance Mode

[](#-maintenance-mode)

LaraUpdate activates the maintenance mode (using the native Laravel command) since the update starts until it finishes with success.

#### &gt; Security

[](#-security)

You can set which users (e.g. only the admin) can perform an update for the application; this parameter is stored in the `config/laraupdater.php` so each application can sets its users indipendently. Furthermore, LaraUpdater is compatible with Laravel-Auth.

#### &gt; Fault tolerant

[](#-fault-tolerant)

During the update LaraUpdate BACKUPS all files that are overwritten, so if an error occurs it can try to restore automatically the previous state. If the restoring fails, you can use the backup stored in the root of your system for a manual maintenance.

#### &gt; Supports PHP script

[](#-supports-php-script)

LaraUpdate can import a PHP script to perform custom actions (e.g. create a table in database after the update); the commands are performed in the last step of update.

#### &gt; Backup/Recovery Integrated

[](#-backuprecovery-integrated)

#### &gt; Multi-language

[](#-multi-language)

#### &gt; Access from web interface or console

[](#-access-from-web-interface-or-console)

Getting Started
---------------

[](#getting-started)

These instructions will get you a copy of the project up and running on your server for development and testing purposes.

### Prerequisites

[](#prerequisites)

LaraUpdater has been tested using Laravel 8/9 Recommended Laravel Version &gt;= 8

Installing
----------

[](#installing)

This package can be installed through Composer:

```
composer require pcinaglia/laraupdater
```

After installation you must perform these steps:

#### 1) add the service provider in `config/app.php` file:

[](#1-add-the-service-provider-in-configappphp-file)

```
'providers' => [
    // ...
    pcinaglia\laraupdater\LaraUpdaterServiceProvider::class,
];

```

#### 2) publish LaraUpdater in your app

[](#2-publish-laraupdater-in-your-app)

This step will copy the config file in the config folder of your Laraver App.

```
php artisan vendor:publish --provider="pcinaglia\laraupdater\LaraUpdaterServiceProvider"
```

When it is published you can manage the configuration of LaraUpdater through the file in `config/laraupdater.php`, it contains:

```
    /*
    * Temporary folder to store update before to install it.
    */
    'tmp_folder_name' => 'tmp',

    /*
    * Script's filename called during the update.
    */
    'script_filename' => 'upgrade.php',

    /*
    * URL where your updates are stored ( e.g. for a folder named 'updates', under http://site.com/yourapp ).
    */
    'update_baseurl' => 'http://localhost:8888/update',

    /*
    * Set a middleware for the route: updater.update
    * Only 'auth' NOT works (manage security using 'allow_users_id' configuration)
    */
    'middleware' => ['web', 'auth'],

    /*
    * Set which users can perform an update;
    * This parameter accepts: ARRAY(user_id) ,or FALSE => for example: [1]  OR  [1,3,0]  OR  false
    * Generally, ADMIN have user_id=1; set FALSE to disable this check (not recommended)
    */
    'allow_users_id' => [1]

```

#### 3) Create version.txt

[](#3-create-versiontxt)

To store current version of your application you have to create a text file named `version.txt` and copy it in the main folder of your Laravel App. For example, create a .txt file that contains only:

```
1.0

```

Use only 1 row, the first, of the .txt file. When release an update this files is updated from LaraUpdate.

Create your update "repository"
-------------------------------

[](#create-your-update-repository)

#### 1) Create the Archive

[](#1-create-the-archive)

Create a .zip archive with all files that you want replace during the update (use the same structure of your application to organize the files in the archive).

#### 1.1) Upgrade Script (optional)

[](#11-upgrade-script-optional)

You can create a PHP file named `upgrade.php` to perform custom actions (e.g. create a new table in the database). This file must contain a function named `beforeUpdate()` and `afterUpdate()` with a boolean return (to pass the status of its execution to LaraUpdater), see this example:

```
