herrera-io/service-update

A service provider for the Phar Update library.

1.0.3 2013-03-22 23:22 UTC

README

Build Status

A service provider for the Phar Update library.

Summary

Integrates the Phar Update library into the Herrera.io service container.

Installation

Add it to your list of Composer dependencies:

$ composer require herrera-io/service-update=1.*

Usage

<?php

use Herrera\Service\Container;
use Herrera\Service\Update\UpdateServiceProvider;

$container = new Container();
$container->register(new UpdateServiceProvider(), array(
    'update.url' => 'https://example.com/manifest.json'
));

/** @var $manager Herrera\Phar\Update\Manager */
$manager = $container['update.manager'];

/** @var $manifest Herrera\Phar\Update\Manifest */
$manifest = $container['update.manifest'];

/**
 * Updates the running Phar.
 *
 * @param string  $version The current version.
 * @param boolean $major   Lock to current major version?
 * @param boolean $pre     Allow updates to pre-releases?
 */
$callable = $container['update'];