kanti/hub-updater

This package is abandoned and no longer maintained. No replacement package was suggested.

Simple Github Updater for Web Projects

v0.5.1 2016-08-02 19:12 UTC

This package is auto-updated.

Last update: 2020-01-29 03:12:44 UTC


README

Packagist Packagist Travis Code Climate Code Climate

HubUpdater

Simple Github Updater for Web Projects [PHP]

is HubUpdater for me? [Checklist]

  • I have a little product/projekt on github. (~ <=30MB)
  • it can run PHP and uses composers autoloader
  • I want my users to update my Product with one click

check for an update [simple]

<?php
require 'vendor/autoload.php';

$updater = new \Kanti\HubUpdater('kanti/test');
$updater->update();

how to provide an update?

  • Go to your Repository on github.com ‣‣
  • click on the releases tab ‣‣
  • click on Draft a new release ‣‣
  • Enter your release details ‣‣
  • click on Publish release ‣‣
  • now you can use HubUpdater to update to the newest version.
  • note: The timestamp of the release is used. NOT the version number!!

install via composer

The recommended way to install hub-updater is through Composer.

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version of HubUpdater:

composer require kanti/hub-updater 0.5.*

After installing, you need to require Composer's autoloader:

<?php
require 'vendor/autoload.php';

settings

$settings = array(
	"settingsKey" => 'value',
);
new \Kanti\HubUpdater($settings);
setting description default
name the name your Repository has must be set
branch the branch you like to watch. master
cache the directory you like to put the cache stuff ./cache/
save the directory you like to put the content of the zip ./
prerelease would you like to download the prereleases? false
cacheFile name of the InformationCacheFile(in cacheDir) downloadInfo.json
holdTime time(seconds) the Cached-Information will be used 43200
versionFile name of the InstalledVersionInformation is safed(in cacheDir) installedVersion.json
zipFile name of the temporary zip file(in cacheDir) tmpZipFile.zip
updateignore name of the updateignore file(in root of project) .updateignore
auth github api auth user:apiKey/password null
exceptions if true, will throw new \Exception on failure false

Check for an update [complete]

<?php
require 'vendor/autoload.php';

$updater = new \Kanti\HubUpdater(array(
    "cacheFile" => "downloadInfo.json",//name of the InformationCacheFile(in cacheDir)
    "holdTime" => 43200,//time(seconds) the Cached-Information will be used

    "versionFile" => "installedVersion.json",//name of the InstalledVersionInformation is safed(in cacheDir)
    "zipFile" => "tmpZipFile.zip",//name of the temporary zip file(in cacheDir)
    "updateignore" => ".updateignore",//name of the updateignore file(in root of project)

    "name" => 'kanti/test',//Repository to watch
    "branch" => 'master',//wich branch to watch
    "cache" => 'cache/',//were to put the caching stuff
    "save" => 'save/',//there to put the downloaded Version[default ./]
    "prerelease" => true,//accept prereleases?

    "exceptions" => true,//if true, will throw new \Exception on failure
));
if ($updater->able()) {
    if (isset($_GET['update'])) {
        $updater->update();
        echo '<p>updated :)</p>';
    } else {
        echo '<a href="?update">Update Me</a>'; //only update if they klick this link
    }
} else {
    echo '<p>uptodate :)</p>';
}

the .updateignore file

syntax:

put a file in one line and it will not be updated. note put the .updateignore in your projects root directory

.htaccess
favicon.ico
there/the/config.ini/is.ini