PHP code example of laragear / expose

1. Go to this page and download the library: Download laragear/expose 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/ */

    

laragear / expose example snippets


namespace App\DevTools;

use Laragear\Expose\Tunnels\AbstractTunnel;
use Symfony\Component\Process\Process;

class CorpVpnTunnel extends AbstractTunnel
{
    public function name(): string 
    { 
        return 'Corporate VPN';
    }

    public function binary(): string
    {
        return 'vpntunnel';
    }

    public function start(string $host, int $port): Process
    {
        $process = $this->buildProcess([
            $this->binaryCommand(), '--local', "{$host}:{$port}",
        ]);
        
        $process->start();
        
        return $process;
    }
}