Download the PHP package webrium/console without Composer
On this page you can find all versions of the php package webrium/console. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package console
Webrium Console
The Webrium Console Commands include tools for generating files, calling methods, and managing databases. Below is a list of available commands and how to use them.
Generate a Model
The make:model command creates a new model file in the models directory. You can create either a simple model or a database-connected model.
Usage
- ModelName : The name of the model (e.g., User).
- --table|-t: Specify the database table name (e.g., users). If omitted, the model name is converted to snake_case and pluralized (e.g., User becomes users).
- --force|-f: Overwrite the model file if it already exists.
- --no-plural: Prevent adding an "s" to the table name (e.g., User stays user instead of users).
Example
Or instead of that
This creates a User.php model file in the models directory, linked to the users table.
Controller operation
Generate a Controller
The make:controller command creates a new controller file in the controllers directory.
Usage
ControllerName: The name of the controller (e.g., User). The suffix Controller is automatically added if not included.
- --force|-f: Overwrite the controller file if it already exists.
- --namespace: Specify a custom namespace (default: App\Controllers).
Example
This creates a UserController.php file in the controllers directory with the namespace App\Controllers.
Call a Controller or Model Method
The call command allows you to execute a method on a controller or model, passing optional parameters.
Usage
- Class@Method: The class and method to call (e.g., UserController@getUsers or User@getDetails).
- --params|-p: A JSON array of parameters (e.g., [1, "active"]). Defaults to an empty array.
- --model|-m: Target a model instead of a controller.
- --namespace: Specify a custom namespace (default: App\Controllers for controllers, App\Models for models).
Example
This calls the getUsers method on App\Controllers\UserController with the parameters [1, "active"].
Manage Databases
The db
command provides tools to manage databases, including listing databases, viewing tables, creating databases, and deleting databases.
Usage
-
action: The action to perform:
- list: List all databases.
- tables: List tables in a database.
- create: Create a new database.
- drop: Delete a database.
- DatabaseName: The name of the database (required for create and drop).
- --use|-u: Specify a database for the tables action.
- --force|-f: Skip confirmation when dropping a database.
Examples
List all databases:
List tables in a specific database:
Create a new database:
Delete a database (with confirmation):
Manage Tables
The table command allows you to manage database tables, including viewing column details and deleting tables.
Usage
-
action: The action to perform:
- info or
columns
: Display column details (name, type, null, key, default, extra). - drop: Delete the table.
- info or
- TableName: The name of the table.
- --use|-u: Specify a database.
- --force|-f: Skip confirmation when dropping a table.
Examples
View columns of a table:
Delete a table (with confirmation):