not-found.php

The not-found.php file is a core component of the Prisma PHP environment. It comes pre-installed to handle 404 errors immediately out of the box.

1

Unmatched URL

Any visitor hitting a non-existent route (e.g., /unknown-page) is automatically directed to this file. No configuration is required.

2

Manual Trigger

You can invoke the 404 UI manually within your logic, such as when a database record is missing.

use PP\Header\Boom;

$user = $prisma->user->find($id);

if (!$user) {
    // Manually renders not-found.php
    Boom::notFound(); 
}

Customizing the UI

Since app/not-found.php already exists, you can simply edit it to match your brand. It accepts standard HTML and PHP.

app/not-found.php
<div class="min-h-screen flex flex-col items-center justify-center">
    <h1 class="text-6xl font-bold text-zinc-900">404</h1>
    <p class="text-xl text-zinc-500 mt-4">
        We couldn't find the page you were looking for.
    </p>
    
    <a href="/" class="mt-8 px-6 py-3 bg-black text-white rounded-lg hover:opacity-80 transition">
        Return Home
    </a>
</div>

HTTP Status Behavior

Standard Response: Returns HTTP 404.
Streamed Response: Returns HTTP 200. Since headers are sent before the error occurs in a stream, the status code cannot be changed to 404 mid-stream.