Skip to content

Commit 0603a07

Browse files
committed
feat: update docs to match MVC 3.9
1 parent 5325aad commit 0603a07

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

src/docs/mvc/commands.md

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Leaf MVC's aloe command line tool is built on top of Symfony's console component
4949

5050
## Manually creating a command
5151

52-
All commands created through the `g:command` command are stored in the `app/console` directory and are automatically loaded by Leaf MVC. However, you can also create a command manually by creating a new class that extends the `Command` class and implementing the `handle()` method just like the example above.
52+
The `g:command` command is a shortcut to creating a new command which creates a boilerplate command class for you in the `app/console` directory. If you want to create a command manually, you can create a new class that extends the `Command` class and implements the `handle()` method.
5353

5454
```php
5555
<?php
@@ -82,32 +82,23 @@ class CachePurgeCommand extends Command
8282
}
8383
```
8484

85-
If you are using Leaf MVC v3.8 and above, the command is automatically loaded by Leaf MVC. If you are using Leaf MVC v3.7 and below, you will need to register the command in the `app/console/Commands.php` file.
85+
Be sure to keep your command class in the `App\Console` namespace and extend the `Command` class and in the `app/console` directory. Once you've created your command, Leaf MVC will automatically load it when you run the `php leaf` console.
8686

87-
```php
88-
<?php
87+
::: details Commands not auto-loading?
88+
If your command is not auto-loading, make sure you have the latest versions of MVC Core and Aloe installed.
8989

90-
namespace App\Console;
90+
::: code-group
9191

92-
class Commands
93-
{
94-
/**
95-
* Register commands
96-
*
97-
* @param $console
98-
* @return void
99-
*
100-
*/
101-
public static function register($console): void
102-
{
103-
$console->register([
104-
ExampleCommand::class,
105-
CachePurgeCommand::class
106-
]);
107-
}
108-
}
92+
```bash:no-line-numbers [Leaf CLI]
93+
leaf install aloe mvc-core
94+
```
95+
96+
```bash:no-line-numbers [Composer]
97+
composer require leafs/aloe leafs/mvc-core
10998
```
11099

100+
:::
101+
111102
## Command Arguments
112103

113104
Command arguments are values that are passed to the command when it is run in the console. For example, if you have a command named `example` and you run it like this:

src/docs/mvc/libraries.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ php leaf config:lib
1414

1515
That's it! A `lib` folder will be created in your application root and Leaf will now autoload any library you place in this folder.
1616

17-
::: info Older Leaf MVC versions
17+
<!-- ::: info Older Leaf MVC versions
1818
If you are using an older version of Leaf MVC where you don't have the `config:lib` command, you simply need to head over to your `public/index.php` file and uncomment the following line:
1919
2020
```php
2121
// \Leaf\Core::loadLibs();
2222
```
2323
24-
:::
24+
::: -->
2525

2626
## Creating a Library
2727

0 commit comments

Comments
 (0)