CLI
Command and Conquer
CLI
Let's get artisanal
Introduction
Morningmedley boots up Laravel Artisan as a sub command of the WordPress CLI.
This allows you to use many of the standard artisan commands and tools from within WordPress.
Run the following command to see it in action and to see what commands are supported!
wp artisan
Getting Help
Normally you would use the --help flag for getting info about a command, but since this is flag is reserved for WordPress' help command we can not use it.
Instead, Morningmedley adds an alias called --doc that does the same.
So to get help, or documentation, about the artisan list command you would call:
wp artisan list --doc
Creating Commands
You can create Illuminate Console Commands. See Writing Commands
Registering Commands
In app.php
/bootstrap/app.php
<?php
return MorningMedley::configure(dirname(__FILE__, 2))
->withCommands([
\MedleyApp\Console\MyCoolCommand::class, // An Illuminate Command Class
])
->create();
As part of a service
/bootstrap/app.php
<?php
return MorningMedley::configure(dirname(__FILE__, 2))
->withProviders([
\MedleyApp\Providers\MyCoolProvider::class, // An Illuminate ServiceProvider
])
->create();
/app/Providers/MyCoolProvider.php
<?php
namespace MedleyApp\Providers;
class MyCoolProvider extends \Illuminate\Support\ServiceProvider
{
public function register()
{
}
public function boot()
{
$this->commands([
\MedleyApp\Console\MyCoolCommand::class
]);
}
}