Create 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.

Prerequisites

Ensure your system is equipped with:

Installation Steps:

Create a new Prisma PHP project: in XAMPP C:\\xampp\\htdocs\\ directory, is good to have your projects organize in a folder, for that you can create a folder with the name C:\\xampp\\htdocs\\projects in the projects folder run the command:

npx create-prisma-php-app@latest

You will be asked for the project name, and then if you want to include Tailwind CSS and other features.

✔ Would you like to use Tailwind CSS? … No / Yes

Select "Yes" to include Tailwind CSS in your project.

Install composer dependencies: in the project directory, run the command:

composer install

If you have chosen to install websocket and encounter an error like this:

- Installing react/promise (v3.1.0): Cloning e563d55d16 from cache
e563d55d1641de1dea9f5e84f3cccc66d2bfe02c is gone (history was rewritten?)
Install of react/promise failed

Solution:

  1. Stop the Apache server to make changes safely.
  2. Go to php.ini, search for extension=zip. If you find ;extension=zip, remove the ; to enable the extension then save changes
  3. Restart Apache to apply the changes.
  4. Run composer install again.

Set your PHP ROOT PATH in ./prisma-php.json file if you have select the option to install Prisma PHP ORM, else you can skip this step.

phpRootPathExe: "D:\\xampp\\php\\php.exe", // Replace with your PHP path

Run the project

npm run dev

If you get an "Error" like this:

  browser-sync : File C:\Users\Username\AppData\Roaming\npm\browser-sync.ps1
    cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies
    at https:/go.microsoft.com/fwlink/?LinkID=135170.
    At line:1 char:1
    + browser-sync start --proxy localhost:3000 --files "public/**/*"
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

Solution

Run the following command in PowerShell as an Administrator:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Or, if you want to bypass the policy for the current session, run the following command:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass