phpete1/kettle

a Laravel CLI tool to boilerplate code

0.1.0-alpha 2024-12-19 01:18 UTC

This package is auto-updated.

Last update: 2025-06-22 03:33:49 UTC


README

Boilerplate your Laravel code via the CLI.

"Prepare your work outside; get everything ready for yourself in the field, and after that build your house." - Proverbs 24:27

What is Kettle?

Kettle is a CLI tool that helps you create and manage boilerplate templates, eliminating the need to copy-paste or rewrite your code.

⚠ Note

Kettle should only be used in development environments. Ensure the resources/kettle path (or your configured path) is added to your .gitignore file.

How Does It Work?

Kettle is made up of two core components: Templates and Assets.

  • Templates: A collection of assets grouped together.
  • Assets: Individual files (such as PHP or Blade files) that are part of a template.

When you create a new template, Kettle generates a dedicated directory for it. Each asset you add is stored in this template folder, maintaining its file path. For example:

MyKettleTemplate/app/Http/Controllers/MyController.php

Whenever you need to use a template, you can publish it into your Laravel project with a single command.

Installation

To install the alpha release use:

composer require phpete1/kettle:0.2.0-alpha

Requirements

As this is an alpha release, the requirements are subject to change.

Currently, Kettle has been developed and tested on:

  • Laravel: 11.31
  • PHP: 8.2

Commands & Config

Templates

Create a Template

Create a new template:

php artisan kettle:template create MyTemplate

Publish a Template

Publish an existing template into your Laravel project:

php artisan kettle:template publish MyTemplate

Remove a Template

Remove a template:

php artisan kettle:template remove MyTemplate

Rename a Template

Rename a template:

php artisan kettle:template rename MyTemplate MyRenamedTemplate

Copy a Template

Copy an existing template:

php artisan kettle:template copy MyTemplate MyCopiedTemplate

Empty a Template

Empty all the assets of a templates:

php artisan kettle:template empty MyTemplate

List Templates

List all available templates:

php artisan kettle:template list

Assets

Add an Asset

Add an asset (file or entire directory) to a template:

php artisan kettle:asset add MyTemplate path/to/file.txt

Remove an Asset

Remove an asset (file or entire directory) from a template:

php artisan kettle:asset remove MyTemplate path/to/file.txt

List Template Assets

List all assets belonging to a template:

php artisan kettle:asset list MyTemplate

Changing the template path

The template path is defined in `config/kettle.php`. You can change the default path.

When changing the default template path, you must manually copy existing templates over.

Roadmap

I've got a lot of quirks I would like to add to Kettle, however this core alpha release should take priority to identify and squash any bugs.

Ideas

  • remove empty directories upon `kettle:asset remove ...`
  • implement user input when parameters are missing
  • a system to easily import templates from project to project
  • warnings and messages when files will be overwritten (template publish & asset add)

Notes

  • When adding assets, Kettle preserves the asset file's directory structure.
  • Published templates seamlessly integrate into your Laravel project.

Feel free to start exploring Kettle and share feedback to improve it further!

"Prepare your work outside; get everything ready for yourself in the field, and after that build your house." - Proverbs 24:27