Skip to content

Commit 0bc6b24

Browse files
committed
Review of Chapter 11
1 parent 0a0f8b5 commit 0bc6b24

5 files changed

Lines changed: 61 additions & 11 deletions

File tree

app/pages/6.0/10.users/chapter.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,10 @@ description: In this chapter, you'll learn about the various user account featur
77

88
# Users
99

10-
In this chapter, you'll learn about the user and admin [account features](/users/user-accounts) that come built-in and fully implemented in UserFrosting, as well as UserFrosting's powerful [role-based access control system](/users/access-control).
10+
Every web application needs to know **who is using it**. User management covers fundamental questions: Who can access this? What can they do? How do we secure their credentials?
11+
12+
Building user management from scratch is complex—you need authentication, secure password storage, sessions, password recovery, permissions, activity tracking, and privacy compliance. Getting it wrong creates security vulnerabilities.
13+
14+
UserFrosting handles all this for you with a **complete built-in user management system**: user accounts, authentication, registration, password reset, email verification, and role-based access control (RBAC). Focus on your app's unique features while relying on UserFrosting's battle-tested foundation.
15+
16+
This chapter covers [user and admin account features](/users/user-accounts) and UserFrosting's powerful [role-based access control system](/users/access-control) for defining who can do what.

app/pages/6.0/11.cli/01.commands/docs.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Built-in Commands
33
description: An overview of the commands available in Bakery, UserFrosting's powerful CLI tool.
4-
wip: true
54
---
65

76
Web applications need more than just a web interface. You need to run database migrations, clear caches, seed test data, build assets, and perform maintenance tasks. Doing these through a browser is awkward at best. Command-line tools are perfect for these tasks—fast, automatable, and scriptable.
@@ -79,6 +78,27 @@ The `assets:webpack` command is an alias for the **Webpack Encore** scripts used
7978
8079
See the [Asset Management](/asset-management) chapter for more information about asset bundles and these options.
8180

81+
### assets:vite
82+
83+
The `assets:vite` command is an alias for the **Vite** scripts used to compile frontend dependencies to `/public/assets` or run the Vite development server. Behind the scenes, it's an alias for the npm commands `npm run vite:dev` and `npm run vite:build`.
84+
85+
```bash
86+
$ php bakery assets:vite [options]
87+
```
88+
89+
| Option | Description | Alias of |
90+
|------------------|---------------------------------------------------------|-----------------------|
91+
| _no options_ | Run Vite development server (when `assets.vite.dev` is `true`) or compile the assets for production (when `assets.vite.dev` is `false`) | `npm run vite:dev` or `npm run vite:build` |
92+
| -p, --production | Force the creation of a production build | `npm run vite:build` |
93+
94+
> [!NOTE]
95+
> The `assets.vite.dev` config value (default `true`) determines whether the Vite development server runs or a production build is created. In production mode, this defaults to `false`.
96+
97+
> [!NOTE]
98+
> This command will skip execution if no `vite.config.js` or `vite.config.ts` file is found in the current directory.
99+
100+
See the [Asset Management](/asset-management) chapter for more information about Vite and asset bundles.
101+
82102
### bake
83103

84104
Bake is the general installation command. It combines `setup:db`, `setup:mail`, `debug`, `migrate`, `create:admin-user`, `assets:build` and `clear-cache` into a single command:
@@ -355,6 +375,24 @@ $ php bakery migrate:status [options]
355375
| -d, --database=DATABASE | The database connection to use |
356376

357377

378+
### migrate:clean
379+
380+
The `migrate:clean` command removes stale migrations from the migration repository (database). A migration becomes "stale" when it was previously run but its migration class file no longer exists in the codebase.
381+
382+
> [!CAUTION]
383+
> This command should be used as a **last resort**. If a stale migration is a dependency of another migration, you should try restoring the migration files instead of running this command, to avoid further issues.
384+
385+
```bash
386+
$ php bakery migrate:clean [options]
387+
```
388+
389+
| Option | Description |
390+
| ----------------------- | -------------------------------------- |
391+
| -d, --database=DATABASE | The database connection to use |
392+
| -f, --force | Do not prompt for confirmation |
393+
394+
Common use case: If you ran a migration and then deleted the migration class file before running `down()` for that migration, the migration entry will remain in the database but cannot be rolled back. This command will remove such stale entries from the migration repository.
395+
358396
### route:list
359397

360398
Display the list of all registered [routes](/routes-and-controllers/front-controller).

app/pages/6.0/11.cli/02.custom-commands/docs.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Custom Commands
33
description: You may extend the UserFrosting\System\Bakery\BaseCommand class to implement your own CLI commands that can be run through Bakery.
4-
wip: true
54
---
65

76
While the Bakery CLI tool comes with great built-in commands, your sprinkles can also take advantage of the Bakery by adding their own cli commands.

app/pages/6.0/11.cli/03.extending-commands/docs.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: Extending Aggregator Commands
33
description: You may add custom sub-commands to the bake, setup, and debug commands through events.
4-
wip: true
54
---
65

7-
*Aggregator commands* is a fancy term to identify core bakery commands that just run multiple sub-commands in one operation. UserFrosting uses 3 of those special commands:
6+
*Aggregator commands* is a fancy term to identify core bakery commands that just run multiple sub-commands in one operation. UserFrosting uses 4 of those special commands:
87

9-
1. [bake](/cli/commands#bake)
10-
2. [setup](/cli/commands#setup)
11-
3. [debug](/cli/commands#debug)
8+
1. [assets:build](/cli/commands#assetsbuild)
9+
2. [bake](/cli/commands#bake)
10+
3. [setup](/cli/commands#setup)
11+
4. [debug](/cli/commands#debug)
1212

1313
Those commands are typically used as "installation" steps. It this situation, it's much more simpler to run one command than multiple ones. You can easily add your own command(s) to any of these aggregators using [event listeners](/advanced/events#listener).
1414

@@ -89,6 +89,12 @@ If you need to place your command at a specific place in the stack, you can use
8989
> [!NOTE]
9090
> You can learn more about Event Listening in [Chapter 18](/advanced/events).
9191

92+
## Adding Custom Commands to the `assets:build` command
93+
94+
To add custom sub-commands to the `assets:build` aggregator, the same process as for the "bake" command can be used, but instead of listening to the `BakeCommandEvent` in the recipe, the listener is matched to the `AssetsBuildCommandEvent`.
95+
96+
This is particularly useful if you want to add custom asset compilation steps. For example, you might want to run additional build tools or post-processing steps after the default asset build commands.
97+
9298
## Adding Custom Commands to the `setup` command
9399

94100
To add custom sub-commands to the `setup` aggregator, the same process as for the "bake" command can be used, but instead of listening to the `BakeCommandEvent` in the recipe, the listener is matched to the `SetupCommandEvent`.

app/pages/6.0/11.cli/chapter.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
22
title: Bakery CLI
33
description: Bakery is UserFrosting's very own command line interface (CLI) tool.
4-
wip: true
54
---
65

76
#### Chapter 11
87

98
# Bakery CLI
109

11-
UserFrosting provides its own Command-line Interface tool, or CLI, called the **Bakery**.
10+
Many critical tasks need to happen outside the web request cycle—database migrations, asset compilation, cache clearing, and deployment automation can't wait for a page load or be safely exposed through a web interface.
1211

13-
This tool allows you to run administrative commands like setting up your database, running tests, or debugging an existing installation.
12+
UserFrosting provides **Bakery**, a powerful command-line interface (CLI) built on the Symfony Console component. Bakery gives you pre-built commands for database migrations, user management, asset compilation, and debugging. You can also create custom commands and extend existing ones using UserFrosting's event system.
13+
14+
This chapter covers [built-in commands](/cli/commands), [creating custom commands](/cli/custom-commands), and [extending commands](/cli/extending-commands).

0 commit comments

Comments
 (0)