Prisma PHP ORM

Prisma PHP ORM is a powerful and modern database toolkit inspired by Prisma for TypeScript — but built specifically for PHP. It allows you to model your database schema in a simple declarative syntax and instantly generate a fully-typed PHP client to interact with your database using intuitive and type-safe queries.

Key Features

  • Schema-first approach with support for @relation, @default, @unique, and more.
  • Generate a fully-featured PHP Client with code completion for models and fields.
  • Support for SQLite, MySQL and PostgreSQL.
  • Run commands such as migrate, generate, push, pull, and reset.
  • Comprehensive ORM methods: findMany, findFirst, create, update, delete, and more.
  • Clean, expressive query syntax using fluent arrays.

Enhanced Developer Experience with PHPX Tag Support

For the best experience when working with Prisma PHP, it’s highly recommended to install the PHPX Tag Support Extension for VS Code .

This extension is built specifically for .php files and Prisma PHP’s component ecosystem. It dramatically improves productivity and reduces bugs by offering:

  • Model field auto-completion when writing queries such as where, include, orderBy, and select. Instantly see available fields for each model based on your Prisma schema.
  • Inline error and warning diagnostics when referencing invalid fields or using incorrect value types in ORM filters — e.g., using a string where a DateTime is expected.
  • Context-aware filtering — Prisma PHP helps you autocomplete nested fields and relations when querying associated models (e.g., user.posts.every.title).
  • Real-time validation of your ORM queries against the schema — if a model field doesn’t exist or has been renamed, you’ll see it immediately in your editor.
  • Hover previews for model fields, showing their type, relation, and optionality directly inside your editor.
  • Jump-to-definition (F12) support for navigating to the model definition inside your schema.prisma file.
  • Smart suggestions when typing Prisma methods like findMany, create, update, groupBy, and when specifying filtering operators (e.g., contains, gt, in).
  • Cleaner query building experience that reduces guesswork and improves confidence when constructing complex ORM queries.

✅ With the PHPX Tag Support extension, your Prisma PHP experience becomes as seamless as working with Prisma in TypeScript — but optimized for the PHP ecosystem.

Next Steps

  • Define your models in the schema.prisma file.
  • Run npx ppo generate to build your client.
  • Use $prisma->user->findMany() and other methods in your backend to interact with your data.
  • Explore features like include, where, orderBy, select, and nested relations.

Prisma PHP brings the reliability and developer ergonomics of Prisma to your PHP stack. Whether you're building a modern app with PHPX or integrating with APIs, the Prisma PHP ORM streamlines your data layer.