定制 asinfotrack/yii2-webshell 二次开发

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

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

asinfotrack/yii2-webshell

最新稳定版本:0.8.1

Composer 安装命令:

composer require asinfotrack/yii2-webshell

包简介

Yii2-Webshell allows you to execute any shell command from a web-interface.

README 文档

README

Yii2-Webshell allows you to execute any shell command from a web-interface. This is especially useful to call console-commands from the frontend. The execution is done via AJAX and a special action-class (ShellAction).

The output of the shell action is displayed live (line by line).

Installation

The preferred way to install this extension is through composer.

"asinfotrack/yii2-webshell": "0.8.*"

Changelog

Learn about the latest improvements

Contents

Components

ShellAction

This is the action you can attach to any controller via its actions()-method. Here you define who and who the action can be accessed. All the regular RBAC-controls are of course available.

The following is an example for a configuration calling a yii-console-command under windows:

class MyController extends \yii\web\Controller
{

	//...
	
	public function actions()
	{
		return [
			'my-shell-action'=>[
				'class'=>'asinfotrack\yii2\webshell\actions\ShellAction',
				'command'=>'php "c:\path\to\my_yii2_application\yii" my-console-command/index',
			],
		];
	}
	
	//...

}

Widgets

ShellWidget

The widget allows you to create a console like container in your views, which communicates with a ShellAction as documented above. The following represents a full configuration:

<?= Button::widget([
	'label'=>'Run', 
	'options'=>[
		'data-shell-widget-run'=>'my-shell-widget',
	],
]) ?>

<?= ShellWidget::widget([
	'id'=>'my-shell-widget',
	'route'=>['my-controller/my-shell-action'],
	'autorun'=>false,
	'initialContent'=>Yii::t('app', 'Ready and waiting...'),
	'clientOptions'=>[
        //custom client options here
	],
]) ?>

As you can see, the console can either be ran automatically or not. In any case you can create buttons which will then trigger the action. To do so simply use the attribute data-shell-widget-run and fill it with the id of the ShellWidget. You can customize all the js-options (including the attribute name) with the clientOptions property of the widget.

For a full documentation of the widgets possibilities check out the doc within its code.

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 5
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固