PHPackages                             robertsaupe/php-phar-selfupdate - 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. robertsaupe/php-phar-selfupdate

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

robertsaupe/php-phar-selfupdate
===============================

php library for phar selfupdate with a manifest file

1.0.5(2y ago)0251MITPHPPHP &gt;=8.2.0

Since May 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/robertsaupe/php-phar-selfupdate)[ Packagist](https://packagist.org/packages/robertsaupe/php-phar-selfupdate)[ Docs](https://github.com/robertsaupe/php-phar-selfupdate)[ Fund](https://www.amazon.de/ref=as_li_ss_tl?ie=UTF8&linkCode=ll2&tag=robertsaupe-21&linkId=b79bc86cee906816af515980cb1db95e&language=de_DE)[ GitHub Sponsors](https://github.com/sponsors/robertsaupe)[ RSS](/packages/robertsaupe-php-phar-selfupdate/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (7)Used By (1)

php-phar-selfupdate
===================

[](#php-phar-selfupdate)

[![Minimum PHP version: 8.2](https://camo.githubusercontent.com/babc429305ce499eaa775877791b2e8ffdf6e6a17b2f839a6566e086aebe73f9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e322532422d626c75652e7376673f636f6c6f723d626c7565267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/robertsaupe/php-phar-selfupdate)[![Packagist Version](https://camo.githubusercontent.com/56ad6b9672da6aecd7e7605c51e599d46d2e1a3788e7007b4a52fc00d606be1f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f6265727473617570652f7068702d706861722d73656c667570646174653f636f6c6f723d626c7565267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/robertsaupe/php-phar-selfupdate)[![Packagist Downloads](https://camo.githubusercontent.com/831b391055774335d81f5a6126a042601b9c458c64fff83064c85f29af68da72/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f6265727473617570652f7068702d706861722d73656c667570646174653f636f6c6f723d626c7565267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/robertsaupe/php-phar-selfupdate)[![License](https://camo.githubusercontent.com/31e62e0eff03ce9ddfdf69d8476340d4f541990bfb152cb02a0f342965252997/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666f722d7468652d6261646765)](LICENSE)

php library for phar selfupdate with a manifest file

Supporting
----------

[](#supporting)

[GitHub](https://github.com/sponsors/robertsaupe) | [Patreon](https://www.patreon.com/robertsaupe) | [PayPal](https://www.paypal.com/donate?hosted_button_id=SQMRNY8YVPCZQ) | [Amazon](https://www.amazon.de/ref=as_li_ss_tl?ie=UTF8&linkCode=ll2&tag=robertsaupe-21&linkId=b79bc86cee906816af515980cb1db95e&language=de_DE)

Installing
----------

[](#installing)

```
composer require robertsaupe/php-phar-selfupdate
```

Getting started
---------------

[](#getting-started)

### Update

[](#update)

```
use Exception;
use robertsaupe\Phar\SelfUpdate\ManifestUpdate;

$updater = new ManifestUpdate('1.0.0', 'path_to_manifest.json');

try {
    $result = $updater->update();
    $newVersion = $updater->getNewVersion();
    $oldVersion = $updater->getOldVersion();
    if ($result) {
        print('Phar has been updated.'.PHP_EOL);
        print('Current version is: '.$newVersion.PHP_EOL);
        print('Previous version was: '.$oldVersion.PHP_EOL);
    } else {
        print('Phar is currently up to date.'.PHP_EOL);
        print('Current version is: '.$oldVersion.PHP_EOL);
    }
} catch (Exception $e) {
    print('Error: '.$e->getMessage().PHP_EOL);
}
```

### Update-Check

[](#update-check)

```
use Exception;
use robertsaupe\Phar\SelfUpdate\ManifestUpdate;

$updater = new ManifestUpdate('1.0.0', 'path_to_manifest.json');

print('The current local version is: '.$updater->getCurrentLocalVersion().PHP_EOL);

try {
    $result = $updater->getCurrentRemoteVersion();
    if ($result) {
        print('The current '.$updater->getStability().' build available remotely is: '.$result.PHP_EOL);
    } else {
        print('You have the current '.$updater->getStability().' build installed.'.PHP_EOL);
    }
} catch (Exception $e) {
    print('Error: '.$e->getMessage().PHP_EOL);
}
```

### Rollback

[](#rollback)

```
use Exception;
use robertsaupe\Phar\SelfUpdate\ManifestUpdate;

$updater = new ManifestUpdate('1.0.0', 'path_to_manifest.json');

try {
    $result = $updater->rollback();
    if ($result) {
        print('Phar has been rolled back to prior version.'.PHP_EOL);
    } else {
        print('Rollback failed for reasons unknown.'.PHP_EOL);
    }
} catch (Exception $e) {
    print('Error: '.$e->getMessage().PHP_EOL);
}
```

### manifest.json

[](#manifestjson)

```
{
  "1.0.1": {
    "version": "1.0.1",
    "url": "url_or_path_to\/1.0.1\/file.phar",
    "sha1": "4f0dcc31a49417ee459abe5e73216f84a131fef3",
    "sha256": "2e82de11605f73732ddf0948a6c2b7235cb139bb974c1ab88b1b5dc21fcb571f",
    "sha512": "b356751b07e4626e043f65aeb85bf00b5a9933142652a17122abff0d43db3ce1371f212525b6aac011aa096592a5bcc85f14659fc2cd541f31ec2f4089931e91"
  },
  "1.0.0": {
    "version": "1.0.0",
    "url": "url_or_path_to\/1.0.0\/file.phar",
    "sha1": "95743c0d18bde06ee15878092dd2edbe6f1d2e76",
    "sha256": "5555f3d1f0567909e07bfc7cda29383cd63d9ad3d76aac88f43509904d916c23",
    "sha512": "c9bf8e3712cb913dc067533909117ad17722ef6b4c869e47c1ce8c56cda2a1d182657063eaa713cca331584f2ac548465e87d88895779b4da0b52c62b9f70a2a"
  }
}
```

### HashAlgo

[](#hashalgo)

#### Bash

[](#bash)

```
sha1sum file.phar
sha256sum file.phar
sha512sum file.phar
```

#### PHP

[](#php)

```
$sha1 = hash_file('sha1', 'file.phar');
$sha256 = hash_file('256', 'file.phar');
$sha512 = hash_file('512', 'file.phar');
```

Credits
-------

[](#credits)

- [humbug/phar-updater](https://github.com/humbug/phar-updater) for basic phar updating
    - Pádraic Brady
- [laravel-zero/phar-updater](https://github.com/laravel-zero/phar-updater) for the fork
    - Owen Voke
- [ManifestStrategy](https://github.com/humbug/phar-updater/pull/37)
    - Patrick Dawkins
    - Pádraic Brady

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~126 days

Recently: every ~158 days

Total

6

Last Release

808d ago

PHP version history (3 changes)1.0.0PHP ^8.0 || ^8.1

1.0.2PHP &gt;=8.0.0

1.0.5PHP &gt;=8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a0db6a3f1adbf3941338c9e29e2dc13d99aad0fd34db44b9aec9329691d8c301?d=identicon)[robertsaupe](/maintainers/robertsaupe)

---

Top Contributors

[![robertsaupe](https://avatars.githubusercontent.com/u/75934406?v=4)](https://github.com/robertsaupe "robertsaupe (17 commits)")

---

Tags

librarymanifestpharphpphp8selfupdateupdatephppharlibraryupdatephp8manifestselfupdate

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/robertsaupe-php-phar-selfupdate/health.svg)

```
[![Health](https://phpackages.com/badges/robertsaupe-php-phar-selfupdate/health.svg)](https://phpackages.com/packages/robertsaupe-php-phar-selfupdate)
```

PHPackages © 2026

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