Skip to content

Commit 85cb977

Browse files
committed
fix: patch up info
1 parent e7128a2 commit 85cb977

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/docs/index.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,23 @@ Don't worry if you're not familiar with these concepts, we'll provide videos and
6363

6464
Leaf is built with many classes and components, but for simpler apps or APIs, it also offers a functional mode. This lets you use Leaf and its modules without class imports, instantiation, or lengthy namespaces—keeping things simple and streamlined.
6565

66-
Of course, you can still use Leaf in class mode if you prefer that. Here's an example of a simple Leaf app in functional mode:
66+
Of course, you can still use Leaf in class mode if you prefer that. Here's an example of a simple Leaf app in both modes:
6767

68-
```php
68+
::: code-group
69+
70+
```php [Functional Mode]
71+
<?php
72+
73+
require __DIR__ . '/vendor/autoload.php';
74+
75+
app()->get('/', function () {
76+
response()->json(['message' => 'Leaf is amazing!']);
77+
});
78+
79+
app()->run();
80+
```
81+
82+
```php [Class Mode]
6983
<?php
7084

7185
use Leaf\App;
@@ -81,6 +95,8 @@ $app->get('/', function () use ($app) {
8195
$app->run();
8296
```
8397

98+
:::
99+
84100
The documentation will usually show you how to use modules in functional mode as this is the default mode for Leaf. However, if you are migrating from another framework or you prefer to use Leaf in class mode, you can always instantiate the classes and use them as you would in any other framework.
85101

86102
## Getting Started

src/docs/mvc/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Leaf is a lightweight PHP framework with a ton of loosely coupled libraries that
1313
MVC stands for Model-View-Controller. It is a pattern that separates your application into three distinct parts:
1414

1515
- Models: These are the classes that represent your data. They are responsible for interacting with your database, and for validating your data.
16-
- Views: These are the files that are responsible for displaying your data to your user. They are usually written in HTML, but can also be written in other templating languages like [BareUI](/docs/frontend/bareui/) or [Blade](/docs/frontend/blade/) or frameworks like [Vue](https://vuejs.org/) or [React](https://reactjs.org/)
16+
- Views: These are the files that are responsible for displaying your data to your user. They are usually written in HTML, but can also be written in other templating languages like [BareUI](/docs/frontend/bareui) or [Blade](/docs/frontend/blade) or frameworks like [Vue](https://vuejs.org/) or [React](https://reactjs.org/)
1717
- Controllers: These are the classes that are responsible for handling the user's request, and for returning the appropriate response.
1818

1919
::: details New to MVC?

0 commit comments

Comments
 (0)