定制 tiran133/phpwebterm 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tiran133/phpwebterm

最新稳定版本:0.1.1

Composer 安装命令:

composer require tiran133/phpwebterm

包简介

Simple PHP Web Terminal for Server and Docker

README 文档

README

A simple php web terminal application with laravel support.

Install

composer require tiran133/phpwebterm

Basic Usage

PHP

require __DIR__.'/../vendor/autoload.php';

$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();

JS

import {TerminalManager} from '/../dist/TerminalManager.es.js';

// If the config is not supplied, it will read the config from ENV variable during vite build process
const config = {
    WEBSOCKET_SCHEME: 'http',
    WEBSOCKET_HOST: '127.0.0.1',
    WEBSOCKET_PORT: '8034',
}

// Instantiate and expose the manager
const terminalManager = new TerminalManager(config);

window.connectServerShell = terminalManager.newEndpoint('server-shell');

// Opens a shell to a server
window.connectServerShell({
    host: '<IP>',
    port: 22,
    username: 'dashboard',
    jump_proxy: '<USER>@<IP>:<PORT>',
    ssh_key_path: '<PATH TO FILE>'
});

See example directory for more details.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-29