index.php
In Prisma PHP, routing is derived from your file system. An index.php file acts as the UI entry point for a specific route segment.
Creating a Page
To create the home page of your application, simply edit the index.php file at the root of your app directory.
src/app/index.php
<?php
// This renders HTML to the browser
echo "Hello, World!";
Accessible at:
http://localhost:3000/
Nested Routes
To create complex URL paths, you simply nest folders. The folder name becomes the URL segment.
| Folder Structure | Resulting URL |
|---|---|
|
app/index.php
|
/ |
|
app/dashboard/index.php
|
/dashboard |
|
app/dashboard/settings/index.php
|
/dashboard/settings |
app/dashboard/settings/index.php
<?php
echo "<h1>Settings Page</h1>";
echo "<p>This content lives at /dashboard/settings</p>";
View vs Logic
Remember: index.php is for rendering UI (HTML). If you need to return JSON data (like an API) or handle form processing without a view, use route.php instead.