Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Dec 3, 2023
2 parents 917645f + 49cac87 commit c5e6003
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion docs/custom/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,30 @@

Creating commands is as easy as adding one simple file to your project. You can place commands in `/site/assets/RockShell/Commands` or any of your modules `/site/modules/*/RockShell/Commands`.

Note that if you place it in one of your modules you need to adjust the namespace of your command to match your modules folder name. An example command can be found in RockMigrations: https://github.com/baumrock/RockMigrations/blob/main/RockShell/Commands/RmDemo.php
<div class="uk-alert uk-alert-warning">Note that if you place it in one of your modules you need to adjust the namespace of your command to match your modules folder name.</div>

Here is an example hello world command placed in `/site/assets/RockShell/Commands`:

```php
<?php

// when placed in the assets folder
// we need to use the Assets namespace!
namespace Assets;

use RockShell\Command;

class HelloWorld extends Command
{
public function handle()
{
$this->info("Hello World!");
return self::SUCCESS;
}
}
```

Another example command can be found in RockMigrations: https://github.com/baumrock/RockMigrations/blob/main/RockShell/Commands/RmDemo.php

The command uses the `RockMigrations` namespace to make sure we don't get any naming collisions.

Expand Down

0 comments on commit c5e6003

Please sign in to comment.