Registry / database / create-prisma-php-app

create-prisma-php-app

JSON →
library4.4.10jsnpmunverified

A CLI tool and library that bridges PHP with Prisma ORM, enabling PHP developers to use Prisma's schema-based database modeling and client generation. Current stable version 4.4.10, actively maintained (weekly updates). Key differentiators: generates PHP client classes from Prisma schema, supports multiple databases, and provides a familiar Laravel-style query builder. Requires Node.js for Prisma CLI and PHP 8.0+.

npm install create-prisma-php-app
INSTALL
IMPORT
SIG · CREATE-PRISMA-PHP-
C
create-prisma-php-app
databasejavascriptv4.4.10
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PrismaPHP
import PrismaPHP from 'create-prisma-php-app'
const PrismaPHP = require('create-prisma-php-app')
ESM-only since v4. No CommonJS support.
PrismaClient
import { PrismaClient } from 'create-prisma-php-app'
import PrismaClient from 'create-prisma-php-app'
Named export, not default.
PHPPrismaModel
import { PHPPrismaModel } from 'create-prisma-php-app'
import { PrismaModel } from 'create-prisma-php-app'
Export name differs from documentation; must include 'PHP' prefix.

Shows project setup using create script, schema definition with Prisma, and PHP client usage for creating a record.

npx create-prisma-php-app my-app cd my-app # Edit prisma/schema.prisma with your database models datasource db { provider = "postgresql" url = env("DATABASE_URL") } generator php_client { provider = "php-prisma-generator" } model User { id Int @id @default(autoincrement()) email String @unique name String? } # Run: npx prisma generate # Then in PHP: require 'vendor/autoload.php'; use Prisma\PrismaClient; $client = new PrismaClient(); $user = $client->user->create(['data' => ['email' => 'test@test.com']]);
Debug
Known issues
breakingRemoved CommonJS support in v4.0.0. All imports must use ESM syntax.
fix
Migrate require() calls to import statements.
affects: >=4.0.0
deprecatedModel PHP class generation auto-prefix removed. Use 'PHP' prefix manually in imports.
fix
Change import { PrismaModel } to import { PHPPrismaModel }.
affects: >=4.0.0
gotchaPrisma CLI must be installed globally or as devDependency. The package does not bundle Prisma.
fix
Run `npm install -g prisma` or `npm install --save-dev prisma` in your project.
affects: *
breakingDefault export changed from named object to function in v3.5.0.
fix
Use `import PrismaPHP from 'create-prisma-php-app'` and call as `PrismaPHP()`.
affects: >=3.5.0 <4.0.0
deprecatedPHP 7.x support dropped in v4.0.0. PHP 8.0+ required.
fix
Upgrade your PHP runtime to 8.0 or higher.
affects: >=4.0.0
Errors
Common errors & fixes
Error: Cannot find module 'prisma'
Prisma CLI not installed.
fix
Run `npm install prisma` in your project directory.
Class "Prisma\Models\User" not found
PHP client not generated or class autoloading missing.
fix
Run `npx prisma generate` and ensure `vendor/autoload.php` is required.
Fatal error: Uncaught TypeError: PrismaPHP(): Argument #1 ($config) must be of type array, string given
Passing a string instead of config object to PrismaPHP.
fix
Use `PrismaPHP(['schema' => 'path/to/schema.prisma'])` instead of a string path.
Upgrade
Version history
4.4.10latest on npm
Audit
Dependencies
prismarequiredCore Prisma ORM for schema management and client generation
phprequiredRequired PHP runtime (8.0+)
Agent activity
24 hits · last 30 days
node
12
OpenAI (training)
2
Resources
create-prisma-php-app — npm install create-prisma-php-app · libregistry