Prisma PHP App
Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM
create-prisma-php-app
is an innovative command-line tool designed to seamlessly integrate PHP with Prisma ORM. This tool stands out by offering a unique combination of PHP's robust server-side capabilities with Prisma's modern ORM features. Whether you're building a small project or a large-scale application,
create-prisma-php-app
provides the tools and flexibility needed to elevate your development experience.
Get Started with Prisma PHP
Prerequisites
Ensure your system is equipped with:
- Node.js: Version 18.x or higher Download Node.js
- XAMPP: (or any PHP 8.2+ environment) Download XAMPP
- Composer: Version 2.x or higher Download Composer
After downloading the installer to install the software, open the command prompt and run the following commands to check if the software is installed correctly:
For Node.js
After installing Node.js, run the following commands:
-
node -v// to check the node version -
npm -v// to check the version of npm -
npm install -g npm@latest// if npm is not installed
For XAMPP
For XAMPP, it is recommended to install it in the default path C:\xampp.
After installing XAMPP, make sure to enable the extension=zip in the php.ini file. This is required to install Composer dependencies.
Create a new Prisma PHP project: in XAMPP C:\xampp\htdocs\ directory, it is good to have your projects organized in a folder. You can create a folder named C:\xampp\htdocs\projects where you can create your Prisma PHP project.
For Composer
While installing Composer, make sure to check the box that says developer mode. This will allow you to set the path to C:\ProgramData\ComposerSetup\bin, which will be used to install Composer globally.
Confirm PHP Installation
Check if PHP is installed and added to environment variables:
If you get an error like:
Follow these steps to fix path issues:
- Open the Control Panel
- Click on System and Security > System
- Click on Advanced system settings > Environment Variables
- Under System variables, click on Path and then click on Edit
- Click on New and add the path to the PHP folder (e.g.,
C:\xampp\php) - Click OK to save changes, then restart your command prompt.
Documentation and Resources
Installation Steps
Run the create command:
npx create-prisma-php-app@latest
Interactive Prompt:
✔ Would you like to use Tailwind CSS? … No / Yes
Select "Yes" to include Tailwind CSS.
Install composer dependencies:
In the project directory, run:
composer install
Troubleshooting WebSocket Install
If you encounter the "react/promise failed" error:
from cache... is gone (history was rewritten?)
Install of react/promise failed
Solution:
- Stop the Apache server.
- Open
php.iniand search forextension=zip. - Remove the semicolon
;to enable it. - Restart Apache and run
composer installagain.
Set PHP Root Path (Optional)
If you selected Prisma PHP ORM, update ./prisma-php.json:
phpRootPathExe: "C:\\xampp\\php\\php.exe", // Replace with your PHP path
Run the project
npm run dev
If you get a "SecurityError" in PowerShell:
browser-sync : File C:\...\browser-sync.ps1 cannot be loaded...
CategoryInfo : SecurityError: (:) [], PSSecurityException
FullyQualifiedErrorId : UnauthorizedAccess
Solution
Run PowerShell as Administrator and execute one of the following:
Option 1 (Permanent for Current User):
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Option 2 (Current Session Only):
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass