PHPackages                             jeffersongoncalves/laravel-zero-self-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. [CLI &amp; Console](/categories/cli)
4. /
5. jeffersongoncalves/laravel-zero-self-update

ActiveLibrary[CLI &amp; Console](/categories/cli)

jeffersongoncalves/laravel-zero-self-update
===========================================

Reusable self-update service and base command for Laravel Zero CLIs distributed as a PHAR via GitHub Releases.

v1.0.0(today)10MITPHPPHP ^8.2CI passing

Since Jun 23Pushed today1 watchersCompare

[ Source](https://github.com/jeffersongoncalves/laravel-zero-self-update)[ Packagist](https://packagist.org/packages/jeffersongoncalves/laravel-zero-self-update)[ Docs](https://github.com/jeffersongoncalves/laravel-zero-self-update)[ RSS](/packages/jeffersongoncalves-laravel-zero-self-update/feed)WikiDiscussions main Synced today

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

[![laravel-zero-self-update](https://raw.githubusercontent.com/jeffersongoncalves/laravel-zero-self-update/main/art/jeffersongoncalves-laravel-zero-self-update.png)](https://raw.githubusercontent.com/jeffersongoncalves/laravel-zero-self-update/main/art/jeffersongoncalves-laravel-zero-self-update.png)

laravel-zero-self-update
========================

[](#laravel-zero-self-update)

Reusable self-update service and base command for [Laravel Zero](https://laravel-zero.com) CLIs that are distributed as a single-file PHAR via GitHub Releases.

Most Laravel Zero PHAR tools end up shipping the exact same `self-update` logic: read the current version, hit the GitHub "latest release" API, compare versions, download the `.phar` asset, back up the running PHAR and atomically swap it in. This package extracts that logic into one well-tested service (`PharUpdater`) plus an abstract `self-update` command base, so each CLI only has to declare its repository, asset name and version.

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

[](#installation)

```
composer require jeffersongoncalves/laravel-zero-self-update
```

Requires PHP `^8.2`, `guzzlehttp/guzzle ^7.10` and `illuminate/console ^11|^12`.

Usage
-----

[](#usage)

### Base command

[](#base-command)

In your Laravel Zero app, create a command that extends the base and implements the three abstract methods. Override `currentVersion()` to read your app version from config.

```
