What is Command Reference?
Command Reference is a comprehensive guide to all available Slim commands. This documentation provides a detailed explanation of each command’s functionality, usage, and available options.
Why is Command Reference important?
Command Reference is crucial for developers using Slim to understand the full range of available commands and their capabilities. By providing clear and concise information on each command, this documentation empowers developers to efficiently utilize Slim’s features and build robust applications.
Command Reference
This section provides a detailed overview of each command available within the Slim framework.
slim
The slim
command is the primary entry point for interacting with Slim. It offers a wide range of subcommands designed for various development tasks.
Usage
slim [command] [options]
Options
--version
: Displays the current version of Slim.-h, --help
: Displays the help message for the specified command.--verbose
: Enables verbose output for debugging purposes.--quiet
: Suppresses non-essential output.--no-interaction
: Disables interactive prompts.--config [path]
: Specifies the path to the configuration file.
Subcommands
new
: Creates a new Slim project.run
: Starts the Slim development server.build
: Compiles Slim assets for production.test
: Runs Slim unit tests.generate
: Generates Slim components (e.g., controllers, models, views).migrate
: Manages database migrations.seed
: Populates the database with seed data.
slim new
The slim new
command creates a new Slim project, setting up the necessary files and directories for development.
Usage
slim new [project-name]
Options
-b, --builder [builder]
: Specifies the builder to use for the project (e.g.,basic
,react
).--no-composer
: Skips installing dependencies via Composer.--no-git
: Skips initializing a Git repository.
Example
slim new my-slim-app
This command creates a new Slim project named my-slim-app
using the default builder.
slim run
The slim run
command starts the Slim development server, providing a local environment for running and testing your application.
Usage
slim run [options]
Options
-p, --port [port]
: Specifies the port to listen on.-h, --host [host]
: Specifies the host to bind to.-d, --daemon
: Runs the server in the background.-n, --no-reload
: Disables automatic reloading.--config [path]
: Specifies the path to the configuration file.
Example
slim run -p 8080
This command starts the Slim development server on port 8080.
slim build
The slim build
command compiles Slim assets for production, optimizing them for performance and efficiency.
Usage
slim build [options]
Options
-p, --prod
: Enables production mode.--force
: Forces a rebuild even if assets are up-to-date.--config [path]
: Specifies the path to the configuration file.
Example
slim build --prod
This command compiles Slim assets in production mode.
slim test
The slim test
command runs Slim unit tests, ensuring the codebase adheres to quality standards and functionality.
Usage
slim test [options]
Options
-c, --coverage
: Generates code coverage reports.--config [path]
: Specifies the path to the configuration file.
Example
slim test --coverage
This command runs Slim unit tests and generates code coverage reports.
slim generate
The slim generate
command generates Slim components such as controllers, models, and views, accelerating development by providing standardized templates.
Usage
slim generate [component] [name]
Options
--force
: Overwrites existing files if they exist.
Example
slim generate controller User
This command generates a new controller named User
.
slim migrate
The slim migrate
command manages database migrations, allowing developers to evolve their database schema safely and reliably.
Usage
slim migrate [command]
Subcommands
up
: Applies pending migrations.down
: Reverts the last migration.status
: Displays the status of migrations.create
: Creates a new migration file.
Example
slim migrate up
This command applies all pending migrations.
slim seed
The slim seed
command populates the database with seed data, providing a starting point for testing or development.
Usage
slim seed [options]
Options
-f, --force
: Overwrites existing seed data.
Example
slim seed
This command populates the database with seed data.
Top-Level Directory Explanations
cmd/ - This directory contains the command-line interface (CLI) tools for the Slim project. The slim/
and slim-sensor/
subdirectories contain the main executables for the Slim and Slim Sensor tools, respectively.
pkg/ - This directory contains the Go packages for the Slim project. Various subdirectories, such as acounter/
, app/
, appbom/
, artifact/
, certdiscover/
, command/
, consts/
, docker/
, errors/
, imagebuilder/
, imagereader/
, ipc/
, lambdaproxy/
, launcher/
, mondel/
, monitor/
, pdiscover/
, report/
, sysenv/
, sysidentity/
, system/
, and util/
, contain different packages used throughout the project.
Entrypoints and Where to Start
cmd/slim/main.go - The entrypoint for the Slim command-line interface application.
cmd/slim-sensor/main.go - The entrypoint for the Slim sensor, a separate component that monitors the system for new Go binaries.