diff --git a/README.md b/README.md
index ca17be0..61ad9b0 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,12 @@
- ZenithPHP
+ZenithPHP
-Welcome to **ZenithPHP**, a simple and lightweight PHP framework designed to streamline web application development.
-ZenithPHP follows the MVC (Model-View-Controller) architecture and provides developers with a clean and flexible
-foundation to build modern PHP applications with ease.
+Welcome to **ZenithPHP**, a simple and lightweight PHP framework designed to streamline web application development. ZenithPHP follows the MVC (Model-View-Controller) architecture and provides developers with a clean and flexible foundation to build modern PHP applications with ease.
+
+## Official Documentation
+You can find the official documentation for ZenithPHP at [ZenithPHP Documentation](https://zenithphp-framework.github.io/start.html). The documentation provides detailed information on how to get started with ZenithPHP, including installation instructions, routing, controllers, models, views, and more.
## Features
@@ -14,6 +15,7 @@ foundation to build modern PHP applications with ease.
- **Simple Namespacing**: Eliminate the need for `require_once` with proper namespacing.
- **Security Built-in**: Features like password hashing and input validation to keep your app secure.
- **Easy to Extend**: Customize the framework to suit your application’s needs with minimal effort.
+- **Pluto Template Engine**: Simplifies view rendering with a clean syntax and powerful directives.
## Installation
@@ -21,7 +23,7 @@ To get started with ZenithPHP, follow the instructions below:
1. Clone the repository:
```bash
- https://github.com/ZenithPHP-Framework/full-zenith-framework.git
+ git clone https://github.com/ZenithPHP-Framework/full-zenith-framework.git
```
2. Navigate to the project directory:
@@ -55,7 +57,7 @@ To get started with ZenithPHP, follow the instructions below:
- **.env**: Environment variables for the application.
- **.env.example**: Example environment variables file.
- **composer.json**: Composer dependencies file.
-- **cli**: Command-line interface for running the application and create models and controllers.
+- **cli**: Command-line interface for running the application and creating models and controllers.
## How to Get Started
@@ -71,13 +73,13 @@ To create your first route:
```php
use ZenithPHP\Core\Controller\Controller;
- class WelcomeController extends Controller
- {
- public function index()
- {
- $this->view('welcome');
- }
- }
+ class WelcomeController extends Controller
+ {
+ public function index()
+ {
+ $this->view('welcome');
+ }
+ }
```
3. Now, create a new view file inside `View/welcome.php`:
@@ -87,8 +89,8 @@ To create your first route:
4. Visit `http://localhost:8000/welcome` to see the result.
-
## Working with APIs
+
Now you can create APIs with ZenithPHP. Here's how you can create a simple API:
1. First, create a new route in `App/routes.php`:
@@ -110,7 +112,7 @@ Now you can create APIs with ZenithPHP. Here's how you can create a simple API:
{
protected string $table_name = 'users';
}
-
+ ```
4. Create a new controller. For that, you can use the CLI tool:
```bash
@@ -124,7 +126,7 @@ Now you can create APIs with ZenithPHP. Here's how you can create a simple API:
use ZenithPHP\Core\Http\Request;
use ZenithPHP\App\Models\User;
- class WelcomeController extends Controller
+ class UserController extends Controller
{
public function index(Request $request, Response $response)
{
@@ -137,6 +139,58 @@ Now you can create APIs with ZenithPHP. Here's how you can create a simple API:
6. Visit `http://localhost:8000/api/users` to see the JSON response.
+
+## Pluto Template Engine
+
+The **Pluto** template engine in ZenithPHP allows you to easily build dynamic views with clean and readable syntax. Here’s a quick overview of its directives:
+
+### Pluto Syntax
+
+- **Variable Output**: Use `<< $variable >>` to output PHP variables in the view.
+- **Conditional Statements**: Pluto offers `@if`, `@elseif`, `@else`, and `@endif` directives for conditional rendering.
+- **Looping**: Use `@foreach` and `@endforeach` to iterate over collections.
+- **Comments**: Use `<< // >>` to add comments in your templates.
+- **Yielding Sections**: Use `@yield` to define a section that will be replaced with content from child templates.
+- **Section Definition**: Use `@section` to define a section that can be filled in child templates.
+
+### Example Syntax
+`HomeController.php`
+```php
+class HomeController extends Controller
+{
+ public function index(Request $request, Response $response)
+ {
+ return view('home', [
+ 'username' => 'John Doe',
+ 'userRole' => 'admin',
+ 'items' => [
+ (object) ['name' => 'Laptop', 'price' => '$999'],
+ (object) ['name' => 'Smartphone', 'price' => '$499'],
+ ]
+ ]);
+ }
+}
+```
+`home.pluto.php`
+```php
+
+<< $username >>
+
+
+@if ($userRole == 'admin')
+ Welcome, Admin!
+@elseif ($userRole == 'member')
+ Welcome, Member!
+@else
+ Welcome, Guest!
+@endif
+
+
+@foreach ($items as $item)
+ << $item->name >> - << $item->price >>
+@endforeach
+```
+
## Security Features
- **Password Hashing**: Built-in password hashing methods for user authentication.