Skip to content

Commit

Permalink
fix: patch up info
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Dec 15, 2024
1 parent e7128a2 commit 85cb977
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions src/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,23 @@ Don't worry if you're not familiar with these concepts, we'll provide videos and

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.

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:
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:

```php
::: code-group

```php [Functional Mode]
<?php

require __DIR__ . '/vendor/autoload.php';

app()->get('/', function () {
response()->json(['message' => 'Leaf is amazing!']);
});

app()->run();
```

```php [Class Mode]
<?php

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

:::

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.

## Getting Started
Expand Down
2 changes: 1 addition & 1 deletion src/docs/mvc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Leaf is a lightweight PHP framework with a ton of loosely coupled libraries that
MVC stands for Model-View-Controller. It is a pattern that separates your application into three distinct parts:

- Models: These are the classes that represent your data. They are responsible for interacting with your database, and for validating your data.
- 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/)
- 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/)
- Controllers: These are the classes that are responsible for handling the user's request, and for returning the appropriate response.

::: details New to MVC?
Expand Down

0 comments on commit 85cb977

Please sign in to comment.