Bake plugin for CakePHP 2.x - Code generation tool

Installs: 65

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:cakephp-plugin

v1.0.0 2025-10-06 04:10 UTC

This package is auto-updated.

Last update: 2025-10-06 04:20:01 UTC


README

GitHub License Packagist Version PHP CakePHP CI Codecov

The Bake plugin provides code generation and scaffolding capabilities for CakePHP 2.x applications.

Installation

Using Composer

Install the plugin using Composer:

composer require --dev pieceofcake2/bake

Usage

Once installed, you can use the bake commands:

# Bake a model
app/Console/cake bake model User

# Bake a controller
app/Console/cake bake controller Users

# Bake views
app/Console/cake bake view Users

# Bake everything for a model
app/Console/cake bake all User

# Create a new project
app/Console/cake bake project /path/to/new/project

# Create a new plugin
app/Console/cake bake plugin MyPlugin

Features

  • Model Generation: Create models with associations and validation
  • Controller Generation: Create controllers with CRUD actions
  • View Generation: Create views for index, view, add, and edit actions
  • Test Generation: Create test cases for your code
  • Fixture Generation: Create fixtures for testing
  • Plugin Generation: Scaffold new plugins
  • Project Generation: Create new CakePHP projects
  • Custom Templates: Use custom bake templates for code generation

Bake Templates

The Bake plugin uses templates for code generation. You can customize these templates by creating your own bake theme.

Custom Bake Themes

Create a directory structure in your app:

app/Console/Templates/myTheme/
├── classes/
│   ├── controller.ctp
│   ├── model.ctp
│   └── fixture.ctp
└── views/
    ├── index.ctp
    ├── view.ctp
    └── form.ctp

Then use your theme:

app/Console/cake bake controller Users --theme myTheme

Requirements

  • PHP 8.0+
  • CakePHP 2.10.24+

License

MIT License

Support