rareloop / hatchet
Installs: 31 426
Dependents: 2
Suggesters: 0
Security: 0
Stars: 10
Watchers: 2
Forks: 2
Open Issues: 2
Requires
- php: ^8.0.0
- icanboogie/inflector: ^2.0
- rareloop/lumberjack-core: ^5.0.1||^6.0.0
- statamic/stringy: ^3.1.1
- symfony/console: ^4.1
Requires (Dev)
- brain/monkey: ^2.4.0
- mikey179/vfsstream: ^1.6.9
- mockery/mockery: ^1.4.4
- php-coveralls/php-coveralls: ^2.5.2
- php-mock/php-mock: ^2.0
- phpunit/phpunit: ^9.5.20
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-11-05 17:28:05 UTC
README
Installation
composer require rareloop/hatchet
Once installed you need to copy the hatchet
file into your Lumberjack theme directory.
It is assuming you're using Lumberjack inside Bedrock. If not, you may need to make some changes to paths in the hatchet
file
Basic Usage
You can now access the Hatchet CLI from inside your Lumberjack theme directory:
To show available commands
php hatchet list
To run a command
For a given command called test:command
you would run the following:
php hatchet test:command
Get additional help about a command
For a given command called test:command
you would run the following:
php hatchet help test:command
Adding Commands
To add additional commands to Hatchet add them to config/hatchet.php
(create the file if it doesn't exist).
// config/hatchet.php return [ 'commands' => [ MyCommand::class, ], ];
Writing Commands
Create a subclass of Rareloop\Hatchet\Commands\Command
:
namespace MyNamespace; use Rareloop\Hatchet\Commands\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ControllerMake extends Command { protected $signature = 'test:command {paramName : The description of the parameter}'; protected $description = 'A description of the command'; protected function execute(InputInterface $input, OutputInterface $output) { // Command implementation } }
Hatchet uses the same $signature
syntax as Laravel, see here for more information.
Hatchet Command
is a subclass of Symfony's Command
object, for more information on how to implement the execute()
function see here.