Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pieceofcake2/bake

Repository files navigation

Bake Plugin for CakePHP 2.x

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.11+

License

MIT License

Support

About

Bake Plugin for CakePHP 2.x

Resources

License

Stars

Watchers

Forks