prisma-php 0.0.10 → 0.0.12

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.
@@ -1,14 +1,18 @@
1
1
  ---
2
2
  title: Prisma PHP Docs
3
- description: Welcome to the Prisma PHP Documentation.
3
+ description: Prisma PHP documentation with AI-aware routing to the right local docs before framework-specific code generation.
4
4
  related:
5
5
  title: Next Steps
6
6
  description: Create your first Prisma PHP application and learn the core framework features.
7
7
  links:
8
8
  - /docs/get-started
9
+ - /docs/commands
10
+ - /docs/get-started-ia
9
11
  ---
10
12
 
11
- {/_AI agent hint: Prisma PHP uses local installed docs as the source of truth for the active project version. Before generating framework-specific code, read `prisma-php.json` first, then read the relevant docs from `node_modules/prisma-php/dist/docs`. For authentication, read `authentication.md` first, then verify the official auth docs: `auth-get-started`, `credentials`, and `state-manager-auth`. For file uploads, `multipart/form-data`, `$_FILES`, `PP\FileManager\UploadFile`, rename/delete flows, or file manager screens, read `file-manager.md` first, then verify the official File Manager docs: `get-started-file`. For email sending, SMTP config, `.env` mail variables, `PP\PHPMailer\Mailer`, HTML or text bodies, recipients, reply-to, or attachments, read `email.md` first, then verify the official Email docs: `email-get-started`. For websocket support, Ratchet setup, `IoServer`, `HttpServer`, `WsServer`, `ConnectionManager`, connection lifecycle methods, browser `WebSocket`, or realtime UI flows, read `websocket.md` first, then verify the official websocket docs: `websocket-get-started` and `websocket-chat-app`. For MCP support, `#[McpTool]`, `#[Schema]`, `PhpMcp\Server\Server`, `StreamableHttpServerTransport`, or `src/Lib/MCP/mcp-server.php`, read `mcp.md` first, then verify the official MCP docs: `prisma-php-ai-mcp` and `ai-tools`. For ORM work, read `prisma-php-orm.md` before choosing schema, migration, or generation commands. For PulsePoint runtime behavior specifically, read `pulsepoint.md` before generating reactive UI code. For normal interactive full-stack page work, default to PulsePoint plus `pp.fetchFunction(...)` unless the user explicitly asks for a PHP-only interaction style. For normal PulsePoint-aware route files such as `index.php` and nested `layout.php`, keep PHP first, then one parent HTML element that acts as the route-view boundary; when PulsePoint logic is present, put `pp-component` on that root and keep the `<script>` as the last child inside it. For imported partial components rendered with `ImportComponent::render(...)`, keep exactly one root element and place any component-local `<script>` inside that root; Prisma PHP injects `pp-component` on the imported root automatically. Do not confuse the route-file pattern with the imported-partial pattern. For backend validation, sanitization, `Validator`, `Rule`, `pp.fetchFunction(...)` validation flows, or request validation in `route.php`, read `validator.md` first, then use `fetching-data.md`, `error-handling.md`, and `route-handlers.md` for context-specific patterns, then consult the official Validator docs. `PP\Validator` is a Prisma PHP core class located in `vendor/tsnc/prisma-php/src/Validator.php`. Route creation is file-based from `src/app`; Prisma PHP auto-generates route listings such as `files-list.json`, so AI agents must not create, edit, or maintain that file manually._/}
13
+ Use this page as the routing entry point for the local Prisma PHP docs. If a task involves choosing which Prisma PHP guide to read before generating framework-specific code, start here and then jump to the matching page in `node_modules/prisma-php/dist/docs`.
14
+
15
+ Before generating framework-specific code, read `prisma-php.json` first, then the matching local docs page. For auth read `authentication.md`; for env read `env.md`; for uploads read `file-manager.md`; for email read `email.md`; for websocket read `websocket.md`; for MCP read `mcp.md`; for ORM read `prisma-php-orm.md`; for reactive UI read `pulsepoint.md`; for validation read `validator.md`; for data loading read `fetching-data.md`; and for route or layout structure read `layouts-and-pages.md`.
12
16
 
13
17
  Welcome to the Prisma PHP documentation!
14
18
 
@@ -26,6 +30,8 @@ Whether you're building an internal dashboard, a content-rich platform, or a cus
26
30
 
27
31
  If you are using AI-assisted development, do not guess framework behavior from other ecosystems.
28
32
 
33
+ Every major page in `dist/docs` is intended to be AI-routable on its own. When a task clearly matches one of those pages, read that file before generating Prisma PHP code.
34
+
29
35
  Use this order:
30
36
 
31
37
  1. Read `./prisma-php.json` first.
@@ -110,9 +116,14 @@ Do not confuse the route-file pattern with the `ImportComponent` partial pattern
110
116
  ### Read this doc when you need
111
117
 
112
118
  - **project setup or file placement** → `project-structure.md`
119
+ - **CLI project creation, starter kits, create-prisma-php-app flags, or project update commands** → `commands.md`
120
+ - **backend-only Prisma PHP usage, API-first projects, `backendOnly`, CORS, separate frontend clients, or choosing `route.php` as the default route file** → `backend-only.md`
113
121
  - **pages, layouts, route creation, nested routes, or PulsePoint-aware `index.php` and `layout.php` structure** → `layouts-and-pages.md`
114
122
  - **PHPX components, props, children, fragments, icons, buttons, accordions, or component composition** → `components.md`
123
+ - **frontend TypeScript tooling, the `typescript` flag, the `ts/` directory, `ts/main.ts`, npm packages, or registered browser helpers used from template expressions and PulsePoint scripts** → `typescript.md`
124
+ - **environment variables, `.env`, `PP\Env`, `Env::get(...)`, `Env::string(...)`, `Env::bool(...)`, `Env::int(...)`, or runtime configuration** → `env.md`
115
125
  - **file uploads, `multipart/form-data`, `$_FILES`, `PP\FileManager\UploadFile`, rename/delete flows, file replacement, allowed file types, upload size rules, or file manager pages** → `file-manager.md`
126
+ - **AI integration, provider SDKs, chat UIs, streamed assistant responses, or deciding between page-local AI features, websocket, and MCP** → `get-started-ia.md`
116
127
  - **SMTP setup, `.env` mail variables, `PP\PHPMailer\Mailer`, HTML email, text email, recipients, reply-to, CC, BCC, or attachments** → `email.md`
117
128
  - **Ratchet websocket setup, `IoServer`, `HttpServer`, `WsServer`, `ConnectionManager`, browser `WebSocket`, or realtime messaging** → `websocket.md`
118
129
  - **MCP server setup, `#[McpTool]`, `#[Schema]`, `PhpMcp\Server\Server`, `StreamableHttpServerTransport`, AI tool endpoints, or `src/Lib/MCP/mcp-server.php`** → `mcp.md`
@@ -124,6 +135,7 @@ Do not confuse the route-file pattern with the `ImportComponent` partial pattern
124
135
  - **error handling, `error.php`, `not-found.php`, expected validation errors** → `error-handling.md`
125
136
  - **metadata, title, description, favicon, icons** → `metadata-and-og-images.md`
126
137
  - **API-style endpoints, `route.php`, request validation with `Validator`** → `route-handlers.md`
138
+ - **Swagger or OpenAPI generation, `swaggerDocs`, `pphp-swagger.json`, `create-swagger-docs`, or `settings/prisma-schema-config.json`** → `swagger-docs.md`
127
139
  - **PulsePoint runtime APIs such as `pp.state`, `pp.effect`, `pp.ref`, `pp-for`, `pp-ref`, `pp-spread`** → `pulsepoint.md`
128
140
  - **updating the project or enabling features** → `upgrading.md`
129
141
  - **first-time project creation** → `installation.md`
@@ -135,7 +147,10 @@ Do not confuse the route-file pattern with the `ImportComponent` partial pattern
135
147
  - do not guess routing, file conventions, request helpers, component APIs, reactive syntax, or auth behavior when local docs already define them
136
148
  - create routes by adding folders and route files under `src/app`
137
149
  - do not create, edit, or maintain `files-list.json`; Prisma PHP generates route listings automatically
150
+ - when the project is API-first or backend-only, read `backend-only.md`, inspect `backendOnly` in `prisma-php.json`, and default to `route.php` for normal route behavior
151
+ - when reading runtime configuration, `.env`, or feature flags, read `env.md` first and prefer `PP\Env` typed helpers over repeated manual parsing
138
152
  - when building interactive frontend behavior, prefer the documented PulsePoint pattern with browser-side reactive state and `pp.fetchFunction(...)` for server calls; treat this as the default unless the user explicitly asks for a PHP-only interaction pattern
153
+ - when the task involves frontend TypeScript tooling or registered browser helpers, read `typescript.md`, keep reusable module code in `ts/`, and call the registered globals from PulsePoint component scripts instead of placing `import` or `export` inside inline route scripts
139
154
  - when building PulsePoint inside `index.php` or `layout.php`, read `layouts-and-pages.md` together with `pulsepoint.md`, use one parent route root, put `pp-component` on that root, and keep the `<script>` inside it as the last child
140
155
  - when importing a PHP partial with `ImportComponent`, require exactly one root element and keep any partial-local `<script>` inside that root because Prisma PHP attaches serialized props and a stable `pp-component` attribute to that imported root
141
156
  - do not leave a PulsePoint `<script>` as a sibling outside the route root
@@ -143,11 +158,56 @@ Do not confuse the route-file pattern with the `ImportComponent` partial pattern
143
158
  - when building backend validation logic, read `validator.md` first, then use the route-specific docs for the request entry point
144
159
  - when using `pp.fetchFunction(...)`, expose the PHP function explicitly with `#[Exposed]`
145
160
  - when changing feature flags, update `prisma-php.json` first, then follow the documented update workflow
161
+ - when the task involves OpenAPI or Swagger generation, read `swagger-docs.md`, inspect `swaggerDocs` in `prisma-php.json`, and keep the generated spec path and config file aligned with the Prisma PHP workflow
146
162
  - when building reusable PHPX components, read `components.md` first
147
163
  - when building file-upload flows, file listings, rename/delete actions, or a file manager screen, read `file-manager.md` first and keep the implementation aligned with Prisma PHP’s documented File Manager model
148
164
  - when building MCP tools or server integrations, read `mcp.md` first, inspect `prisma-php.json`, and keep the implementation aligned with Prisma PHP's documented `src/Lib/MCP` server and attribute-based discovery model
149
165
  - when building auth flows, protection rules, or login/register pages, read `authentication.md` first and keep the implementation aligned with Prisma PHP’s documented auth model
150
166
 
167
+ ## AI Integration
168
+
169
+ Prisma PHP supports both provider-backed AI features inside normal pages and agent-facing MCP tooling, but those are different workflows.
170
+
171
+ For a normal chat UI, assistant panel, streamed summary, or other page-local AI feature, the default pattern is:
172
+
173
+ - render the route with `index.php`
174
+ - keep browser-side state in PulsePoint
175
+ - call PHP with `pp.fetchFunction(...)`
176
+ - expose callable PHP with `#[Exposed]`
177
+ - validate payloads with `PP\Validator`
178
+ - yield streamed chunks from PHP when incremental output is needed
179
+
180
+ Use `get-started-ia.md` as the local AI guide for provider-backed chat, streaming, and the boundary between page-local AI, websocket, and MCP tooling.
181
+
182
+ ## TypeScript
183
+
184
+ Prisma PHP can use a Vite-backed TypeScript workflow when the `typescript` feature flag is enabled in `prisma-php.json`.
185
+
186
+ Use `typescript.md` as the local AI guide for:
187
+
188
+ - enabling TypeScript in new or existing projects
189
+ - organizing frontend modules in `ts/`
190
+ - registering browser helpers in `ts/main.ts`
191
+ - installing npm packages for frontend utilities
192
+ - using registered helpers from template expressions and PulsePoint scripts while keeping inline component scripts as plain JavaScript
193
+
194
+ ## Env
195
+
196
+ Prisma PHP includes a documented environment helper centered on `PP\Env`, which reads already-loaded runtime values and exposes typed accessors for strings, booleans, and integers.
197
+
198
+ Use `env.md` as the local AI-awareness guide for:
199
+
200
+ - `.env` and runtime configuration boundaries
201
+ - `PP\Env`
202
+ - `Env::get(...)`, `Env::string(...)`, `Env::bool(...)`, and `Env::int(...)`
203
+ - app names, timezones, host and port settings, feature flags, and numeric limits
204
+ - provider keys, SMTP settings, and other server-only configuration values
205
+
206
+ After reading `env.md`, verify the matching official docs at:
207
+
208
+ 1. `env`
209
+ 2. `env-file` when the task is specifically about `.env` file contents or placement
210
+
151
211
  ## File Manager
152
212
 
153
213
  Prisma PHP includes a documented File Manager model for uploads and file operations based on standard PHP uploads plus `PP\FileManager\UploadFile`.
@@ -1,10 +1,29 @@
1
1
  ---
2
2
  title: Installation
3
- description: Learn how to create a new Prisma PHP application with the `create-prisma-php-app` CLI and start building locally.
3
+ description: Learn how to create a new Prisma PHP application so AI agents can use the first-time setup flow instead of existing-project update commands.
4
+ related:
5
+ title: Related docs
6
+ description: Read the full command reference and the existing-project update workflow.
7
+ links:
8
+ - /docs/commands
9
+ - /docs/upgrading
4
10
  ---
5
11
 
6
12
  Create a new Prisma PHP app and run it locally.
7
13
 
14
+ For the full create and update command reference, read `commands.md`.
15
+
16
+ If a task involves first-time Prisma PHP app creation, starter project bootstrap, or local setup, AI agents should read this page first and keep new-project setup separate from existing-project update workflows.
17
+
18
+ ## AI rule: use installation only for first-time setup
19
+
20
+ Before suggesting Prisma PHP installation steps, use this order:
21
+
22
+ 1. Use `create-prisma-php-app` only when the application does not exist yet.
23
+ 2. Read `commands.md` for feature flags, starter kits, and non-interactive creation options.
24
+ 3. Inspect the generated `prisma-php.json` after creation before generating feature-specific code.
25
+ 4. Use `upgrading.md` for existing projects instead of treating installation like an update workflow.
26
+
8
27
  ## Quick start
9
28
 
10
29
  1. Create a new Prisma PHP app.
@@ -12,7 +31,7 @@ Create a new Prisma PHP app and run it locally.
12
31
  3. Start the local development environment.
13
32
 
14
33
  ```bash package="npm"
15
- npx create-prisma-php-app@latest
34
+ npx create-prisma-php-app@latest my-app
16
35
  cd my-app
17
36
  npm run dev
18
37
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Layouts and Pages
3
- description: Learn how to create your first pages and layouts in Prisma PHP, structure routes with the framework's file conventions, and keep PulsePoint-aware route files predictable.
3
+ description: Learn how AI agents should create pages and layouts in Prisma PHP, choose the correct route files, and keep PulsePoint-aware route files predictable.
4
4
  related:
5
5
  title: API Reference
6
6
  description: Learn more about the features mentioned in this page by reading the Prisma PHP routing and PulsePoint documentation.
@@ -17,6 +17,18 @@ related:
17
17
 
18
18
  Prisma PHP uses **file-system based routing**, meaning you can use folders and files to define routes. This page explains how to create pages and layouts, how to choose the correct route file, and how to keep PulsePoint-aware route files structurally consistent.
19
19
 
20
+ If a task involves pages, layouts, route folders, dynamic routes, or choosing between `index.php` and `route.php`, AI agents should read this page first and keep route-file structure aligned with the installed Prisma PHP version.
21
+
22
+ ## AI rule: read the route docs first
23
+
24
+ Before generating Prisma PHP route files, use this order:
25
+
26
+ 1. Read `prisma-php.json`.
27
+ 2. Decide whether the project is full-stack or backend-only.
28
+ 3. Use `index.php` for rendered pages, `route.php` for direct handlers, and `layout.php` for shared subtree UI.
29
+ 4. Keep PulsePoint-aware route files to one parent root element with the `<script>` inside it.
30
+ 5. Do not edit `files-list.json`; Prisma PHP derives route metadata from the route tree.
31
+
20
32
  ## Important route generation note
21
33
 
22
34
  In Prisma PHP, routes are created from folders and special files inside `src/app`.
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.
@@ -15,6 +15,8 @@ Prisma PHP ORM gives Prisma PHP applications a schema-first, Prisma-style data l
15
15
 
16
16
  It uses your Prisma schema, Prisma migrations, and generated PHP classes so your application can query the database through the documented Prisma PHP API.
17
17
 
18
+ If a task involves `schema.prisma`, migrations, generated Prisma PHP classes, `npx prisma ...`, or `npx ppo generate`, AI agents should read this page first and keep the workflow aligned with the installed Prisma PHP docs.
19
+
18
20
  ## ORM result shape rule
19
21
 
20
22
  Prisma PHP ORM query results should be treated as model-shaped objects returned by the generated Prisma PHP classes that follow `prisma/schema.prisma`.
@@ -75,7 +77,7 @@ Use this order:
75
77
 
76
78
  For Prisma PHP ORM tasks, AI should read:
77
79
 
78
- - `06-prisma-php-orm.md`
80
+ - `prisma-php-orm.md`
79
81
  - the official Prisma PHP ORM docs for the installed version
80
82
  - `schema.prisma`
81
83
  - `prisma.config.ts`
@@ -196,24 +198,26 @@ Use this flow:
196
198
  6. when the user is using SQLite, prefer saving the database file inside the local `./prisma` directory
197
199
  7. for the normal local setup, use:
198
200
 
199
- ```env
200
- DATABASE_URL="file:./prisma/dev.db"
201
- ```
201
+ ```env
202
+ DATABASE_URL="file:./prisma/dev.db"
203
+ ```
202
204
 
203
- 8. confirm the resolved path points to a valid project-local SQLite file such as `./prisma/dev.db`
204
- 9. do not point the SQLite file at an unrelated root-level location when the project is using the standard Prisma PHP layout
205
- 10. if the `./prisma` directory is the intended storage location, the SQLite database file should be created and saved there
206
- 11. if the SQLite database file is missing, invalid, or not initialized yet, run:
205
+ Then continue with these checks:
207
206
 
208
- ```bash
209
- npx prisma migrate dev
210
- ```
207
+ - confirm the resolved path points to a valid project-local SQLite file such as `./prisma/dev.db`
208
+ - do not point the SQLite file at an unrelated root-level location when the project is using the standard Prisma PHP layout
209
+ - if the `./prisma` directory is the intended storage location, the SQLite database file should be created and saved there
210
+ - if the SQLite database file is missing, invalid, or not initialized yet, run:
211
211
 
212
- 12. after migration succeeds, run:
212
+ ```bash
213
+ npx prisma migrate dev
214
+ ```
213
215
 
214
- ```bash
215
- npx ppo generate
216
- ```
216
+ - after migration succeeds, run:
217
+
218
+ ```bash
219
+ npx ppo generate
220
+ ```
217
221
 
218
222
  Important SQLite rule:
219
223
 
@@ -1,11 +1,34 @@
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.
4
+ description: Learn the folder and file conventions in Prisma PHP, including the installed docs path and project-root AGENTS.md, so AI agents can place features in the right files and folders.
5
+ related:
6
+ title: Related docs
7
+ description: Use the routing, handler, component, and TypeScript docs once you know where a change belongs.
8
+ links:
9
+ - /docs/pages-and-layouts
10
+ - /docs/route-php
11
+ - /docs/import-component
12
+ - /docs/typescript
5
13
  ---
6
14
 
7
15
  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
16
 
17
+ 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.
18
+
19
+ For AI-assisted work, treat `node_modules/prisma-php/dist/docs` as the installed Prisma PHP docs location for the active project version, and keep `AGENTS.md` in the project root aligned with that docs set.
20
+
21
+ ## AI rule: read the structure docs first
22
+
23
+ Before generating Prisma PHP files or folders, use this order:
24
+
25
+ 1. Read `prisma-php.json`.
26
+ 2. Read the matching installed doc in `node_modules/prisma-php/dist/docs`.
27
+ 3. Read `AGENTS.md` for project-specific Prisma PHP rules.
28
+ 4. Decide whether the task belongs in `src/app`, `src/Lib`, `prisma`, `public`, `settings`, or the installed docs path.
29
+ 5. Create routes from the route tree instead of editing `files-list.json`.
30
+ 6. Use `layouts-and-pages.md`, `route-handlers.md`, or `components.md` once the file location is known.
31
+
9
32
  ## Folder and file conventions
10
33
 
11
34
  ### Top-level folders
@@ -16,10 +39,21 @@ Top-level folders are used to organize your application's source code, configura
16
39
  | ---------- | ----------------------------------------------------------------------------- |
17
40
  | `src/app` | File-system based routing, pages, layouts, loading states, and route handlers |
18
41
  | `src/Lib` | Application libraries, generated Prisma classes, auth, middleware, utilities |
42
+ | `ts` | Frontend TypeScript modules and Vite entry files when `typescript` is enabled |
19
43
  | `public` | Public web root, static files, CSS, JS, favicon, and public entry point |
20
44
  | `prisma` | Prisma schema, migrations, and seed scripts |
21
45
  | `settings` | Project configuration such as paths, BrowserSync, and related setup |
22
46
 
47
+ ### Installed framework docs
48
+
49
+ Prisma PHP installs its framework docs inside `node_modules/prisma-php/dist/docs`.
50
+
51
+ AI agents should treat that installed docs directory as the single source of truth for framework behavior in the active project version.
52
+
53
+ | Path | Purpose |
54
+ | ----------------------------------- | -------------------------------------------------------------------- |
55
+ | `node_modules/prisma-php/dist/docs` | Installed Prisma PHP docs for the current project version and AI use |
56
+
23
57
  ### Top-level files
24
58
 
25
59
  These files are typically used to configure the app, manage dependencies, and define environment values.
@@ -29,6 +63,7 @@ These files are typically used to configure the app, manage dependencies, and de
29
63
  | `composer.json` | PHP dependencies and autoloading |
30
64
  | `package.json` | Frontend tooling and development scripts when used |
31
65
  | `.env` | Environment variables |
66
+ | `AGENTS.md` | Project-root AI guidance aligned with the installed docs set |
32
67
  | `prisma/schema.prisma` | Main Prisma schema file |
33
68
  | `public/index.php` | Public entry point |
34
69
  | `bootstrap.php` | Application bootstrap and middleware registration when present |
@@ -55,6 +90,12 @@ Typical values include:
55
90
 
56
91
  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
92
 
93
+ For backend-only API projects, read `backend-only.md`.
94
+
95
+ For Swagger and OpenAPI generation, read `swagger-docs.md`.
96
+
97
+ For TypeScript frontend tooling, the root `ts/` directory, `ts/main.ts`, and npm-backed browser utilities, read `typescript.md`.
98
+
58
99
  ### Full-stack vs backend-only routing decision
59
100
 
60
101
  One of the most important capability flags is `backendOnly`.
@@ -222,6 +263,10 @@ Redirects are handled with `Request::redirect()`, which sends an HTTP `Location`
222
263
 
223
264
  ```txt
224
265
  prisma-php-project/
266
+ ├── node_modules/
267
+ │ └── prisma-php/
268
+ │ └── dist/
269
+ │ └── docs/
225
270
  ├── prisma/
226
271
  │ ├── migrations/
227
272
  │ ├── schema.prisma
@@ -273,6 +318,7 @@ prisma-php-project/
273
318
  ├── composer.json
274
319
  ├── package.json
275
320
  ├── prisma-php.json
321
+ ├── AGENTS.md
276
322
  └── .env
277
323
  ```
278
324
 
@@ -1,9 +1,22 @@
1
- # PulsePoint Runtime Guide
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
+ related:
5
+ title: Related docs
6
+ description: Read the route, component, data-fetching, and TypeScript docs alongside the PulsePoint runtime contract.
7
+ links:
8
+ - /docs/pages-and-layouts
9
+ - /docs/import-component
10
+ - /docs/fetch-function
11
+ - /docs/typescript
12
+ ---
2
13
 
3
14
  ## Purpose
4
15
 
5
16
  This file describes the PulsePoint runtime that is actually implemented in the current TypeScript source of this repo. Treat it as the working contract for AI-generated code.
6
17
 
18
+ If a task involves `pp.state`, `pp.effect`, `pp-ref`, `pp-spread`, route-root scripts, imported partial runtime behavior, or current `pp-component` semantics, AI agents should read this page first and keep generated code aligned with the runtime implemented in this repo.
19
+
7
20
  Do not assume React, Vue, Svelte, JSX, or older PulsePoint docs.
8
21
 
9
22
  ## Runtime shape
@@ -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