cake
Shape network traffic for fairness and performance
TLDR
Display basic information about the current app and available commands
List available routes
Clear configuration caches
Build the metadata cache
Clear the metadata cache
Clear a single cache table
Start a development web server (defaults to port 8765)
Start a REPL (interactive shell)
SYNOPSIS
bin/cake command [subcommand] [options] [arguments]
PARAMETERS
bake
Generates various types of boilerplate code, such as models, controllers, views, components, and tests.
server
Starts a local PHP development server for the CakePHP application.
routes
Displays a list of all defined routes within the application.
migrations
Manages database schema changes (requires the CakePHP Migrations plugin).
plugin
Manages CakePHP plugins, including installing, uninstalling, and loading.
cache
Provides utilities for clearing or managing application caches.
i18n
Assists with internationalization and localization tasks, such as extracting translatable strings.
shell
Allows execution of custom console commands (shells) written for the application.
--help
Displays help information for the main command or a specific subcommand.
--version
Displays the CakePHP framework version.
DESCRIPTION
The cake command is the primary command-line utility for the CakePHP web framework. Unlike standard Linux commands, it is not a standalone system tool but an integral part of a CakePHP application, typically found at ./bin/cake or ./vendor/bin/cake within a project directory.
It provides a robust and convention-driven interface for automating various development tasks, significantly boosting productivity. Developers use it to generate boilerplate code (models, controllers, views, components, etc., via the bake command), run a local development server, manage database migrations, interact with application caches, inspect routing configurations, and perform internationalization tasks.
The cake command extends the framework's capabilities beyond HTTP requests, allowing for administrative tasks, scheduled jobs, and custom scripting directly from the terminal. It leverages PHP's CLI environment and is crucial for the rapid application development (RAD) paradigm that CakePHP promotes.
CAVEATS
The cake command is not a standard, system-wide Linux command. It is specific to the CakePHP web framework and must be executed within the context of a CakePHP project. It requires PHP and Composer to be installed on the system, and its functionality is entirely dependent on the CakePHP framework's version and configuration. Running it outside a CakePHP project directory or without proper environment setup will result in errors.
EXECUTION CONTEXT
Typically, the cake command is executed from the root directory of a CakePHP project using its full path, such as ./bin/cake or ./vendor/bin/cake. For convenience, developers often add ./bin to their system's PATH or create symbolic links to make the command directly accessible as just cake.
EXTENSIBILITY
Developers can extend the functionality of the cake command by creating custom 'shells' or 'commands'. These are custom PHP classes that provide new command-line functionalities tailored to specific application needs, integrating seamlessly with the existing console toolset.
HISTORY
The cake command has been a cornerstone of the CakePHP framework since its early versions, evolving alongside the framework's capabilities. Initially inspired by the Ruby on Rails command-line tools, it began primarily with code generation capabilities (bake). Over time, its functionality expanded to encompass a comprehensive set of development and administrative tools, reflecting the growing needs of web application development, including database migrations, plugin management, and sophisticated caching tools. It represents CakePHP's commitment to developer productivity and convention over configuration.