00f100/phpuphar

There is no license information available for the latest version (0.7.0) of this package.

Library to self update your phar file

0.7.0 2016-10-03 16:38 UTC

README

Library to self update your Phar package

Installation

$ composer require 00f100/phpuphar

or add in your composer.json

"require": {
    "00f100/phpuphar": "*"
},

Usage

# Url to view current VERSION in GIT
$urlUpdate = array(
	'base' => 'https://example.com',
	'path' => '/path/to/version',
);

# Version current
$version = '1.0.0';

# Url to download Phar file
$urlDownloadPhar = 'https://github.com/00F100/phpatr/raw/master/dist/phpatr.phar';

# Name of phar file
$namePhar = 'example.phar';

# New instance of PHPUPhar
use PHPUPhar\PHPUPhar;
$selfUpdate = new PHPUPhar($urlUpdate, false, $version, $urlDownloadPhar, $namePhar);

# Test number of version
if ($version != $selfUpdate->getVersion() && $selfUpdate->update()) {
    # Your version has updated ...
}