PHP code example of tiran133 / phpwebterm

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

    

tiran133 / phpwebterm example snippets




$config = [
    'port' => 8034,
    'listen' => '0.0.0.0',
    'scheme' => 'http',
    // SSL/TLS context
    'certificate' => [
        'local_cert' => 'server.crt',
        'local_pk' => 'server.key',
        'passphrase' => '',
    ],
];

//Create new websocket server
$websocketServe = new Server(new ServerConfig($config));

// Add route: Uses a simple approach to spawn the process.
$websocketServe->addRoute('/server-shell', ServerShellProcess::class);

//Startwebsocket server

$websocketServe->start();