LinuxCommandLibrary

cake

Shape network traffic for fairness and performance

TLDR

Display basic information about the current app and available commands

$ cake
copy

List available routes
$ cake routes
copy

Clear configuration caches
$ cake cache clear_all
copy

Build the metadata cache
$ cake schema_cache build --connection [connection]
copy

Clear the metadata cache
$ cake schema_cache clear
copy

Clear a single cache table
$ cake schema_cache clear [table_name]
copy

Start a development web server (defaults to port 8765)
$ cake server
copy

Start a REPL (interactive shell)
$ cake console
copy

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.

SEE ALSO

php(1), composer(1)

Copied to clipboard