You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: improve first-application guide flow and clarity
Reorder steps so module registration comes before controller creation,
add marko open command, and clarify app/foo directory creation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Create an `app/foo` directory for your local module. It needs a `composer.json` to be recognized as a module:
18
+
19
+
```json title="app/foo/composer.json"
20
+
{
21
+
"name": "app/foo",
22
+
"type": "marko-module",
23
+
"autoload": {
24
+
"psr-4": {
25
+
"App\\Foo\\": "src/"
26
+
}
27
+
},
28
+
"extra": {
29
+
"marko": {
30
+
"module": true
31
+
}
32
+
}
33
+
}
34
+
```
35
+
36
+
## 3. Create a Controller
16
37
17
38
Controllers handle HTTP requests. Create one using PHP attributes to define routes:
18
39
@@ -38,38 +59,16 @@ class GreetingController
38
59
}
39
60
```
40
61
41
-
## 3. Register Your Module
42
-
43
-
Your `app/foo/` directory needs a `composer.json` to be recognized as a module:
44
-
45
-
```json title="app/foo/composer.json"
46
-
{
47
-
"name": "app/foo",
48
-
"type": "marko-module",
49
-
"autoload": {
50
-
"psr-4": {
51
-
"App\\Foo\\": "src/"
52
-
}
53
-
},
54
-
"extra": {
55
-
"marko": {
56
-
"module": true
57
-
}
58
-
}
59
-
}
60
-
```
61
-
62
-
Place the controller at `app/foo/src/Controller/GreetingController.php`.
63
-
64
62
## 4. Start and Test
65
63
66
64
```bash
67
65
marko up
66
+
marko open
68
67
```
69
68
70
69
> If `marko` isn't installed yet, run `composer global require marko/cli` first. See [Installation](/docs/getting-started/installation/#install-the-cli) for details.
71
70
72
-
Visit`http://localhost:8000/hello/World` and you'll see:
71
+
This opens the site up in your browser. Then, just navigate to`http://localhost:8000/hello/World` and you'll see:
0 commit comments