Skip to content

Commit 7a167f5

Browse files
committed
docs: sync the Markdown user guide with 4.8
1 parent 3b7516d commit 7a167f5

57 files changed

Lines changed: 7455 additions & 211 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/.anchors.json‎

Lines changed: 732 additions & 12 deletions
Large diffs are not rendered by default.

‎docs/.nav.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ nav:
1616
- installation/deployment.md
1717
- "Change Logs":
1818
- changelogs/index.md
19+
- changelogs/v4.8.0.md
1920
- changelogs/v4.7.7.md
2021
- changelogs/v4.7.6.md
2122
- changelogs/v4.7.5.md
@@ -100,6 +101,7 @@ nav:
100101
- "Upgrading From a Previous Version":
101102
- installation/upgrading.md
102103
- installation/backward_compatibility_notes.md
104+
- installation/upgrade_480.md
103105
- installation/upgrade_477.md
104106
- installation/upgrade_476.md
105107
- installation/upgrade_475.md
@@ -217,6 +219,7 @@ nav:
217219
- general/logging.md
218220
- general/errors.md
219221
- general/caching.md
222+
- general/context.md
220223
- general/ajax.md
221224
- general/modules.md
222225
- general/managing_apps.md
@@ -231,6 +234,7 @@ nav:
231234
- incoming/message.md
232235
- incoming/request.md
233236
- incoming/incomingrequest.md
237+
- incoming/form_requests.md
234238
- incoming/content_negotiation.md
235239
- incoming/methodspoofing.md
236240
- incoming/restful.md
@@ -285,6 +289,7 @@ nav:
285289
- libraries/file_collections.md
286290
- libraries/honeypot.md
287291
- libraries/images.md
292+
- libraries/locks.md
288293
- libraries/pagination.md
289294
- libraries/publisher.md
290295
- libraries/security.md
@@ -330,7 +335,9 @@ nav:
330335
- cli/cli_controllers.md
331336
- cli/spark_commands.md
332337
- cli/cli_commands.md
338+
- cli/cli_modern_commands.md
333339
- cli/cli_generators.md
340+
- cli/cli_modern_generators.md
334341
- cli/cli_library.md
335342
- cli/cli_signals.md
336343
- cli/cli_request.md

‎docs/changelogs/index.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
See all the changes.
88

9+
- [Version 4.8.0](v4.8.0.md)
910
- [Version 4.7.7](v4.7.7.md)
1011
- [Version 4.7.6](v4.7.6.md)
1112
- [Version 4.7.5](v4.7.5.md)

‎docs/changelogs/v4.3.0.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ The following items are affected:
250250
- **Config:** Now you can specify Composer packages to auto-discover manually. See [Code Modules](../general/modules.md#specify-composer-packages).
251251
- **Config:** Added `Config\Session` class to handle session configuration.
252252
- **Debug:** Kint has been updated to 5.0.2.
253-
- **Request:** Added new `$request->getRawInputVar()` method to return a specified variable from the raw stream. See [Retrieving Raw data](../incoming/incomingrequest.md#retrieving-raw-data-put-patch-delete).
253+
- **Request:** Added new `$request->getRawInputVar()` method to return a specified variable from the raw stream. See [Retrieving Raw data](../incoming/incomingrequest.md#retrieving-raw-data-put-patch-delete-query).
254254
- **Request:** Added new `$request->is()` method to query the request type. See [Determining Request Type](../incoming/incomingrequest.md#is).
255255

256256
## Message Changes

‎docs/changelogs/v4.8.0.md‎

Lines changed: 388 additions & 0 deletions
Large diffs are not rendered by default.

‎docs/cli/cli_commands.md‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
While the ability to use Controllers via CLI like any other route is convenient, you might find times where you need a little something different. That's where Spark commands come in. They are simple classes that do not need to have routes defined, making them perfect for building tools that developers can use to make their jobs simpler, whether by handling migrations or database seeding, checking cronjob status, or even building out custom code generators for your company.
44

5+
!!! danger "Deprecated since version 4.8.0"
6+
`BaseCommand` is deprecated, and running a command that extends it triggers a deprecation notice. Write new commands against `AbstractCommand` instead. See [Modern Spark Commands](cli_modern_commands.md).
7+
58
## Creating New Commands
69

710
You can very easily create new commands to use in your own development. Each class must be in its own file, must extend `CodeIgniter\CLI\BaseCommand`, and must implement the `run()` method.
@@ -139,7 +142,7 @@ $this->call('command_two', $params);
139142
- **Parameters**
140143
- **$e** `Throwable` The exception to use for error reporting.
141144

142-
A convenience method to maintain a consistent and clear error output to the CLI:
145+
A convenience method to maintain a consistent and clear error output on STDERR:
143146

144147
```php
145148
<?php
@@ -180,14 +183,3 @@ foreach ($this->options as $option => $description) {
180183
* --all Set for all namespaces, will ignore (-n) option
181184
*/
182185
```
183-
184-
#### getPad($array, $pad)
185-
186-
!!! danger "Deprecated since version 4.0.5"
187-
Use `CodeIgniter\CLI\BaseCommand::setPad()` instead.
188-
189-
- **Parameters**
190-
- **$array** `array` The `$key` => `$value` array.
191-
- **$pad** `integer` The pad spaces.
192-
193-
A method to calculate padding for `$key => $value` array output. The padding can be used to output a well-formatted table in CLI.

‎docs/cli/cli_generators.md‎

Lines changed: 81 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ All built-in generators reside under the `Generators` group when listed using `p
88

99
```console
1010
php spark help <generator_command>
11+
php spark <generator_command> --help
1112
```
1213

1314
where `<generator_command>` will be replaced with the command to check.
1415

16+
!!! note "Note"
17+
The single-letter option shortcuts listed below (`-n`, `-s`, `-f`) are available since v4.8.0.
18+
1519
!!! note "Note"
1620
Do you need to have the generated code in a subfolder? If you want to create a controller class to reside in the `Admin` subfolder of the main `Controllers` folder, you will just need to prepend the subfolder to the class name, like this: `php spark make:controller admin/login`. This command will create the `Login` controller in the `Controllers/Admin` subfolder with a namespace of `App\Controllers\Admin`.
1721

@@ -43,8 +47,8 @@ make:cell <name> [options]
4347

4448
#### Options:
4549

46-
- `--namespace`: Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
47-
- `--force`: Set this flag to overwrite existing files on destination.
50+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
51+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
4852

4953
### make:command
5054

@@ -62,12 +66,15 @@ make:command <name> [options]
6266

6367
#### Options:
6468

65-
- `--command`: The command name to run in spark. Defaults to `command:name`.
66-
- `--group`: The group/namespace of the command. Defaults to `App` for basic commands, and `Generators` for generator commands.
67-
- `--type`: The type of command, whether a `basic` command or a `generator` command. Defaults to `basic`.
68-
- `--namespace`: Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
69-
- `--suffix`: Append the component suffix to the generated class name.
70-
- `--force`: Set this flag to overwrite existing files on destination.
69+
- `--command` (`-c`): The command name to run in spark. Defaults to `command:name`.
70+
- `--type` (`-t`): The type of command, whether a `basic` command or a `generator` command. Defaults to `basic`.
71+
- `--group` (`-g`): The group of the command. Defaults to `App` for basic commands, and `Generators` for generator commands.
72+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
73+
- `--suffix` (`-s`): Append the component suffix to the generated class name.
74+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
75+
76+
!!! note "Note"
77+
Since v4.8.0, the generated class is a [modern command](cli_modern_commands.md): a `basic` command extends `AbstractCommand`, and a `generator` command extends [AbstractGeneratorCommand](cli_modern_generators.md).
7178

7279
### make:config
7380

@@ -85,9 +92,9 @@ make:config <name> [options]
8592

8693
#### Options:
8794

88-
- `--namespace`: Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
89-
- `--suffix`: Append the component suffix to the generated class name.
90-
- `--force`: Set this flag to overwrite existing files on destination.
95+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
96+
- `--suffix` (`-s`): Append the component suffix to the generated class name.
97+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
9198

9299
### make:controller
93100

@@ -105,11 +112,11 @@ make:controller <name> [options]
105112

106113
#### Options:
107114

108-
- `--bare`: Extends from `CodeIgniter\Controller` instead of `BaseController`.
109-
- `--restful`: Extends from a RESTful resource. Choices are `controller` and `presenter`. Defaults to `controller`.
110-
- `--namespace`: Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
111-
- `--suffix`: Append the component suffix to the generated class name.
112-
- `--force`: Set this flag to overwrite existing files on destination.
115+
- `--bare` (`-b`): Extends from `CodeIgniter\Controller` instead of `BaseController`.
116+
- `--restful` (`-r`): Extends from a RESTful resource. Choices are `controller` and `presenter`. Defaults to `controller`.
117+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
118+
- `--suffix` (`-s`): Append the component suffix to the generated class name.
119+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
113120

114121
!!! note "Note"
115122
If you use `--suffix`, the generated controller name will be like `ProductController`. That violates the Controller naming convention when using [Auto Routing](../incoming/controllers.md#auto-routing-improved) (Controller class names MUST start with an uppercase letter and ONLY the first character can be uppercase). So `--suffix` can be used when you use [Defined Routes](../incoming/routing.md#setting-routing-rules).
@@ -130,9 +137,9 @@ make:entity <name> [options]
130137

131138
#### Options:
132139

133-
- `--namespace`: Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
134-
- `--suffix`: Append the component suffix to the generated class name.
135-
- `--force`: Set this flag to overwrite existing files on destination.
140+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
141+
- `--suffix` (`-s`): Append the component suffix to the generated class name.
142+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
136143

137144
### make:filter
138145

@@ -150,9 +157,9 @@ make:filter <name> [options]
150157

151158
#### Options:
152159

153-
- `--namespace`: Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
154-
- `--suffix`: Append the component suffix to the generated class name.
155-
- `--force`: Set this flag to overwrite existing files on destination.
160+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
161+
- `--suffix` (`-s`): Append the component suffix to the generated class name.
162+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
156163

157164
### make:model
158165

@@ -170,12 +177,32 @@ make:model <name> [options]
170177

171178
#### Options:
172179

173-
- `--dbgroup`: Database group to use. Defaults to `default`.
174-
- `--return`: Set the return type from `array`, `object`, or `entity`. Defaults to `array`.
175-
- `--table`: Supply a different table name. Defaults to the pluralized class name.
176-
- `--namespace`: Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
177-
- `--suffix`: Append the component suffix to the generated class name.
178-
- `--force`: Set this flag to overwrite existing files on destination.
180+
- `--table` (`-t`): Supply a different table name. Defaults to the pluralized class name.
181+
- `--dbgroup` (`-g`): Database group to use. Defaults to `default`.
182+
- `--return` (`-r`): Set the return type from `array`, `object`, or `entity`. Defaults to `array`.
183+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
184+
- `--suffix` (`-s`): Append the component suffix to the generated class name.
185+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
186+
187+
### make:request
188+
189+
Creates a new FormRequest file.
190+
191+
#### Usage:
192+
193+
```
194+
make:request <name> [options]
195+
```
196+
197+
#### Argument:
198+
199+
- `name`: The name of the FormRequest class. **[REQUIRED]**
200+
201+
#### Options:
202+
203+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
204+
- `--suffix` (`-s`): Append the component suffix to the generated class name.
205+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
179206

180207
### make:seeder
181208

@@ -193,9 +220,9 @@ make:seeder <name> [options]
193220

194221
#### Options:
195222

196-
- `--namespace`: Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
197-
- `--suffix`: Append the component suffix to the generated class name.
198-
- `--force`: Set this flag to overwrite existing files on destination.
223+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
224+
- `--suffix` (`-s`): Append the component suffix to the generated class name.
225+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
199226

200227
### make:test
201228

@@ -215,8 +242,8 @@ make:test <name> [options]
215242

216243
#### Options:
217244

218-
- `--namespace`: Set the root namespace. Defaults to `Tests`.
219-
- `--force`: Set this flag to overwrite existing files on destination.
245+
- `--namespace` (`-n`): Set the root namespace. Defaults to `Tests`.
246+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
220247

221248
### make:transformer
222249

@@ -234,9 +261,9 @@ make:transformer <name> [options]
234261

235262
#### Options:
236263

237-
- `--namespace`: Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
238-
- `--suffix`: Append the component suffix to the generated class name.
239-
- `--force`: Set this flag to overwrite existing files on destination.
264+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
265+
- `--suffix` (`-s`): Append the component suffix to the generated class name.
266+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
240267

241268
### make:migration
242269

@@ -254,12 +281,14 @@ make:migration <name> [options]
254281

255282
#### Options:
256283

257-
- `--session`: Generate a migration file for database sessions.
258-
- `--table`: Set the table name to use for database sessions. Defaults to `ci_sessions`.
259-
- `--dbgroup`: Set the database group for database sessions. Defaults to `default` group.
260-
- `--namespace`: Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
261-
- `--suffix`: Append the component suffix to the generated class name.
262-
- `--force`: Set this flag to overwrite existing files on destination.
284+
- `--session`: Generate a migration file for database sessions. The `name` argument is ignored.
285+
- `--table` (`-t`): Set the table name to use for database sessions. Defaults to `ci_sessions`.
286+
- `--dbgroup` (`-g`): Set the database group for database sessions. Defaults to `default` group.
287+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
288+
- `--suffix` (`-s`): Append the component suffix to the generated class name.
289+
290+
!!! note "Note"
291+
`make:migration` has no `--force` option, since the timestamped file name only collides with an existing file when the same name is generated twice within one second.
263292

264293
### make:validation
265294

@@ -277,9 +306,9 @@ make:validation <name> [options]
277306

278307
#### Options:
279308

280-
- `--namespace`: Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
281-
- `--suffix`: Append the component suffix to the generated class name.
282-
- `--force`: Set this flag to overwrite existing files on destination.
309+
- `--namespace` (`-n`): Set the root namespace. Defaults to the value of `APP_NAMESPACE`.
310+
- `--suffix` (`-s`): Append the component suffix to the generated class name.
311+
- `--force` (`-f`): Set this flag to overwrite existing files on destination.
283312

284313
## Scaffolding a Complete Set of Stock Code
285314

@@ -302,9 +331,15 @@ will create the following files:
302331

303332
To include an `Entity` class in the scaffolded files, just add `--return entity` to the command and it will be passed to the model generator.
304333

334+
!!! note "Note"
335+
Since v4.8.0, `make:scaffold` accepts the `-b`, `-t`, `-g`, `-n`, `-s`, and `-f` shortcuts. `--restful` and `--return` have no shortcut here, since both use `-r` in their own commands. When the class name is omitted on an interactive run, it is asked for once and reused for every generated file.
336+
305337
## GeneratorTrait
306338

307-
All generator commands must use the `GeneratorTrait` to fully utilize its methods that are used in code generation.
339+
!!! danger "Deprecated since version 4.8.0"
340+
`GeneratorTrait` is the legacy way of building generator commands, tied to the deprecated `BaseCommand`. New generator commands should extend `AbstractGeneratorCommand` instead. See [Modern Generator Commands](cli_modern_generators.md).
341+
342+
Legacy generator commands use the `GeneratorTrait` to fully utilize its methods that are used in code generation.
308343

309344
## Declaring the Location of a Custom Generator Command Template
310345

0 commit comments

Comments
 (0)