Simple Github Updater for Web Projects [PHP]
<?php
require 'vendor/autoload.php';
$updater = new \Kanti\HubUpdater('kanti/test');
$updater->update();
releases->Draft a new release->Publish releaseThe 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 Guzzle:
composer require kanti/hub-updater dev-master
After installing, you need to require Composer's autoloader:
<?php
require 'vendor/autoload.php';
$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 |
<?php
require 'vendor/autoload.php';
$updater = new \Kanti\HubUpdater([
"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?
]);
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>';
}