Getting Started
Create routes, controllers, and views using a clear MVC structure.
1. Define a Route
PHP config/routes.php
use App\Core\Routing\Router;
use App\Controllers\WebsiteController;
Router::get('/', [WebsiteController::class, 'home']);
2. Create a Controller
PHP App/Controllers/HomeController.php
public function home(): void
{
$this->view('site/home', [
'title' => 'ZeroPing',
'active' => 'home',
]);
}
3. Build a View
PHP resources/views/site/home.php
<!-- views/site/home.php -->
<h1>Welcome to ZeroPing</h1>
<p>Your app is running.</p>
4. Run the App
BASH terminal
php zero serve
ZeroPing development server started.
➜ Local: http://localhost:1437
➜ Network: http://172.18.0.2:1437
Press Ctrl+C to stop the server.
GitHub