Skip to content

Commit

Permalink
Merge pull request #4 from DasunNethsara-04/main
Browse files Browse the repository at this point in the history
README updated
  • Loading branch information
DasunNethsara-04 authored Oct 24, 2024
2 parents f932f9e + d73712b commit 15c4a17
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
6 changes: 3 additions & 3 deletions App/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace ZenithPHP\App;

use ZenithPHP\Core\Http\InitEnv;
use ZenithPHP\Core\Http\Router;

InitEnv::load();
// Correct namespace for Router


use ZenithPHP\Core\Http\Router;
Router::get('/', 'WelcomeController', 'index');
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ To get started with ZenithPHP, follow the instructions below:

2. Navigate to the project directory:
```bash
cd zenithphp
cd full-zenith-framework
```

3. Install dependencies using Composer:
Expand All @@ -49,6 +49,7 @@ To get started with ZenithPHP, follow the instructions below:
## Folder Structure

- **App/**: Contains the core application files.
- **Core/**: The framework's core classes and functions.
- **Controller/**: Houses all controllers for handling requests.
- **Model/**: Where the application models are defined.
- **View/**: Contains all view files (HTML/PHP templates).
Expand All @@ -59,21 +60,24 @@ To get started with ZenithPHP, follow the instructions below:

To create your first route:

1. Open `App/Init.php` and define your route:
1. Open `App/routes.php` and define your route:
```php
Router::get('/welcome', 'WelcomeController', 'index');
use ZenithPHP\Core\Http\Router;
Router::get('/hello', 'WelcomeController', 'index');
```

2. Create a new controller inside `Controller/WelcomeController.php`:
```php
namespace App\Controller;
2. Create a new controller (*WelcomeController.php*) inside `App/Controllers/`:
```php
use ZenithPHP\Core\Controller\Controller;
class WelcomeController {
public function index() {
class WelcomeController extends Controller
{
public function index()
{
$this->view('welcome');
}
}
```
}
}
```

3. Now, create a new view file inside `View/welcome.php`:
```html
Expand Down

0 comments on commit 15c4a17

Please sign in to comment.