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 inpublic/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 configuredapp.bgUrlSetAppUrl— setsapp.bgUrlin the runtime config for the current requestShowTables— returns the list of database tables
Refer to the src/Commands folder for implementation details.
Configuration
app.bgUrl— used byPingProject. You can set this in yourconfig/app.phpor via environment-specific config.
Security Notes
This package can execute potent operations (file deletion, DB export). Always:
- Restrict the
/remote-commandroute 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
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-08