Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

The Command

kherge edited this page Mar 14, 2013 · 3 revisions

The Command class is the command that manages the user interaction for updating/upgrading your Phar application. There are few things to note before using the Command class:

  • You must register the Helper class as a helper.
  • You must give it a name: $command = new Command('update');
  • You must set the manifest URI: $command->setManifestUri('http://example.com/manifest.json')

Example

This is an example of how you register Amend with your Symfony Console application:

<?php

use KevinGH\Amend;
use Symfony\Component\Console\Application;

// Create your app using a semantic version number
$app = new Application('Test', '1.0.0');

// Register the helper
$app->getHelperSet()->set(new Amend\Helper());

// Create the command and configure it
$command = new Amend\Command('update');
$command->setManifestUri('http://example.com/manifest.json')

// Register the command
$app->add($command);

API

Command __construct(string $name[, boolean $disable = false])

Creates a new command with the given $name.

  • If $disable is set to true, users will not be able to upgrade the Phar application to the next available major version (1.0.0 > 2.0.0). Users will only be able to update within the same major version number (1.2.3 > 1.3.4).

setManifestUri(string $uri)

Sets the location of the manifest file.

To create a manifest file, please see the Phar Update wiki.

Clone this wiki locally