PHP code example of parkerj / php-auto-update
1. Go to this page and download the library: Download parkerj/php-auto-update library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
parkerj / php-auto-update example snippets
ParkerJ\AutoUpdate;
// Download the zip update files to `__DIR__ . '/temp'`
// Copy the contents of the zip file to the current directory `__DIR__`
// The update process should last 60 seconds max
$update = new AutoUpdate(__DIR__ . '/temp', __DIR__, 60);
$update->setCurrentVersion('0.1.0'); // Current version of your application. This value should be from a database or another file which will be updated with the installation of a new version
$update->setUpdateUrl('http://php-auto-update.app/update/'); //Replace the url with your server update url
// The following two lines are optional
$update->addLogHandler(new Monolog\Handler\StreamHandler(__DIR__ . '/update.log'));
$update->setCache(new Desarrolla2\Cache\Adapter\File(__DIR__ . '/cache'), 3600);
//Check for a new update
if ($update->checkUpdate() === false)
die('Could not check for updates! See log file for details.');
// Check if new update is available
if ($update->newVersionAvailable()) {
//Install new update
echo 'New Version: ' . $update->getLatestVersion();
} else {
// No new update
echo 'Your application is up to date';
}