PHP code example of ninacoder-info / laravel-selfupdater
1. Go to this page and download the library: Download ninacoder-info/laravel-selfupdater 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/ */
ninacoder-info / laravel-selfupdater example snippets
Route::get('/', function (\NiNaCoder\Updater\UpdaterManager $updater) {
// Check if new version is available
if($updater->source()->isNewVersionAvailable()) {
// Get the current installed version
echo $updater->source()->getVersionInstalled();
// Get the new version available
$versionAvailable = $updater->source()->getVersionAvailable();
// Create a release
$release = $updater->source()->fetch($versionAvailable);
// Run the update process
$updater->source()->update($release);
} else {
echo "No new version available.";
}
});