Prisma Client PHP is an auto-generated query builder that enables type-safe database access in PHP.
npm install prisma-client-phpcreate-prisma-php-app package, which provides a fast and efficient PHP environment for development. It features component-based architecture and file-based routing, similar to Next.js and React, but optimized for PHP.
npx prisma generate in TypeScript but tailored for PHP. This allows developers to effortlessly access, modify, and manage database records using a structured and intuitive API.
bash
npx create-prisma-php-app@latest
`
3. Remember to chose Prisma PHP ORM when prompted.
4. Generate Prisma Client PHP classes by running:
`bash
npx ppo generate
`
This command will convert your schema.prisma models into PHP classes, enabling you to interact with your database using these generated classes.
Adding Prisma Client PHP to an Existing Prisma PHP Project
To integrate Prisma Client PHP into an existing Prisma PHP project, follow these steps:
1. Open your terminal.
2. Install Prisma Client PHP globally by running:
`bash
npm install -g prisma-client-php@latest
`
This command installs the Prisma Client PHP package globally, making it available for use in any PHP project.
3. Initialize Prisma Client PHP in your project by running:
`bash
npx ppo init
`
This command sets up all necessary packages for Prisma Client PHP to function within your existing project.
Features
- Auto-Generated PHP Classes: Prisma Client PHP automatically generates PHP classes based on your Prisma schema.
- Type-Safe Database Queries: Work with your database in a structured and predictable way.
- Seamless ORM Integration: Leverages Prisma ORM’s powerful query engine within a PHP environment.
- Component-Based Development: Works alongside create-prisma-php-app, providing a modern development experience.
- File-Based Routing: Inspired by Next.js and React, simplifying route management in PHP projects.
Contributing
We welcome contributions to Prisma Client PHP! If you have suggestions, bug reports, or pull requests, feel free to open an issue or submit a PR in the repository.
License
Prisma Client PHP is licensed under the MIT License. See the LICENSE` file for more details.