PHPackages                             nawrasbukhari/laravelgithubupdater - 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. nawrasbukhari/laravelgithubupdater

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

nawrasbukhari/laravelgithubupdater
==================================

Providing an auto-updating functionality for your self-hosted Laravel application.

11PHP

Since Dec 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/NawrasBukhari/laravelGitHubUpdater)[ Packagist](https://packagist.org/packages/nawrasbukhari/laravelgithubupdater)[ RSS](/packages/nawrasbukhari-laravelgithubupdater/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Laravel Application Self-Updater
================================

[](#laravel-application-self-updater)

This package provides some basic methods to implement a self updating functionality for your Laravel application.

**Supported update provider:**

- GitHub
- Gitlab
- Gitea
- Http-based archives

Usually you need this when distributing a self-hosted Laravel application that needs some updating mechanism without [Composer](https://getcomposer.org/).

Install
-------

[](#install)

To install the latest version from the master using [Composer](https://getcomposer.org/):

```
$ composer require nawrasbukhari/laravelgitHubupdater
```

Configuration
-------------

[](#configuration)

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

```
$ php artisan vendor:publish --provider="NawrasBukhari\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

[](#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

[](#tag-based-updates)

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

#### `branch`-based updates

[](#branch-based-updates)

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

### Running artisan commands

[](#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.
            ]
        ]
    ]
]
```

### Configure the download path

[](#configure-the-download-path)

Sometimes your web host does not allow saving files into the `/tmp` folder of the server. You can change the folder the application is downloaded to by setting the env var `SELF_UPDATER_DOWNLOAD_PATH` to something different. Just keep in mind, that the folder is not inside the folder your application lives in as it might be overwritten during the update.

### Notifications via email

[](#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 nameDescriptionSELF\_UPDATER\_MAILTO\_NAMEName of email recipientSELF\_UPDATER\_MAILTO\_ADDRESSAddress of email recipientSELF\_UPDATER\_MAILTO\_UPDATE\_AVAILABLE\_SUBJECTSubject of update available emailSELF\_UPDATER\_MAILTO\_UPDATE\_SUCCEEDED\_SUBJECTSubject of update succeeded email### Private repositories

[](#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.

ℹ Do not prefix the token with `Bearer `. This is done automatically.

Usage
-----

[](#usage)

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

```
Route::get('/', function (\NawrasBukhari\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

[](#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

[](#tag-based-updates-1)

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

#### Branch-based updates

[](#branch-based-updates-1)

Select the branch that should be used via the `use_branch` setting [inside the configuration](https://github.com/codedge/laravel-selfupdater/blob/master/config/self-update.php).

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

### Using Gitlab

[](#using-gitlab)

Configure Gitlab either via the `config/self-updater.php` or use the appropriate environment variables.

```
// ...
'repository_types' => [
    'gitlab' => [
            'type'                 => 'gitlab',
            'repository_id'        => env('SELF_UPDATER_REPO_URL', ''),
            'download_path'        => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'),
            'private_access_token' => env('SELF_UPDATER_GITLAB_PRIVATE_ACCESS_TOKEN', ''),
   ],
   // ...
];
```

ℹ Although the environment variable is named `SELF_UPDATER_REPO_URL`, only specify your repository id.

### Using HTTP archives

[](#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 nameValue / DescriptionSELF\_UPDATER\_SOURCE`http`SELF\_UPDATER\_REPO\_URLArchive URL, e.g. `http://archive.webapp/`SELF\_UPDATER\_PKG\_FILENAME\_FORMATZip package filename formatSELF\_UPDATER\_DOWNLOAD\_PATHDownload path on the webapp host serverThe 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.

### Using Gitea

[](#using-gitea)

With *Gitea* you can use your own Gitea-Instance with tag-releases.

To use it, use the following settings in your `.env` file:

Config nameValue / DescriptionSELF\_UPDATER\_SOURCE`gitea`SELF\_UPDATER\_GITEA\_URLURL of Gitea ServerSELF\_UPDATER\_REPO\_VENDORRepo Vendor NameSELF\_UPDATER\_REPO\_NAMERepo NameSELF\_UPDATER\_GITEA\_PRIVATE\_ACCESS\_TOKENAccess Token from GiteaSELF\_UPDATER\_DOWNLOAD\_PATHDownload path on the webapp host serverLicence
-------

[](#licence)

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

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/29cbb8c2f17378feaa5074e50a33b24d2ea2b41bf4f05d5bcf7af9e9e0561d54?d=identicon)[nbukhari](/maintainers/nbukhari)

---

Top Contributors

[![NawrasBukhari](https://avatars.githubusercontent.com/u/63796900?v=4)](https://github.com/NawrasBukhari "NawrasBukhari (3 commits)")

### Embed Badge

![Health badge](/badges/nawrasbukhari-laravelgithubupdater/health.svg)

```
[![Health](https://phpackages.com/badges/nawrasbukhari-laravelgithubupdater/health.svg)](https://phpackages.com/packages/nawrasbukhari-laravelgithubupdater)
```

###  Alternatives

[shipmonk/name-collision-detector

Simple tool to find ambiguous classes or any other name duplicates within your project.

362.1M34](/packages/shipmonk-name-collision-detector)[bostondv/bootstrap-ninja-forms

Adds Bootstrap classes to Ninja Forms

222.2k](/packages/bostondv-bootstrap-ninja-forms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
