About laravel:custom-helpers
A Laravel skill for adding custom PHP helper functions and autoloading them through Composer. It also recommends keeping helpers small and free of hidden I/O or state.
Key features
- 01Create PHP helper files
- 02Register helpers in Composer
- 03Regenerate the autoloader
- 04Keep helpers small and pure
- 05Prefer value-object methods for domain logic
Use cases
- 01Adding a reusable formatting function
- 02Autoloading project helper functions
- 03Deciding whether logic belongs in a helper or value object
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ jpcaparas/ superpowers-laravel --skill laravel:custom-helpersAfter installing, type/laravel:custom-helpersin Claude Code to confirm it loaded.
Details
From the project READMECustom Helpers
Create a helper file
// app/Support/helpers.php
function money(int $cents): string { return number_format($cents / 100, 2); }
Autoload
Add to composer.json:
{
"autoload": { "files": ["app/Support/helpers.php"] }
}
Run composer dump-autoload.
Guidelines
- Keep helpers small and pure; avoid hidden IO/state
- Prefer static methods on value objects when domain-specific
Comments
Markdown supported