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/dist/docs/mcp.md CHANGED
@@ -5,6 +5,7 @@ related:
5
5
  title: Related docs
6
6
  description: Read the official Prisma PHP MCP docs before generating or editing MCP server code.
7
7
  links:
8
+ - /docs/env
8
9
  - /docs/prisma-php-ai-mcp
9
10
  - /docs/ai-tools
10
11
  - /docs/project-structure
@@ -33,6 +34,7 @@ Do not assume another framework's agent or tool abstractions apply directly.
33
34
  ## Read this doc when you need
34
35
 
35
36
  - **MCP server bootstrap, `PhpMcp\Server\Server`, `StreamableHttpServerTransport`, `MCP_HOST`, `MCP_PORT`, or endpoint URL construction** -> official `prisma-php-ai-mcp`
37
+ - **typed environment access for `MCP_*` values or `.env` loading boundaries** -> `env.md` plus `mcp.md`
36
38
  - **authoring tool classes with `#[McpTool]` and typed input validation with `#[Schema]`** -> official `ai-tools` plus `mcp.md`
37
39
  - **where MCP files belong in a Prisma PHP project** -> `project-structure.md` plus `mcp.md`
38
40
  - **feature flags and scaffolding for MCP support** -> `upgrading.md` plus `mcp.md`
@@ -46,7 +48,7 @@ Prisma PHP documents MCP around a dedicated PHP server entry point that auto-dis
46
48
  That means AI should preserve this model by default:
47
49
 
48
50
  - a PHP server built with `PhpMcp\Server\Server`
49
- - server metadata from environment variables
51
+ - server metadata from environment variables resolved through `PP\Env`
50
52
  - attribute-based discovery of tool classes annotated with `#[McpTool]`
51
53
  - `StreamableHttpServerTransport` for the HTTP endpoint
52
54
  - domain-specific tool classes under `src/Lib/MCP`
@@ -114,6 +116,7 @@ AI should preserve these settings:
114
116
  Behavior notes:
115
117
 
116
118
  - `.env` loading is optional and happens from `DOCUMENT_PATH/.env`
119
+ - typed runtime reads happen through `PP\Env`, whose implementation lives in `vendor/tsnc/prisma-php/src/Env.php`
117
120
  - the path prefix is trimmed with `trim(..., '/')`, so the effective route becomes `/<prefix>`
118
121
  - the final endpoint URL resolves to `http://{host}:{port}/{prefix}`
119
122
  - enabling `MCP_JSON_RESPONSE` can help with browser-based debugging and the Inspector
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Metadata and Icons
3
- description: Learn how to manage page metadata and application icons in Prisma PHP.
3
+ description: Learn how AI agents should manage page metadata and application icons in Prisma PHP with `MainLayout` and the documented icon file conventions.
4
4
  related:
5
5
  title: API Reference
6
6
  description: Learn more about metadata and icon file conventions in Prisma PHP.
@@ -15,13 +15,25 @@ This page explains how to manage metadata in Prisma PHP and how icon file conven
15
15
 
16
16
  For better SEO, treat `MainLayout::$title` and `MainLayout::$description` as the primary way to set page metadata. A local `$title` variable only affects rendered page content unless you also assign the document metadata through `MainLayout`.
17
17
 
18
- Prisma PHP’s metadata system is centered on the `MainLayout` class rather than Next.js exports like `metadata`, `generateMetadata`, or generated `opengraph-image.tsx`. The provided Prisma PHP docs describe dynamic page metadata and icon file conventions, but they do **not** document a dedicated Next.js-style generated Open Graph image pipeline on these pages. citeturn0view0turn1view0
18
+ Prisma PHP’s metadata system is centered on the `MainLayout` class rather than Next.js exports like `metadata`, `generateMetadata`, or generated `opengraph-image.tsx`. The provided Prisma PHP docs describe dynamic page metadata and icon file conventions, but they do **not** document a dedicated Next.js-style generated Open Graph image pipeline on these pages.
19
+
20
+ If a task involves page titles, descriptions, custom meta tags, favicon files, icon files, or SEO metadata, AI agents should read this page first and keep metadata aligned with `MainLayout` and the documented icon conventions.
21
+
22
+ ## AI rule: read the metadata docs first
23
+
24
+ Before generating Prisma PHP metadata code, use this order:
25
+
26
+ 1. Use `MainLayout::$title` and `MainLayout::$description` for document metadata.
27
+ 2. Use `MainLayout::addCustomMetaData(...)` for extra meta tags.
28
+ 3. Keep visible headings separate from document metadata when the UI text needs to differ.
29
+ 4. Use the documented `favicon`, `icon`, and `apple-icon` file conventions instead of inventing generated metadata modules.
30
+ 5. Read `layouts-and-pages.md` when the task also changes route or layout structure.
19
31
 
20
32
  ## Metadata in Prisma PHP
21
33
 
22
34
  Prisma PHP lets you update metadata dynamically through the `MainLayout` class.
23
35
 
24
- The docs say this is used to manage head scripts, footer scripts, and custom metadata for each page. citeturn0view0
36
+ Prisma PHP uses this to manage head scripts, footer scripts, and custom metadata for each page.
25
37
 
26
38
  ### Basic metadata example
27
39
 
@@ -40,7 +52,7 @@ In this model:
40
52
 
41
53
  - `MainLayout::$title` sets the page title
42
54
  - `MainLayout::$description` sets the page description
43
- - `MainLayout::addCustomMetaData(...)` adds additional metadata such as `author` or other `<meta>` values citeturn0view0
55
+ - `MainLayout::addCustomMetaData(...)` adds additional metadata such as `author` or other `<meta>` values
44
56
 
45
57
  ## Heading text vs document metadata
46
58
 
@@ -84,11 +96,11 @@ MainLayout::$description = $productDescription;
84
96
  ?>
85
97
  ```
86
98
 
87
- This is the closest Prisma PHP equivalent to route-aware or dynamic metadata generation. citeturn0view0
99
+ This is the closest Prisma PHP equivalent to route-aware or dynamic metadata generation.
88
100
 
89
101
  ## Important placement rule
90
102
 
91
- The Prisma PHP docs explicitly note that metadata should be set **at the top of the PHP file before any HTML output** so it can render correctly inside the document `<head>`. citeturn0view0
103
+ The Prisma PHP docs explicitly note that metadata should be set **at the top of the PHP file before any HTML output** so it can render correctly inside the document `<head>`.
92
104
 
93
105
  That means this pattern is correct:
94
106
 
@@ -165,7 +177,7 @@ The docs also describe metadata-related layout hooks for scripts.
165
177
  You can inject scripts into the document head or footer with:
166
178
 
167
179
  - `MainLayout::addHeadScript(...)`
168
- - `MainLayout::addFooterScript(...)` citeturn0view0
180
+ - `MainLayout::addFooterScript(...)`
169
181
 
170
182
  Example:
171
183
 
@@ -189,7 +201,7 @@ The docs say that `favicon`, `icon`, and `apple-icon` files let you define icons
189
201
 
190
202
  - browser tabs
191
203
  - phone home screens
192
- - search engine results citeturn1view0
204
+ - search engine results
193
205
 
194
206
  ### Supported icon files
195
207
 
@@ -197,15 +209,15 @@ The provided Prisma PHP icon docs mention image-file based usage such as:
197
209
 
198
210
  - `.ico`
199
211
  - `.jpg`
200
- - `.png` citeturn1view0
212
+ - `.png`
201
213
 
202
214
  ### Where to place them
203
215
 
204
- The docs say to place a `favicon`, `icon`, or `apple-icon` file within your `/app` directory, and specifically state that the favicon image must be located at the **top level** of `/app`. citeturn1view0
216
+ The docs say to place a `favicon`, `icon`, or `apple-icon` file within your `/app` directory, and specifically state that the favicon image must be located at the **top level** of `/app`.
205
217
 
206
218
  ## `favicon.ico`
207
219
 
208
- For the favicon, the docs say to add a `favicon.ico` image file to the root `/app` route segment. They also note that the favicon link tag is already included in the `<head>` of `layout.php`, so the normal step is simply to replace the existing `favicon.ico` file with your own. citeturn1view0
220
+ For the favicon, the docs say to add a `favicon.ico` image file to the root `/app` route segment. They also note that the favicon link tag is already included in the `<head>` of `layout.php`, so the normal step is simply to replace the existing `favicon.ico` file with your own.
209
221
 
210
222
  The documented link tag is:
211
223
 
@@ -213,11 +225,11 @@ The documented link tag is:
213
225
  <link rel="icon" href="<?= Request::baseUrl?>/favicon.ico" type="image/x-icon" sizes="16x16">
214
226
  ```
215
227
 
216
- This means Prisma PHP already expects the favicon in the standard project location and wires it into the layout automatically. citeturn1view0
228
+ This means Prisma PHP already expects the favicon in the standard project location and wires it into the layout automatically.
217
229
 
218
230
  ## Automatic head integration
219
231
 
220
- The icon docs say Prisma PHP evaluates these icon files and **automatically adds the appropriate tags to your app’s `<head>` element**. citeturn1view0
232
+ The icon docs say Prisma PHP evaluates these icon files and **automatically adds the appropriate tags to your app’s `<head>` element**.
221
233
 
222
234
  That is the Prisma PHP equivalent of file-convention-based icon metadata.
223
235
 
@@ -257,24 +269,24 @@ If you are coming from Next.js, the closest mapping is:
257
269
  | file-based icon conventions | Prisma PHP `favicon`, `icon`, `apple-icon` file conventions |
258
270
  | generated OG image files | not documented on the provided Prisma PHP metadata pages |
259
271
 
260
- The main difference is that Prisma PHP’s documented system is **layout-class driven** for metadata and **file-convention driven** for icons, rather than based on exported metadata objects or generated route modules. citeturn0view0turn1view0
272
+ The main difference is that Prisma PHP’s documented system is **layout-class driven** for metadata and **file-convention driven** for icons, rather than based on exported metadata objects or generated route modules.
261
273
 
262
274
  ## About Open Graph images
263
275
 
264
276
  The Next.js page title includes OG images, but the provided Prisma PHP docs you linked focus on:
265
277
 
266
278
  - dynamic page metadata through `MainLayout`
267
- - icon file conventions such as `favicon`, `icon`, and `apple-icon` citeturn0view0turn1view0
279
+ - icon file conventions such as `favicon`, `icon`, and `apple-icon`
268
280
 
269
281
  Because those pages do not document a dedicated Prisma PHP Open Graph image generation system, this page does **not** invent one. If your framework later adds a specific OG image convention, that would belong here.
270
282
 
271
283
  ## Good to know
272
284
 
273
- - Prisma PHP uses `MainLayout` for dynamic metadata management. citeturn0view0
285
+ - Prisma PHP uses `MainLayout` for dynamic metadata management.
274
286
  - `MainLayout::$title` and `MainLayout::$description` are the main documented page metadata properties.
275
- - `MainLayout::addCustomMetaData(...)` adds custom metadata such as `author`. citeturn0view0
276
- - Metadata should be set before any HTML output. citeturn0view0
277
- - `MainLayout::addHeadScript(...)` and `MainLayout::addFooterScript(...)` can inject scripts into the page shell. citeturn0view0
278
- - Prisma PHP supports `favicon`, `icon`, and `apple-icon` file conventions. citeturn1view0
279
- - `favicon.ico` belongs at the top level of the app directory. citeturn1view0
280
- - Prisma PHP automatically adds the appropriate icon tags to the document head. citeturn1view0
287
+ - `MainLayout::addCustomMetaData(...)` adds custom metadata such as `author`.
288
+ - Metadata should be set before any HTML output.
289
+ - `MainLayout::addHeadScript(...)` and `MainLayout::addFooterScript(...)` can inject scripts into the page shell.
290
+ - Prisma PHP supports `favicon`, `icon`, and `apple-icon` file conventions.
291
+ - `favicon.ico` belongs at the top level of the app directory.
292
+ - Prisma PHP automatically adds the appropriate icon tags to the document head.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Prisma PHP ORM
3
- description: Learn how Prisma PHP ORM works, how to configure it, how to migrate your database, and how to generate the PHP ORM classes correctly.
3
+ description: Learn how Prisma PHP ORM works so AI agents can choose the correct configuration, migration, and PHP class generation workflow.
4
4
  related:
5
5
  title: Related docs
6
6
  description: Read the official Prisma PHP ORM docs before generating code or running ORM commands.
@@ -1,11 +1,21 @@
1
1
  ---
2
2
  title: Project structure and organization
3
3
  nav_title: Project Structure
4
- description: Learn the folder and file conventions in Prisma PHP, and how to organize your project.
5
- ---
4
+ description: Learn the folder and file conventions in Prisma PHP so AI agents can place features in the right files and folders.
6
5
 
7
6
  This page provides an overview of the folder and file conventions in **Prisma PHP**, and recommendations for organizing your project. It follows the Prisma PHP routing model and mirrors the mental model of a Next.js App Router style project structure, adapted to how Prisma PHP actually works.
8
7
 
8
+ If a task involves file placement, feature flags, route creation, or overall Prisma PHP app organization, AI agents should read this page first and use it as the directory-level source of truth before generating files.
9
+
10
+ ## AI rule: read the structure docs first
11
+
12
+ Before generating Prisma PHP files or folders, use this order:
13
+
14
+ 1. Read `prisma-php.json`.
15
+ 2. Decide whether the task belongs in `src/app`, `src/Lib`, `prisma`, `public`, or `settings`.
16
+ 3. Create routes from the route tree instead of editing `files-list.json`.
17
+ 4. Use `layouts-and-pages.md`, `route-handlers.md`, or `components.md` once the file location is known.
18
+
9
19
  ## Folder and file conventions
10
20
 
11
21
  ### Top-level folders
@@ -55,6 +65,10 @@ Typical values include:
55
65
 
56
66
  If an AI agent is working on the project, it should inspect `prisma-php.json` before deciding whether Tailwind CSS, TypeScript, Prisma ORM, Swagger docs, MCP, or websocket-related code should be generated.
57
67
 
68
+ For backend-only API projects, read `backend-only.md`.
69
+
70
+ For Swagger and OpenAPI generation, read `swagger-docs.md`.
71
+
58
72
  ### Full-stack vs backend-only routing decision
59
73
 
60
74
  One of the most important capability flags is `backendOnly`.
@@ -1,3 +1,8 @@
1
+ ---
2
+ title: PulsePoint Runtime Guide
3
+ description: Learn how AI agents should use the current PulsePoint runtime contract, component script rules, and supported directives in Prisma PHP.
4
+ ---
5
+
1
6
  # PulsePoint Runtime Guide
2
7
 
3
8
  ## Purpose
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Route Handlers
3
3
  nav_title: Route Handlers
4
- description: Learn how to use route handlers in Prisma PHP with `route.php`.
4
+ description: Learn how AI agents should use route handlers in Prisma PHP with `route.php` for API-style and no-view routes.
5
5
  related:
6
6
  title: API Reference
7
7
  description: Learn more about route handlers in Prisma PHP.
@@ -18,6 +18,18 @@ Route Handlers in Prisma PHP let you create custom request handlers for a given
18
18
 
19
19
  A `route.php` file bypasses the standard view rendering flow and acts as a direct entry point for a specific URL path. This makes it useful for APIs, form submissions, AJAX endpoints, JSON responses, and route-specific server logic.
20
20
 
21
+ If a task involves API-style endpoints, JSON responses, form-processing handlers, webhooks, or machine-facing routes, AI agents should read this page first and keep `route.php` separate from normal page routes.
22
+
23
+ ## AI rule: read the route-handler docs first
24
+
25
+ Before generating Prisma PHP `route.php` files, use this order:
26
+
27
+ 1. Read `prisma-php.json` and confirm whether the project is backend-only.
28
+ 2. Use `route.php` only for direct handler or no-view routes.
29
+ 3. Read from `Request::$params` and validate with `PP\Validator`.
30
+ 4. Return structured JSON or `Boom` responses for expected failures.
31
+ 5. Use `index.php` plus `pp.fetchFunction(...)` instead when the behavior belongs to a rendered page.
32
+
21
33
  ## `route.php` vs `index.php`
22
34
 
23
35
  Prisma PHP has a clear separation between page routes and direct handlers:
@@ -25,7 +37,7 @@ Prisma PHP has a clear separation between page routes and direct handlers:
25
37
  - `index.php` is the UI entry point for a route segment and should be used for rendered HTML routes.
26
38
  - `route.php` is the direct handler entry point for a route segment and should be used for API-style or no-view routes.
27
39
 
28
- The official `index.php` doc explicitly states that `index.php` is for rendering UI and that if you need to return JSON data, like an API, or handle form processing without a view, you should use `route.php` instead. The `route.php` doc describes it as bypassing standard view rendering to build APIs, handle form submissions, or manage complex logic. citeturn1view0turn0view0
40
+ The official `index.php` doc explicitly states that `index.php` is for rendering UI and that if you need to return JSON data, like an API, or handle form processing without a view, you should use `route.php` instead. The `route.php` doc describes it as bypassing standard view rendering to build APIs, handle form submissions, or manage complex logic.
29
41
 
30
42
  In practice, that leads to this rule:
31
43
 
@@ -35,6 +47,10 @@ In practice, that leads to this rule:
35
47
  - if the user asks for an API route, use `route.php`
36
48
  - if the user asks for a normal page route, use `index.php`
37
49
 
50
+ For project-level backend-only guidance, separate frontend consumption, and CORS setup, read `backend-only.md`.
51
+
52
+ For Prisma PHP OpenAPI generation and Swagger workflow details, read `swagger-docs.md`.
53
+
38
54
  For the provided project config:
39
55
 
40
56
  ```json
@@ -0,0 +1,189 @@
1
+ ---
2
+ title: Swagger docs for APIs
3
+ nav_title: Swagger Docs
4
+ description: Learn when Prisma PHP Swagger docs are worth enabling so AI agents can keep OpenAPI generation aligned with backendOnly and schema-driven workflows.
5
+ related:
6
+ title: API Reference
7
+ description: Read the official Swagger and API docs together with the local Prisma PHP guidance.
8
+ links:
9
+ - /docs/swagger-docs-api
10
+ - /docs/api-get-started
11
+ - /docs/route-php
12
+ - /docs/orm-get-started
13
+ ---
14
+
15
+ ## Swagger docs in Prisma PHP
16
+
17
+ Prisma PHP can generate Swagger-friendly OpenAPI documentation for API workflows.
18
+
19
+ This is most useful when the project exposes endpoints for:
20
+
21
+ - a separate frontend
22
+ - mobile clients
23
+ - public or partner APIs
24
+ - SDK generation
25
+ - API testing and contract review
26
+
27
+ If the application is mainly a server-rendered Prisma PHP app that uses PulsePoint and `pp.fetchFunction(...)` for route-local interactions, Swagger docs may not be necessary.
28
+
29
+ If a task involves OpenAPI generation, backend-only APIs, external client contracts, or schema-driven endpoint docs, AI agents should read this page first and keep the Swagger workflow aligned with `prisma-php.json`.
30
+
31
+ ## AI rule: read the Swagger docs first
32
+
33
+ Before enabling or regenerating Swagger docs, use this order:
34
+
35
+ 1. Inspect `prisma-php.json` for `swaggerDocs` and `backendOnly`.
36
+ 2. Read `backend-only.md`, `route-handlers.md`, and `prisma-php-orm.md` as needed for the surrounding API workflow.
37
+ 3. Use `npm run create-swagger-docs` for the documented generation flow.
38
+ 4. Inspect `settings/prisma-schema-config.json` before changing output paths or generation modes.
39
+ 5. Do not treat Swagger generation as a substitute for ORM migrations or route implementation.
40
+
41
+ ## When Swagger docs are worth enabling
42
+
43
+ Enable Swagger docs when you need a stable machine-readable contract for the API.
44
+
45
+ Typical reasons include:
46
+
47
+ - generating typed frontend clients
48
+ - sharing endpoint definitions with other teams
49
+ - reviewing request and response shapes outside the codebase
50
+ - keeping backend-only or API-heavy projects documented as they evolve
51
+
52
+ In Prisma PHP, the project-level feature flag is `swaggerDocs` in `prisma-php.json`.
53
+
54
+ ```json filename="prisma-php.json"
55
+ {
56
+ "backendOnly": true,
57
+ "swaggerDocs": true
58
+ }
59
+ ```
60
+
61
+ If you enable the flag in an existing application, follow the documented project update flow from `upgrading.md`.
62
+
63
+ ## Generated OpenAPI JSON
64
+
65
+ When Prisma PHP generates Swagger docs, the OpenAPI JSON file is created or updated at:
66
+
67
+ ```txt
68
+ src/app/swagger-docs/apis/pphp-swagger.json
69
+ ```
70
+
71
+ That JSON file is the handoff point for tools such as:
72
+
73
+ - Swagger UI
74
+ - OpenAPI Generator
75
+ - `openapi-zod-client`
76
+ - `openapi-typescript`
77
+ - `orval`
78
+
79
+ ## Generation command
80
+
81
+ Prisma PHP's Swagger workflow supports generating documentation for models from `schema.prisma`.
82
+
83
+ ```bash package="npm"
84
+ npm run create-swagger-docs
85
+ npm run create-swagger-docs Order
86
+ npm run create-swagger-docs Order User Client
87
+ ```
88
+
89
+ During generation, Prisma PHP prompts for three decisions:
90
+
91
+ - whether to generate Swagger docs only
92
+ - whether to generate endpoints
93
+ - whether to generate PHP classes
94
+
95
+ That makes the workflow flexible enough for:
96
+
97
+ - docs-only regeneration
98
+ - endpoint scaffolding together with docs
99
+ - PHP class generation when the project needs it
100
+
101
+ ## Configuration file
102
+
103
+ Swagger generation can be customized from:
104
+
105
+ ```txt
106
+ settings/prisma-schema-config.json
107
+ ```
108
+
109
+ Example configuration:
110
+
111
+ ```json filename="settings/prisma-schema-config.json"
112
+ {
113
+ "swaggerDocsDir": "src/app/swagger-docs/apis",
114
+ "skipDefaultName": ["autoincrement", "cuid", "uuid", "now"],
115
+ "skipByPropertyValue": {
116
+ "isUpdatedAt": true
117
+ },
118
+ "skipFields": [],
119
+ "generateSwaggerDocsOnly": false,
120
+ "generateEndpoints": true,
121
+ "generatePhpClasses": true
122
+ }
123
+ ```
124
+
125
+ This file is where the Prisma PHP Swagger workflow decides:
126
+
127
+ - where the JSON should be written
128
+ - which schema defaults should be omitted from docs output
129
+ - which fields should be skipped entirely
130
+ - whether generation should include only docs, endpoints, PHP classes, or a combination
131
+
132
+ ## Recommended workflow
133
+
134
+ For API-oriented Prisma PHP work, a practical Swagger workflow is:
135
+
136
+ 1. update `schema.prisma`
137
+ 2. run the normal ORM workflow when the schema changed
138
+ 3. regenerate Swagger docs
139
+ 4. inspect `src/app/swagger-docs/apis/pphp-swagger.json`
140
+ 5. regenerate external clients if the contract changed
141
+
142
+ This keeps the API description aligned with the current schema and route generation output.
143
+
144
+ ## Backend-only projects and Swagger
145
+
146
+ Swagger docs fit especially well with backend-only Prisma PHP projects because those apps usually center on `route.php` handlers and separate consumers.
147
+
148
+ The common pairing is:
149
+
150
+ - `backendOnly: true`
151
+ - `swaggerDocs: true`
152
+
153
+ That gives the project a clear API-first posture: handler routes in Prisma PHP, plus an OpenAPI file that frontend and external clients can consume.
154
+
155
+ Read `backend-only.md` when the task is primarily about route structure, CORS, or the default API project shape.
156
+
157
+ ## React and TypeScript client generation
158
+
159
+ One common use case is generating a typed client for a separate React or TypeScript application.
160
+
161
+ ```bash package="npm"
162
+ npm i -D openapi-zod-client
163
+ npx openapi-zod-client --input http://localhost:3000/swagger-docs/apis/pphp-swagger.json --output ./client/src/api/pphp.ts
164
+ ```
165
+
166
+ After generation, the consuming app can validate server responses against the generated schemas instead of relying on handwritten request types.
167
+
168
+ ## What Swagger does not replace
169
+
170
+ Swagger docs help describe the API contract, but they do not replace:
171
+
172
+ - request validation with `PP\Validator`
173
+ - route-level method guards
174
+ - ORM migration and client generation when `schema.prisma` changes
175
+ - CORS configuration when external frontends call the API directly
176
+
177
+ Keep those concerns aligned with `route-handlers.md`, `validator.md`, `prisma-php-orm.md`, and `backend-only.md`.
178
+
179
+ ## Decision guide
180
+
181
+ Use this page when the task is about:
182
+
183
+ - `swaggerDocs` in `prisma-php.json`
184
+ - `pphp-swagger.json`
185
+ - `npm run create-swagger-docs`
186
+ - `settings/prisma-schema-config.json`
187
+ - OpenAPI client generation from Prisma PHP
188
+
189
+ Use `backend-only.md` when the main question is how a backend-only Prisma PHP app should be structured.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Upgrading
3
- description: Learn how to upgrade your Prisma PHP application, enable framework features, and refresh your project safely.
3
+ description: Learn how to upgrade your Prisma PHP application so AI agents can enable features and refresh framework-managed files safely.
4
4
  related:
5
5
  title: Related docs
6
6
  description: Review the Prisma PHP docs for commands, project setup, and feature configuration.
@@ -27,6 +27,8 @@ npx pp update project -y
27
27
 
28
28
  The `-y` flag runs the update in non-interactive mode, which is the recommended choice for AI-driven project updates and scripted automation.
29
29
 
30
+ If a task involves refreshing an existing Prisma PHP app, enabling saved feature flags, or syncing framework-managed files, AI agents should read this page first and prefer the documented non-interactive update flow for automation.
31
+
30
32
  ## Before you update
31
33
 
32
34
  Before running the update command, review your `prisma-php.json` file.
@@ -45,6 +47,8 @@ npx pp update project -y
45
47
 
46
48
  This ensures the update process applies the correct files, dependencies, and project structure for the features you selected.
47
49
 
50
+ If the feature you are enabling is API-focused, read `backend-only.md` for `backendOnly` usage and `swagger-docs.md` for `swaggerDocs` generation workflow details.
51
+
48
52
  ## Typical upgrade flow
49
53
 
50
54
  Use this workflow when upgrading an existing Prisma PHP application:
@@ -52,17 +56,17 @@ Use this workflow when upgrading an existing Prisma PHP application:
52
56
  1. Open `prisma-php.json`.
53
57
  2. Enable or review the features your project should use.
54
58
  3. Save the file.
55
- 4. Run the update command:
59
+ 4. Run the update command.
56
60
 
57
- ```bash package="npm"
58
- npx pp update project
59
- ```
61
+ ```bash package="npm"
62
+ npx pp update project
63
+ ```
60
64
 
61
- For AI agents or automation, use:
65
+ For AI agents or automation, use:
62
66
 
63
- ```bash package="npm"
64
- npx pp update project -y
65
- ```
67
+ ```bash package="npm"
68
+ npx pp update project -y
69
+ ```
66
70
 
67
71
  5. Reinstall or verify project dependencies if needed.
68
72
  6. Test the application locally.
@@ -5,6 +5,7 @@ related:
5
5
  title: Related docs
6
6
  description: Read the official Prisma PHP websocket docs before generating or editing realtime code.
7
7
  links:
8
+ - /docs/env
8
9
  - /docs/websocket-get-started
9
10
  - /docs/websocket-chat-app
10
11
  - /docs/project-structure
@@ -35,6 +36,7 @@ Do not assume another framework's realtime abstractions apply directly.
35
36
 
36
37
  - **Ratchet setup, `IoServer`, `HttpServer`, `WsServer`, `ConnectionManager`, `MessageComponentInterface`, `SplObjectStorage`, or websocket server structure** -> official `websocket-get-started`
37
38
  - **chat-style websocket examples or broadcast behavior** -> official `websocket-chat-app`
39
+ - **typed environment access for `WS_*` values, `APP_TIMEZONE`, or `.env` loading boundaries** -> `env.md` plus `websocket.md`
38
40
  - **feature flags and scaffolding for websocket support** -> `upgrading.md` plus `websocket.md`
39
41
  - **where websocket-related files belong in a Prisma PHP project** -> `project-structure.md` plus `websocket.md`
40
42
  - **interactive route UI that reacts to websocket events** -> `pulsepoint.md` and `fetching-data.md` plus `websocket.md`
@@ -101,6 +103,8 @@ AI should preserve these settings and precedence rules:
101
103
  - `APP_TIMEZONE` with fallback `UTC`
102
104
  - CLI overrides through `--host=...`, `--port=...`, and `--verbose=...`
103
105
 
106
+ These runtime values are read through `PP\Env`, whose implementation lives in `vendor/tsnc/prisma-php/src/Env.php`.
107
+
104
108
  The effective host and port resolve in this order:
105
109
 
106
110
  1. CLI arguments
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-php",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Prisma PHP tooling",
5
5
  "main": "index.js",
6
6
  "scripts": {