PHP code example of hnhdigital-os / laravel-console-self-update

1. Go to this page and download the library: Download hnhdigital-os/laravel-console-self-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/ */

    

hnhdigital-os / laravel-console-self-update example snippets




namespace App\Commands;

use HnhDigital\LaravelConsoleSelfUpdate\SelfUpdateInterface;
use HnhDigital\LaravelConsoleSelfUpdate\SelfUpdateTrait;
use LaravelZero\Framework\Commands\Command;

class SelfUpdateCommand extends Command implements SelfUpdateInterface
{
    use SelfUpdateTrait;

    /**
     * The signature of the command.
     *
     * @var string
     */
    protected $signature = 'self-update
                            {--tag=0 : Set a specific tag to install}
                            {--check-version : Return the version of this current binary}';

    /**
     * The description of the command.
     *
     * @var string
     */
    protected $description = 'Self-update this binary';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->setUrl('https://example.com');
        $this->runSelfUpdate();
    }
}

...
    public function handle()
    {
        ...
        $this->setVersionsTagKey('path');
        ...
    }
...

...
    public function handle()
    {
        ...
        $this->setHashSource(self::CHECKSUM_TOP_LEVEL);
        $this->setHashPath('checksums');
        ...
    }
...

...
    public function handle()
    {
        ...
        $this->setHashSource(self::CHECKSUM_VERSIONS);
        $this->setHashPath('sha256');
        ...
    }
...