Skip to content

Commit f9b9a6a

Browse files
markshustclaude
andcommitted
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>
1 parent 1abb99a commit f9b9a6a

1 file changed

Lines changed: 24 additions & 25 deletions

File tree

docs/src/content/docs/getting-started/first-application.md

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,28 @@ composer create-project marko/skeleton hello-marko
1212
cd hello-marko
1313
```
1414

15-
## 2. Create a Controller
15+
## 2. Register Your Module
16+
17+
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
1637

1738
Controllers handle HTTP requests. Create one using PHP attributes to define routes:
1839

@@ -38,38 +59,16 @@ class GreetingController
3859
}
3960
```
4061

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-
6462
## 4. Start and Test
6563

6664
```bash
6765
marko up
66+
marko open
6867
```
6968

7069
> If `marko` isn't installed yet, run `composer global require marko/cli` first. See [Installation](/docs/getting-started/installation/#install-the-cli) for details.
7170
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:
7372

7473
```
7574
Hello, World! Welcome to Marko.

0 commit comments

Comments
 (0)