webrium/console 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

webrium/console

最新稳定版本:2.0.0

Composer 安装命令:

composer require webrium/console

包简介

README 文档

README

A command-line toolkit for the Webrium PHP framework. Provides commands for scaffolding files, managing databases, inspecting logs, and installing plugins.

Requirements

  • PHP 8.1+
  • Symfony Console 6.4+

Installation

composer require webrium/console

Available Commands

Command Description
init Create the project directory structure
make:model Generate a model file
make:controller Generate a controller file
make:route Generate a route file
call Call a method on a controller or model
db Manage databases
table Manage database tables
log Manage log files
botfire:init Initialize a Telegram bot
plugin:install Install a plugin
plugin:update Update an installed plugin
plugin:remove Remove an installed plugin
plugin:list List installed plugins
plugin:info Preview a plugin without installing

init

Creates all standard Webrium project directories.

php webrium init

make:model

Generates a model file in the models directory. Without --table, creates a simple model. With --table, creates a database-connected model.

php webrium make:model <Name> [--table=<table>] [--no-plural] [--force]
Argument / Option Description
Name Model class name (e.g. User)
--table, -t Database table name. If omitted, the name is auto-converted to snake_case and pluralized
--no-plural Prevent automatic pluralization of the table name
--force, -f Overwrite if the file already exists
# DB model with explicit table name
php webrium make:model User --table=users

# DB model — table name auto-generated as "users"
php webrium make:model User -t

# Simple model (no DB)
php webrium make:model UserHelper

# DB model — table stays "status" instead of "statuses"
php webrium make:model Status -t --no-plural

make:controller

Generates a controller file in the controllers directory. Automatically appends Controller to the name if not already present.

php webrium make:controller <Name> [--namespace=<Namespace>] [--force]
Argument / Option Description
Name Controller name (e.g. UserUserController)
--namespace Custom namespace (default: App\Controllers)
--force, -f Overwrite if the file already exists
php webrium make:controller User
php webrium make:controller Admin --namespace="App\Controllers\Admin"

make:route

Generates a route file in the routes directory.

php webrium make:route <Name> [--force]
Argument / Option Description
Name Route file name (e.g. ApiApi.php)
--force, -f Overwrite if the file already exists
php webrium make:route Api
php webrium make:route Web --force

call

Calls a method on a controller or model class directly from the terminal.

php webrium call <Class@Method> [--params=<JSON>] [--model] [--namespace=<Namespace>]
Argument / Option Description
Class@Method Class and method name (e.g. UserController@index)
--params, -p JSON array of arguments passed to the method (default: [])
--model, -m Target a model instead of a controller
--namespace Custom namespace (default: App\Controllers or App\Models)
php webrium call UserController@index
php webrium call UserController@find --params='[42]'
php webrium call User@active --model
php webrium call Report@generate --params='["2024-01", true]' --namespace="App\Services"

db

Manages databases.

php webrium db <action> [<name>] [--use=<database>] [--force]
Action Description
list List all databases
tables List tables in a database
create Create a new database
drop Delete a database (prompts for confirmation)
Option Description
--use, -u Specify a database for the tables action
--force, -f Skip confirmation prompt when dropping
php webrium db list
php webrium db tables --use=my_database
php webrium db create my_database
php webrium db drop my_database
php webrium db drop my_database --force

table

Inspects and manages individual tables.

php webrium table <action> <table_name> [--use=<database>] [--force]
Action Description
info / columns Show column details (name, type, nullable, key, default, extra)
drop Delete the table (prompts for confirmation)
Option Description
--use, -u Specify a database
--force, -f Skip confirmation prompt when dropping
php webrium table info users
php webrium table columns orders --use=shop_db
php webrium table drop sessions
php webrium table drop sessions --force

log

Manages Webrium log files stored in the logs directory.

php webrium log <action> [<name>]
Action Description
list List all log files
latest Display the most recent log file
file <name> Display a specific log file by name
clear Delete all log files
php webrium log list
php webrium log latest
php webrium log file 2024-01-15.log
php webrium log clear

botfire:init

Scaffolds the files needed to connect a Telegram bot to your Webrium project.

php webrium botfire:init [<token>] [--debug=<chat_id>] [--force]
Argument / Option Description
token Your Telegram bot token (optional at this stage)
--debug Chat ID to receive error messages in debug mode
--force, -f Overwrite existing bot files
php webrium botfire:init 123456:ABC-DEF
php webrium botfire:init 123456:ABC-DEF --debug=987654321

The command copies route and controller files for the bot and adds the token and debug settings to your .env file.

Plugin System

Webrium Console includes a full plugin system for installing and managing distributable components.

php webrium plugin:install <source> [--force] [--dry-run] [--no-backup]
php webrium plugin:update  <source> [--force] [--no-backup]
php webrium plugin:remove  <name>   [--no-backup] [--keep-files]
php webrium plugin:list
php webrium plugin:info    <source>

The source argument accepts a local .zip file path or an https:// URL:

php webrium plugin:install ./my-plugin.zip
php webrium plugin:install https://example.com/releases/my-plugin.zip
php webrium plugin:install https://github.com/user/repo/releases/download/v1.0.0/plugin.zip

For full documentation on creating and distributing plugins, see the Plugin System Wiki.

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-07-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固