Prisma PHP Examples

Explore practical implementations ranging from a "Hello World" kick start to complex Dashboards. Copy, paste, and ship your next idea.

Kick Start

Get a standard Prisma PHP application running in seconds. This scaffold includes the file structure, router, and basic configuration.

terminal
$ composer create-project prisma/starter my-app
  Installing dependencies...
  Application ready on http://localhost:3000

Application Guides

Step-by-step guides to building complete applications.

Todo App

A classic CRUD application demonstrating routing, database migrations, and frontend reactivity.

CRUD SQLite

E-Commerce Dashboard

From zero to hero: Build a complex admin panel with charts, data tables, and sidebars.

Analytics Layouts

Core Features

Authentication
AuthMiddleware.php
use Lib\Auth\Auth;

$auth = Auth::getInstance();

if (!$auth->check()) {
    return redirect('/login');
}

$user = $auth->user();

Secure routes with built-in JWT or Session guards.

Database
UserController.php
use Lib\Prisma\Classes\Prisma;

$users = Prisma::getInstance()
    ->user
    ->findMany([
        'where' => [
            'active' => true
        ]
    ]);

Fluent ORM syntax for PostgreSQL, MySQL, and SQLite.

Page Caching
index.php
use PP\CacheHandler;

// Explicitly enable cache for this page
CacheHandler::$isCacheable = true;

// Cache for only 10 seconds
// (useful for semi-realtime dashboards)
CacheHandler::$ttl = 10;

Enable full-page caching and set TTL directly in your view headers.

Example Directory

Topic Complexity Key Concepts
Kick Start Beginner Installation, Folder Structure
Todo MVC Intermediate CRUD, Event Handling, Validation
Admin Dashboard Advanced Authentication, Charts, DataTables
API Server Intermediate JSON Responses, MCP Integration