prisma-php 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/copilot-instructions.md +7 -1
- package/dist/docs/backend-only.md +204 -0
- package/dist/docs/commands.md +453 -0
- package/dist/docs/email.md +6 -0
- package/dist/docs/env.md +224 -0
- package/dist/docs/error-handling.md +35 -23
- package/dist/docs/fetching-data.md +3 -1
- package/dist/docs/get-started-ia.md +480 -0
- package/dist/docs/index.md +46 -2
- package/dist/docs/installation.md +21 -2
- package/dist/docs/layouts-and-pages.md +13 -1
- package/dist/docs/mcp.md +4 -1
- package/dist/docs/metadata-and-og-images.md +34 -22
- package/dist/docs/prisma-php-orm.md +1 -1
- package/dist/docs/project-structure.md +16 -2
- package/dist/docs/pulsepoint.md +5 -0
- package/dist/docs/route-handlers.md +18 -2
- package/dist/docs/swagger-docs.md +189 -0
- package/dist/docs/upgrading.md +13 -9
- package/dist/docs/websocket.md +4 -0
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
- Treat `dist/docs/index.md` as the entry point for Prisma PHP guidance in this repo.
|
|
6
6
|
- Read the matching doc in `dist/docs` before generating or editing framework-specific Prisma PHP code.
|
|
7
7
|
- When updating AI guidance in this repo, keep `AGENTS.md`, `.github/copilot-instructions.md`, and `dist/docs` aligned.
|
|
8
|
+
- Keep every `dist/docs/*.md` page AI-discoverable on its own: the frontmatter description and opening section should clearly say when agents should read that file and which adjacent docs to consult next.
|
|
8
9
|
|
|
9
10
|
## Route File Conventions
|
|
10
11
|
|
|
@@ -22,15 +23,20 @@
|
|
|
22
23
|
## Relevant Docs
|
|
23
24
|
|
|
24
25
|
- Project structure and feature placement: `dist/docs/project-structure.md`
|
|
26
|
+
- CLI project creation and update commands: `dist/docs/commands.md`
|
|
27
|
+
- Backend-only API usage and `backendOnly`: `dist/docs/backend-only.md`
|
|
25
28
|
- Route and layout structure: `dist/docs/layouts-and-pages.md`
|
|
29
|
+
- AI integration, provider-backed chat, streaming, and MCP boundary: `dist/docs/get-started-ia.md`
|
|
26
30
|
- Data loading, `#[Exposed]`, and SSE streaming: `dist/docs/fetching-data.md`
|
|
27
31
|
- PulsePoint runtime rules: `dist/docs/pulsepoint.md`
|
|
28
32
|
- Component and `ImportComponent` rules: `dist/docs/components.md`
|
|
29
33
|
- Validation rules: `dist/docs/validator.md`
|
|
34
|
+
- Environment variables and `PP\Env` usage: `dist/docs/env.md`
|
|
30
35
|
- File uploads and file manager behavior: `dist/docs/file-manager.md`
|
|
31
36
|
- Email and SMTP workflows: `dist/docs/email.md`
|
|
32
37
|
- WebSocket and realtime behavior: `dist/docs/websocket.md`
|
|
33
38
|
- MCP server and tool rules: `dist/docs/mcp.md`
|
|
34
39
|
- Authentication: `dist/docs/authentication.md`
|
|
35
40
|
- Metadata and icons: `dist/docs/metadata-and-og-images.md`
|
|
36
|
-
- API-style handlers and webhooks: `dist/docs/route-handlers.md`
|
|
41
|
+
- API-style handlers and webhooks: `dist/docs/route-handlers.md`
|
|
42
|
+
- Swagger/OpenAPI generation and `swaggerDocs`: `dist/docs/swagger-docs.md`
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Backend-only API usage
|
|
3
|
+
nav_title: Backend-only APIs
|
|
4
|
+
description: Learn how Prisma PHP backend-only apps work so AI agents can choose route.php-first API patterns, connect separate clients safely, and keep backendOnly workflows aligned with the framework.
|
|
5
|
+
related:
|
|
6
|
+
title: API Reference
|
|
7
|
+
description: Read the official Prisma PHP API and Swagger docs alongside the local backend-only guidance.
|
|
8
|
+
links:
|
|
9
|
+
- /docs/api-get-started
|
|
10
|
+
- /docs/route-php
|
|
11
|
+
- /docs/php-validator
|
|
12
|
+
- /docs/swagger-docs-api
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Backend-only Prisma PHP
|
|
16
|
+
|
|
17
|
+
Prisma PHP can run as a backend-only application when the project is intended to serve JSON endpoints, webhooks, mobile clients, or a separate frontend instead of rendering route UI with `index.php`.
|
|
18
|
+
|
|
19
|
+
In that mode, the main project-level flag is `backendOnly` in `prisma-php.json`.
|
|
20
|
+
|
|
21
|
+
If a task involves API-first Prisma PHP usage, separate frontend consumers, CORS, webhooks, or machine-facing endpoints, AI agents should read this page first and keep the implementation aligned with the installed Prisma PHP version.
|
|
22
|
+
|
|
23
|
+
## AI rule: read the backend-only docs first
|
|
24
|
+
|
|
25
|
+
Before generating backend-only Prisma PHP code, use this order:
|
|
26
|
+
|
|
27
|
+
1. Read `prisma-php.json`.
|
|
28
|
+
2. Confirm that `backendOnly` is enabled or that the user explicitly wants API-first behavior.
|
|
29
|
+
3. Read this `backend-only.md` page.
|
|
30
|
+
4. Use `route-handlers.md`, `validator.md`, and `swagger-docs.md` for handler, validation, and contract workflow details.
|
|
31
|
+
5. Inspect the current route tree before inventing extra API structure.
|
|
32
|
+
|
|
33
|
+
```json filename="prisma-php.json"
|
|
34
|
+
{
|
|
35
|
+
"backendOnly": true,
|
|
36
|
+
"swaggerDocs": true
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
When `backendOnly` is `true`, the routing mental model changes:
|
|
41
|
+
|
|
42
|
+
- use `route.php` as the default route entry for normal application behavior
|
|
43
|
+
- treat `src/app/route.php` as the root handler for `/`
|
|
44
|
+
- create nested folders under `src/app` and place `route.php` inside them for additional endpoints
|
|
45
|
+
- do not default to `index.php` unless the project is intentionally mixing in rendered UI
|
|
46
|
+
|
|
47
|
+
This is different from the normal full-stack Prisma PHP flow, where route UI lives in `index.php` and PulsePoint usually drives interactivity.
|
|
48
|
+
|
|
49
|
+
## When backend-only is the right fit
|
|
50
|
+
|
|
51
|
+
Backend-only Prisma PHP is the better fit when you want:
|
|
52
|
+
|
|
53
|
+
- a separate frontend such as React, Vue, Angular, Flutter, or a mobile app
|
|
54
|
+
- API-first development where routes return JSON instead of HTML
|
|
55
|
+
- webhook handlers, service-to-service endpoints, or integration APIs
|
|
56
|
+
- OpenAPI-driven client generation for external consumers
|
|
57
|
+
|
|
58
|
+
If the project is primarily a rendered Prisma PHP app with route-local interactivity, prefer the full-stack `index.php` plus PulsePoint model instead.
|
|
59
|
+
|
|
60
|
+
## Route structure
|
|
61
|
+
|
|
62
|
+
Backend-only projects still use Prisma PHP's file-system routing under `src/app`.
|
|
63
|
+
|
|
64
|
+
Typical shapes look like this:
|
|
65
|
+
|
|
66
|
+
```txt
|
|
67
|
+
src/
|
|
68
|
+
app/
|
|
69
|
+
route.php
|
|
70
|
+
products/
|
|
71
|
+
route.php
|
|
72
|
+
users/
|
|
73
|
+
route.php
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
That creates handler-style routes such as:
|
|
77
|
+
|
|
78
|
+
- `/`
|
|
79
|
+
- `/products`
|
|
80
|
+
- `/users`
|
|
81
|
+
|
|
82
|
+
Use nested folders when the URL needs nested segments. Do not create routes by editing `files-list.json`; Prisma PHP manages route metadata automatically.
|
|
83
|
+
|
|
84
|
+
## Basic route handler pattern
|
|
85
|
+
|
|
86
|
+
For backend-only apps, the default route file should stay explicit and small:
|
|
87
|
+
|
|
88
|
+
1. guard the HTTP method
|
|
89
|
+
2. read values from `Request::$params`
|
|
90
|
+
3. sanitize and validate input with `PP\Validator`
|
|
91
|
+
4. query Prisma or run server logic
|
|
92
|
+
5. return JSON with `echo json_encode(...)`
|
|
93
|
+
|
|
94
|
+
```php filename="src/app/products/route.php"
|
|
95
|
+
<?php
|
|
96
|
+
|
|
97
|
+
use Lib\Prisma\Classes\Prisma;
|
|
98
|
+
use PP\Header\Boom;
|
|
99
|
+
use PP\Request;
|
|
100
|
+
|
|
101
|
+
if (!Request::$isGet) {
|
|
102
|
+
Boom::methodNotAllowed()->toResponse();
|
|
103
|
+
exit;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
$prisma = Prisma::getInstance();
|
|
107
|
+
|
|
108
|
+
$products = $prisma->product->findMany();
|
|
109
|
+
|
|
110
|
+
echo json_encode($products);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
For validation-heavy handlers, use `validator.md` together with `route-handlers.md`.
|
|
114
|
+
|
|
115
|
+
## Request data in backend-only routes
|
|
116
|
+
|
|
117
|
+
Prisma PHP exposes unified request data through `Request::$params`, so you do not need to manually switch between `$_GET`, `$_POST`, and JSON body parsing for ordinary handler work.
|
|
118
|
+
|
|
119
|
+
```php filename="src/app/products/search/route.php"
|
|
120
|
+
<?php
|
|
121
|
+
|
|
122
|
+
use Lib\Prisma\Classes\Prisma;
|
|
123
|
+
use PP\Request;
|
|
124
|
+
use PP\Validator;
|
|
125
|
+
|
|
126
|
+
$prisma = Prisma::getInstance();
|
|
127
|
+
|
|
128
|
+
$productName = Validator::string(Request::$params['productName'] ?? '');
|
|
129
|
+
|
|
130
|
+
$products = $prisma->product->findMany([
|
|
131
|
+
'where' => [
|
|
132
|
+
'name' => [
|
|
133
|
+
'contains' => $productName,
|
|
134
|
+
],
|
|
135
|
+
],
|
|
136
|
+
]);
|
|
137
|
+
|
|
138
|
+
echo json_encode($products);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
For expected input failures, prefer structured JSON error payloads or `Boom` responses instead of uncaught exceptions.
|
|
142
|
+
|
|
143
|
+
## CORS for separate frontends
|
|
144
|
+
|
|
145
|
+
If a separate frontend will call the API directly, configure CORS in `.env`.
|
|
146
|
+
|
|
147
|
+
Typical settings include:
|
|
148
|
+
|
|
149
|
+
```env
|
|
150
|
+
CORS_ALLOWED_ORIGINS=[]
|
|
151
|
+
CORS_ALLOW_CREDENTIALS="true"
|
|
152
|
+
CORS_ALLOWED_METHODS="GET,POST,PUT,PATCH,DELETE,OPTIONS"
|
|
153
|
+
CORS_ALLOWED_HEADERS="Content-Type,Authorization,X-Requested-With"
|
|
154
|
+
CORS_EXPOSE_HEADERS=""
|
|
155
|
+
CORS_MAX_AGE="86400"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
If you are using a local frontend such as Vite, add that frontend URL to `CORS_ALLOWED_ORIGINS`.
|
|
159
|
+
|
|
160
|
+
## OpenAPI and Swagger in backend-only projects
|
|
161
|
+
|
|
162
|
+
If the project also enables Swagger docs, Prisma PHP can generate an OpenAPI 3 document that external clients can consume.
|
|
163
|
+
|
|
164
|
+
The generated JSON lives at:
|
|
165
|
+
|
|
166
|
+
```txt
|
|
167
|
+
./src/app/swagger-docs/apis/pphp-swagger.json
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
This makes backend-only Prisma PHP projects easier to connect to:
|
|
171
|
+
|
|
172
|
+
- React or TypeScript clients
|
|
173
|
+
- Angular or Vue applications
|
|
174
|
+
- mobile SDK generation workflows
|
|
175
|
+
- language-specific OpenAPI generators
|
|
176
|
+
|
|
177
|
+
For the generation workflow itself, read `swagger-docs.md`.
|
|
178
|
+
|
|
179
|
+
## Example frontend client workflow
|
|
180
|
+
|
|
181
|
+
One practical backend-only pattern is to generate a client from the Swagger JSON and validate responses in the consuming app.
|
|
182
|
+
|
|
183
|
+
For example, a TypeScript client can use tools such as `openapi-zod-client`, `openapi-typescript`, `orval`, or other OpenAPI generators.
|
|
184
|
+
|
|
185
|
+
```bash package="npm"
|
|
186
|
+
npm i -D openapi-zod-client
|
|
187
|
+
npx openapi-zod-client --input http://localhost:3000/swagger-docs/apis/pphp-swagger.json --output ./client/src/api/pphp.ts
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
The important idea is that Prisma PHP becomes the API backend, while the consuming frontend treats the generated OpenAPI document as the contract.
|
|
191
|
+
|
|
192
|
+
## Decision guide
|
|
193
|
+
|
|
194
|
+
Use this page when the task is about:
|
|
195
|
+
|
|
196
|
+
- `backendOnly` in `prisma-php.json`
|
|
197
|
+
- API-first Prisma PHP apps
|
|
198
|
+
- separate frontend consumption
|
|
199
|
+
- CORS for external clients
|
|
200
|
+
- choosing `route.php` as the default route file in the project
|
|
201
|
+
|
|
202
|
+
Use `route-handlers.md` when the task is specifically about request handling behavior inside a handler.
|
|
203
|
+
|
|
204
|
+
Use `swagger-docs.md` when the task is specifically about generating or customizing the OpenAPI document.
|
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Commands
|
|
3
|
+
description: Learn the core Prisma PHP CLI commands so AI agents can choose the right create, update, and non-interactive project workflows.
|
|
4
|
+
related:
|
|
5
|
+
title: Related docs
|
|
6
|
+
description: Use installation for first-time setup and upgrading for feature refreshes on existing apps.
|
|
7
|
+
links:
|
|
8
|
+
- /docs/installation
|
|
9
|
+
- /docs/upgrading
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
This guide explains what each Prisma PHP CLI command does, when to use it, and how the create and update workflows fit together.
|
|
13
|
+
|
|
14
|
+
If a task involves CLI project creation, starter kits, feature flags, or refreshing an existing Prisma PHP app, AI agents should read this page first and keep project creation separate from existing-project updates.
|
|
15
|
+
|
|
16
|
+
## AI rule: read the commands docs first
|
|
17
|
+
|
|
18
|
+
Before generating Prisma PHP CLI commands, use this order:
|
|
19
|
+
|
|
20
|
+
1. Decide whether the task is for a brand-new app or an existing project.
|
|
21
|
+
2. Use `create-prisma-php-app` only for new projects.
|
|
22
|
+
3. Use `npx pp update project` only for existing projects that already have `prisma-php.json`.
|
|
23
|
+
4. For AI-driven or scripted workflows, prefer the documented non-interactive `-y` flag.
|
|
24
|
+
5. Read `prisma-php-orm.md` before suggesting ORM migration or generation commands.
|
|
25
|
+
|
|
26
|
+
## Main idea
|
|
27
|
+
|
|
28
|
+
Prisma PHP has two main command groups:
|
|
29
|
+
|
|
30
|
+
- `create-prisma-php-app` creates a new project
|
|
31
|
+
- `pp update project` refreshes an existing project from the saved `prisma-php.json` configuration
|
|
32
|
+
|
|
33
|
+
Use `create` when you are starting a new project.
|
|
34
|
+
|
|
35
|
+
Use `update` when the project already exists and you want to re-apply the saved project configuration, enable newly saved features, or refresh framework-managed files.
|
|
36
|
+
|
|
37
|
+
## Command reference
|
|
38
|
+
|
|
39
|
+
### Create a new project
|
|
40
|
+
|
|
41
|
+
```bash package="npm"
|
|
42
|
+
npx create-prisma-php-app@<version> <project-name> [feature flags] [-y]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If you omit `@<version>`, `npx` uses the default published package resolution.
|
|
46
|
+
|
|
47
|
+
### Update an existing project
|
|
48
|
+
|
|
49
|
+
```bash package="npm"
|
|
50
|
+
npx pp update project [@version-or-tag] [-y]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Run this inside an existing Prisma PHP project that already has `prisma-php.json`.
|
|
54
|
+
|
|
55
|
+
## Create project command
|
|
56
|
+
|
|
57
|
+
### `npx create-prisma-php-app <project-name>`
|
|
58
|
+
|
|
59
|
+
This is the main Prisma PHP project generator.
|
|
60
|
+
|
|
61
|
+
It creates a new project, installs the selected feature set, writes the initial configuration, creates the folder structure, and prepares the app for local development.
|
|
62
|
+
|
|
63
|
+
During project creation, the selected feature flags are written into `prisma-php.json`. Those saved values are what later allow `npx pp update project` to refresh the project without re-entering every option manually.
|
|
64
|
+
|
|
65
|
+
### Use this when
|
|
66
|
+
|
|
67
|
+
- creating a brand-new Prisma PHP project
|
|
68
|
+
- starting from a starter kit
|
|
69
|
+
- scaffolding a project with selected features already enabled
|
|
70
|
+
- automating project creation in scripts or CI
|
|
71
|
+
|
|
72
|
+
### Basic examples
|
|
73
|
+
|
|
74
|
+
```bash package="npm"
|
|
75
|
+
npx create-prisma-php-app my-app
|
|
76
|
+
npx create-prisma-php-app my-app -y
|
|
77
|
+
npx create-prisma-php-app my-app --backend-only --prisma --swagger-docs
|
|
78
|
+
npx create-prisma-php-app my-app --tailwindcss --typescript --prisma
|
|
79
|
+
npx create-prisma-php-app my-app --tailwindcss --typescript --websocket --mcp --prisma --swagger-docs
|
|
80
|
+
npx create-prisma-php-app my-app --starter-kit=basic
|
|
81
|
+
npx create-prisma-php-app my-app --starter-kit=fullstack --typescript -y
|
|
82
|
+
npx create-prisma-php-app my-app --starter-kit=custom --starter-kit-source=https://github.com/user/repo --prisma --tailwindcss
|
|
83
|
+
npx create-prisma-php-app --list-starter-kits
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Non-interactive mode
|
|
87
|
+
|
|
88
|
+
### `-y`
|
|
89
|
+
|
|
90
|
+
This flag enables non-interactive mode.
|
|
91
|
+
|
|
92
|
+
Instead of stopping for terminal prompts, the CLI proceeds with the provided flags and default values.
|
|
93
|
+
|
|
94
|
+
### Use this when
|
|
95
|
+
|
|
96
|
+
- running automation or CI
|
|
97
|
+
- scaffolding quickly without prompts
|
|
98
|
+
- generating predictable output from scripts
|
|
99
|
+
|
|
100
|
+
### Example
|
|
101
|
+
|
|
102
|
+
```bash package="npm"
|
|
103
|
+
npx create-prisma-php-app my-app -y
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Create command feature flags
|
|
107
|
+
|
|
108
|
+
### `--backend-only`
|
|
109
|
+
|
|
110
|
+
Creates a backend-only project.
|
|
111
|
+
|
|
112
|
+
This is appropriate for API-first or server-only applications where the project should center on handler-style routes instead of the usual full-stack page flow.
|
|
113
|
+
|
|
114
|
+
### Use this when
|
|
115
|
+
|
|
116
|
+
- building REST APIs
|
|
117
|
+
- creating server-only services
|
|
118
|
+
- building a backend for a separate frontend client
|
|
119
|
+
|
|
120
|
+
### Example
|
|
121
|
+
|
|
122
|
+
```bash package="npm"
|
|
123
|
+
npx create-prisma-php-app my-app --backend-only
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `--swagger-docs`
|
|
127
|
+
|
|
128
|
+
Enables Swagger and OpenAPI documentation support.
|
|
129
|
+
|
|
130
|
+
This prepares the project for API schema generation and API documentation workflows.
|
|
131
|
+
|
|
132
|
+
### Use this when
|
|
133
|
+
|
|
134
|
+
- documenting API endpoints
|
|
135
|
+
- sharing API contracts with frontend or third-party consumers
|
|
136
|
+
- generating OpenAPI-based tooling from the project
|
|
137
|
+
|
|
138
|
+
### Example
|
|
139
|
+
|
|
140
|
+
```bash package="npm"
|
|
141
|
+
npx create-prisma-php-app my-app --backend-only --swagger-docs
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### `--tailwindcss`
|
|
145
|
+
|
|
146
|
+
Enables Tailwind CSS support.
|
|
147
|
+
|
|
148
|
+
This prepares frontend styling with Tailwind-related files and scripts.
|
|
149
|
+
|
|
150
|
+
### Use this when
|
|
151
|
+
|
|
152
|
+
- building dashboards or admin panels
|
|
153
|
+
- creating a styled full-stack UI
|
|
154
|
+
- starting a project that should use utility-first CSS from day one
|
|
155
|
+
|
|
156
|
+
### Example
|
|
157
|
+
|
|
158
|
+
```bash package="npm"
|
|
159
|
+
npx create-prisma-php-app my-app --tailwindcss
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### `--typescript`
|
|
163
|
+
|
|
164
|
+
Enables TypeScript support for the frontend toolchain.
|
|
165
|
+
|
|
166
|
+
### Use this when
|
|
167
|
+
|
|
168
|
+
- you want typed frontend code
|
|
169
|
+
- you want stronger editor tooling for frontend work
|
|
170
|
+
- your project will include frontend TypeScript assets
|
|
171
|
+
|
|
172
|
+
### Example
|
|
173
|
+
|
|
174
|
+
```bash package="npm"
|
|
175
|
+
npx create-prisma-php-app my-app --typescript
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### `--websocket`
|
|
179
|
+
|
|
180
|
+
Enables WebSocket support.
|
|
181
|
+
|
|
182
|
+
This prepares the project for real-time server and client workflows.
|
|
183
|
+
|
|
184
|
+
### Use this when
|
|
185
|
+
|
|
186
|
+
- building chat systems
|
|
187
|
+
- creating live dashboards
|
|
188
|
+
- sending notifications or push-style realtime updates
|
|
189
|
+
|
|
190
|
+
### Example
|
|
191
|
+
|
|
192
|
+
```bash package="npm"
|
|
193
|
+
npx create-prisma-php-app my-app --websocket
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### `--mcp`
|
|
197
|
+
|
|
198
|
+
Enables MCP support.
|
|
199
|
+
|
|
200
|
+
This prepares the project for Model Context Protocol server and tool workflows.
|
|
201
|
+
|
|
202
|
+
### Use this when
|
|
203
|
+
|
|
204
|
+
- integrating AI tooling
|
|
205
|
+
- exposing tools through MCP
|
|
206
|
+
- building model-connected workflows
|
|
207
|
+
|
|
208
|
+
### Example
|
|
209
|
+
|
|
210
|
+
```bash package="npm"
|
|
211
|
+
npx create-prisma-php-app my-app --mcp
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### `--prisma`
|
|
215
|
+
|
|
216
|
+
Enables Prisma ORM support.
|
|
217
|
+
|
|
218
|
+
This prepares the project for database-backed development and ORM generation workflows.
|
|
219
|
+
|
|
220
|
+
### Use this when
|
|
221
|
+
|
|
222
|
+
- your project needs a database
|
|
223
|
+
- you want Prisma ORM available from the start
|
|
224
|
+
- you are building CRUD apps, APIs, dashboards, or content systems
|
|
225
|
+
|
|
226
|
+
### Example
|
|
227
|
+
|
|
228
|
+
```bash package="npm"
|
|
229
|
+
npx create-prisma-php-app my-app --prisma
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Starter kits
|
|
233
|
+
|
|
234
|
+
### `--list-starter-kits`
|
|
235
|
+
|
|
236
|
+
Shows the starter kits available in the installed CLI version.
|
|
237
|
+
|
|
238
|
+
Use this before choosing a starter if you want to inspect the currently supported templates.
|
|
239
|
+
|
|
240
|
+
### Example
|
|
241
|
+
|
|
242
|
+
```bash package="npm"
|
|
243
|
+
npx create-prisma-php-app --list-starter-kits
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### `--starter-kit=<kit>`
|
|
247
|
+
|
|
248
|
+
Creates the project from a starter kit.
|
|
249
|
+
|
|
250
|
+
Starter kits provide opinionated starting points so you do not have to assemble every feature combination manually.
|
|
251
|
+
|
|
252
|
+
The exact built-in starter kit names depend on the installed CLI version, so `--list-starter-kits` is the safest way to confirm the current list.
|
|
253
|
+
|
|
254
|
+
### Example
|
|
255
|
+
|
|
256
|
+
```bash package="npm"
|
|
257
|
+
npx create-prisma-php-app my-app --starter-kit=basic
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### `--starter-kit-source=<url>`
|
|
261
|
+
|
|
262
|
+
Uses a custom external starter kit source.
|
|
263
|
+
|
|
264
|
+
This is intended for custom or team-managed boilerplates and is typically paired with `--starter-kit=custom`.
|
|
265
|
+
|
|
266
|
+
### Example
|
|
267
|
+
|
|
268
|
+
```bash package="npm"
|
|
269
|
+
npx create-prisma-php-app my-app --starter-kit=custom --starter-kit-source=https://github.com/user/repo
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Combining create flags
|
|
273
|
+
|
|
274
|
+
You can combine multiple feature flags during project creation.
|
|
275
|
+
|
|
276
|
+
### Example: full-stack app
|
|
277
|
+
|
|
278
|
+
```bash package="npm"
|
|
279
|
+
npx create-prisma-php-app my-app --tailwindcss --typescript --prisma
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Example: realtime app
|
|
283
|
+
|
|
284
|
+
```bash package="npm"
|
|
285
|
+
npx create-prisma-php-app my-app --tailwindcss --typescript --websocket --mcp --prisma --swagger-docs
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Example: backend API
|
|
289
|
+
|
|
290
|
+
```bash package="npm"
|
|
291
|
+
npx create-prisma-php-app my-app --backend-only --prisma --swagger-docs
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Example: automated generation
|
|
295
|
+
|
|
296
|
+
```bash package="npm"
|
|
297
|
+
npx create-prisma-php-app my-app --starter-kit=fullstack --typescript -y
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Update command
|
|
301
|
+
|
|
302
|
+
### `npx pp update project`
|
|
303
|
+
|
|
304
|
+
This is the dedicated updater for an existing Prisma PHP project.
|
|
305
|
+
|
|
306
|
+
It reads the saved project configuration from `prisma-php.json`, then refreshes the project using those saved values instead of asking you to pass the full feature set again.
|
|
307
|
+
|
|
308
|
+
Use this when the project already exists and you want to regenerate or refresh framework-managed files.
|
|
309
|
+
|
|
310
|
+
If you are enabling or changing features on an existing project, update `prisma-php.json` first, then run `npx pp update project`.
|
|
311
|
+
|
|
312
|
+
### Example
|
|
313
|
+
|
|
314
|
+
```bash package="npm"
|
|
315
|
+
npx pp update project
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### `npx pp update project @latest`
|
|
319
|
+
|
|
320
|
+
Refreshes the current project using the latest published version of `create-prisma-php-app`.
|
|
321
|
+
|
|
322
|
+
### Example
|
|
323
|
+
|
|
324
|
+
```bash package="npm"
|
|
325
|
+
npx pp update project @latest
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### `npx pp update project @v5-alpha`
|
|
329
|
+
|
|
330
|
+
Refreshes the project using a tagged prerelease such as an alpha build.
|
|
331
|
+
|
|
332
|
+
### Use this when
|
|
333
|
+
|
|
334
|
+
- testing prerelease framework changes
|
|
335
|
+
- validating upcoming CLI behavior
|
|
336
|
+
- trying an experimental version on an existing project
|
|
337
|
+
|
|
338
|
+
### Example
|
|
339
|
+
|
|
340
|
+
```bash package="npm"
|
|
341
|
+
npx pp update project @v5-alpha
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### `npx pp update project @1.2.3`
|
|
345
|
+
|
|
346
|
+
Refreshes the project using a fixed package version.
|
|
347
|
+
|
|
348
|
+
### Use this when
|
|
349
|
+
|
|
350
|
+
- you need reproducible updates
|
|
351
|
+
- you want to stay on a known working version
|
|
352
|
+
- you want strict version control over generator behavior
|
|
353
|
+
|
|
354
|
+
### Example
|
|
355
|
+
|
|
356
|
+
```bash package="npm"
|
|
357
|
+
npx pp update project @1.2.3
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### `npx pp update project -y`
|
|
361
|
+
|
|
362
|
+
Runs the update in non-interactive mode.
|
|
363
|
+
|
|
364
|
+
This skips the confirmation prompt and proceeds directly.
|
|
365
|
+
|
|
366
|
+
### Use this when
|
|
367
|
+
|
|
368
|
+
- running scripted updates
|
|
369
|
+
- using CI or automation
|
|
370
|
+
- updating from AI-driven workflows
|
|
371
|
+
|
|
372
|
+
### Example
|
|
373
|
+
|
|
374
|
+
```bash package="npm"
|
|
375
|
+
npx pp update project -y
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Combined update examples
|
|
379
|
+
|
|
380
|
+
```bash package="npm"
|
|
381
|
+
npx pp update project
|
|
382
|
+
npx pp update project -y
|
|
383
|
+
npx pp update project @latest
|
|
384
|
+
npx pp update project @v5-alpha
|
|
385
|
+
npx pp update project @1.2.3
|
|
386
|
+
npx pp update project @latest -y
|
|
387
|
+
npx pp update project @v5-alpha -y
|
|
388
|
+
npx pp update project @1.2.3 -y
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
## Important update clarification
|
|
392
|
+
|
|
393
|
+
`npx pp update project` is a project scaffolding and refresh command.
|
|
394
|
+
|
|
395
|
+
It is not a substitute for Prisma ORM schema migration commands.
|
|
396
|
+
|
|
397
|
+
If your database schema changed, use the Prisma ORM workflow documented in `prisma-php-orm.md` and `upgrading.md`.
|
|
398
|
+
|
|
399
|
+
## Recommended mental model
|
|
400
|
+
|
|
401
|
+
### Use create when
|
|
402
|
+
|
|
403
|
+
- starting a new project
|
|
404
|
+
- selecting a starter kit for the first time
|
|
405
|
+
- choosing feature flags for initial scaffolding
|
|
406
|
+
- generating a project structure from scratch
|
|
407
|
+
|
|
408
|
+
### Use update when
|
|
409
|
+
|
|
410
|
+
- the project already has `prisma-php.json`
|
|
411
|
+
- you want to refresh default project files
|
|
412
|
+
- you want to keep the saved feature set
|
|
413
|
+
- you want to move the project to a newer or pinned generator version
|
|
414
|
+
|
|
415
|
+
## Quick summary table
|
|
416
|
+
|
|
417
|
+
| Command | What it does | Best use case |
|
|
418
|
+
| ------------------------------------- | ------------------------------------- | --------------------------------------- |
|
|
419
|
+
| `npx create-prisma-php-app my-app` | Creates a new project | Starting fresh |
|
|
420
|
+
| `npx create-prisma-php-app my-app -y` | Creates a new project without prompts | Automation or CI |
|
|
421
|
+
| `--backend-only` | Creates a server-only setup | APIs or services |
|
|
422
|
+
| `--swagger-docs` | Enables API docs | Documented APIs |
|
|
423
|
+
| `--tailwindcss` | Enables Tailwind styling | UI projects |
|
|
424
|
+
| `--typescript` | Enables TypeScript support | Typed frontend work |
|
|
425
|
+
| `--websocket` | Enables realtime support | Chat or live updates |
|
|
426
|
+
| `--mcp` | Enables MCP support | AI or tool workflows |
|
|
427
|
+
| `--prisma` | Enables Prisma ORM support | Database-backed projects |
|
|
428
|
+
| `--list-starter-kits` | Lists starter templates | Inspect available starters |
|
|
429
|
+
| `--starter-kit=<kit>` | Creates a project from a starter kit | Opinionated bootstrapping |
|
|
430
|
+
| `--starter-kit-source=<url>` | Uses a custom external starter kit | Team or company boilerplates |
|
|
431
|
+
| `npx pp update project` | Refreshes an existing project | Existing Prisma PHP apps |
|
|
432
|
+
| `npx pp update project @latest` | Uses the latest generator version | Upgrade to the newest published version |
|
|
433
|
+
| `npx pp update project @v5-alpha` | Uses a prerelease tag | Testing alpha behavior |
|
|
434
|
+
| `npx pp update project @1.2.3` | Uses a fixed version | Reproducible updates |
|
|
435
|
+
| `npx pp update project -y` | Updates without prompts | Automation or CI |
|
|
436
|
+
|
|
437
|
+
## Final recommendation
|
|
438
|
+
|
|
439
|
+
For most users, start with:
|
|
440
|
+
|
|
441
|
+
```bash package="npm"
|
|
442
|
+
npx create-prisma-php-app my-app
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
Then add only the flags you actually need.
|
|
446
|
+
|
|
447
|
+
Later, use:
|
|
448
|
+
|
|
449
|
+
```bash package="npm"
|
|
450
|
+
npx pp update project
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
when you want to refresh an existing project with its saved Prisma PHP configuration.
|