定制 sentix/laravel-remotecommand 二次开发

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

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

sentix/laravel-remotecommand

Composer 安装命令:

composer require sentix/laravel-remotecommand

包简介

A remote command execution system for Laravel (secure API based command runner)

README 文档

README

A small Laravel package that exposes a secure API endpoint to run predefined maintenance commands remotely.

Features

  • Run built-in maintenance commands via a POST API
  • Commands included: BackupDatabase, DeleteFolder, PingProject, SetAppUrl, ShowTables
  • Spatie DbDumper used for reliable MySQL backups with a PHP fallback

Requirements

  • PHP >= 8.0
  • Laravel 10, 11, 12, 13 or 14

Installation

Install with Composer:

composer require sentix/laravel-remotecommand

The package registers the service provider and facade automatically via Composer's extra.laravel settings.

Usage

Send a POST request to the package route:

POST /remote-command
Content-Type: application/json

{
	"command": "ShowTables",
	"params": {}
}

Example using curl:

curl -X POST http://your-app.test/remote-command \
	-H "Content-Type: application/json" \
	-d '{"command":"ShowTables","params":{}}'

Important: Protect this endpoint with authentication or middleware in your app (for example add auth:sanctum or IP restrictions) — the package does not enable authentication by default.

Available Commands

  • BackupDatabase — creates a SQL dump in public/backups/ (uses Spatie DbDumper, falls back to PHP export)
  • DeleteFolder — deletes a file or directory inside the project (path must be inside project root)
  • PingProject — performs an HTTP GET to the configured app.bgUrl
  • SetAppUrl — sets app.bgUrl in the runtime config for the current request
  • ShowTables — returns the list of database tables

Refer to the src/Commands folder for implementation details.

Configuration

  • app.bgUrl — used by PingProject. You can set this in your config/app.php or via environment-specific config.

Security Notes

This package can execute potent operations (file deletion, DB export). Always:

  • Restrict the /remote-command route with authentication and authorization
  • Run in trusted environments only
  • Log and audit remote calls

Contributing

PRs and issues are welcome. Please follow the repository coding standards and include tests where appropriate.

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固