prisma-php 0.0.1 → 0.0.3
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/{01-getting-started/authentication.md → authentication.md} +1 -0
- package/dist/docs/{01-getting-started/error-handling.md → error-handling.md} +3 -0
- package/dist/docs/{01-getting-started/fetching-data.md → fetching-data.md} +38 -4
- package/dist/docs/{01-getting-started/file-manager.md → file-manager.md} +4 -2
- package/dist/docs/index.md +74 -160
- package/dist/docs/{01-getting-started/layouts-and-pages.md → layouts-and-pages.md} +58 -4
- package/dist/docs/{01-getting-started/prisma-php-orm.md → prisma-php-orm.md} +1 -0
- package/dist/docs/{01-getting-started/project-structure.md → project-structure.md} +11 -2
- package/dist/docs/{01-getting-started/pulsepoint.md → pulsepoint.md} +45 -5
- package/dist/docs/{01-getting-started/route-handlers.md → route-handlers.md} +2 -0
- package/dist/docs/validator.md +293 -0
- package/package.json +1 -1
- package/dist/docs/01-getting-started/index.md +0 -142
- /package/dist/docs/{01-getting-started/caching.md → caching.md} +0 -0
- /package/dist/docs/{01-getting-started/components.md → components.md} +0 -0
- /package/dist/docs/{01-getting-started/installation.md → installation.md} +0 -0
- /package/dist/docs/{01-getting-started/metadata-and-og-images.md → metadata-and-og-images.md} +0 -0
- /package/dist/docs/{01-getting-started/upgrading.md → upgrading.md} +0 -0
|
@@ -193,6 +193,7 @@ The documented login flow uses:
|
|
|
193
193
|
When generating credentials auth, do not trust raw request data.
|
|
194
194
|
|
|
195
195
|
For backend validation and normalization, default to Prisma PHP’s validation layer rather than browser-only checks. In this docs set, that means using the documented validation guidance alongside `PP\Validator`-style server validation patterns from the rest of the local docs.
|
|
196
|
+
Read `validator.md` before generating credential validation, registration validation, or auth-related request normalization.
|
|
196
197
|
|
|
197
198
|
## Social authentication
|
|
198
199
|
|
|
@@ -6,6 +6,7 @@ related:
|
|
|
6
6
|
description: Learn more about the features mentioned on this page by reading the Prisma PHP docs.
|
|
7
7
|
links:
|
|
8
8
|
- /docs/error-handler
|
|
9
|
+
- /docs/php-validator
|
|
9
10
|
- /docs/route-php
|
|
10
11
|
- /docs/index-php
|
|
11
12
|
- /docs/pages-and-layouts
|
|
@@ -62,6 +63,8 @@ In Prisma PHP, the recommended pattern is generally:
|
|
|
62
63
|
- return a structured response or message
|
|
63
64
|
- avoid letting routine validation failures become fatal exceptions
|
|
64
65
|
|
|
66
|
+
Read `validator.md` for the detailed local guidance on helper selection, rule syntax, and `Validator::withRules(...)` behavior.
|
|
67
|
+
|
|
65
68
|
### Form or direct function example
|
|
66
69
|
|
|
67
70
|
```php filename="src/app/contact/index.php"
|
|
@@ -6,6 +6,7 @@ related:
|
|
|
6
6
|
description: Learn more about the features mentioned in this page by reading the Prisma PHP docs.
|
|
7
7
|
links:
|
|
8
8
|
- /docs/fetch-function
|
|
9
|
+
- /docs/php-validator
|
|
9
10
|
- /docs/index-php
|
|
10
11
|
- /docs/route-php
|
|
11
12
|
- /docs/pages-and-layouts
|
|
@@ -18,6 +19,38 @@ Prisma PHP has a different mental model from Next.js. Instead of focusing on Rea
|
|
|
18
19
|
When using `pp.fetchFunction(...)`, the PHP function must be explicitly exposed with `#[Exposed]`. Functions are private by default, so a non-exposed function cannot be called from the client.
|
|
19
20
|
|
|
20
21
|
For validation, the default backend pattern should be **`PP\Validator`**. Use it to sanitize, cast, and validate values inside exposed functions and route handlers. This keeps the browser reactive while keeping the authoritative validation on the server.
|
|
22
|
+
Read `validator.md` alongside this page when you need the detailed helper list, rule syntax options, or the `Validator::withRules(...)` return contract.
|
|
23
|
+
|
|
24
|
+
## Default AI decision rule
|
|
25
|
+
|
|
26
|
+
For **normal interactive full-stack Prisma PHP work**, AI should default to this stack:
|
|
27
|
+
|
|
28
|
+
1. render the route with `index.php`
|
|
29
|
+
2. use **PulsePoint** for browser-side state and reactive UI behavior
|
|
30
|
+
3. use **`pp.fetchFunction(...)`** for frontend-to-PHP calls
|
|
31
|
+
4. mark callable PHP functions with **`#[Exposed]`**
|
|
32
|
+
5. use **`PP\Validator`** for authoritative backend validation and normalization
|
|
33
|
+
|
|
34
|
+
This should be the default for cases such as:
|
|
35
|
+
|
|
36
|
+
- live search
|
|
37
|
+
- filters
|
|
38
|
+
- pagination controls
|
|
39
|
+
- quick edit dialogs
|
|
40
|
+
- inline validation
|
|
41
|
+
- toggles and status changes
|
|
42
|
+
- modal-based mutations
|
|
43
|
+
- optimistic-feeling dashboard interactions
|
|
44
|
+
- route-local CRUD actions that belong to the current page
|
|
45
|
+
|
|
46
|
+
Do **not** default to a more PHP-only interaction style for those cases unless the **user explicitly asks for PHP-only behavior**.
|
|
47
|
+
|
|
48
|
+
A more PHP-only pattern is reasonable when:
|
|
49
|
+
|
|
50
|
+
- the user explicitly asks for plain PHP, classic form submission, or no PulsePoint
|
|
51
|
+
- the route is intentionally non-reactive
|
|
52
|
+
- the task is a standalone API, webhook, integration endpoint, or public JSON route
|
|
53
|
+
- the behavior must exist independently of the current page
|
|
21
54
|
|
|
22
55
|
## Validation is a server concern
|
|
23
56
|
|
|
@@ -49,6 +82,7 @@ For reactive UI work, the best Prisma PHP pattern is usually:
|
|
|
49
82
|
4. return a structured object for the UI to render
|
|
50
83
|
|
|
51
84
|
The official Validator docs recommend the **`Rule` builder** for most rule-based validation because it is easier to discover, easier to refactor, and less error-prone than raw pipe strings.
|
|
85
|
+
`validator.md` is the local source of truth for how this docs set expects AI to apply that guidance.
|
|
52
86
|
|
|
53
87
|
## Recommended pattern for reactive Prisma PHP UIs
|
|
54
88
|
|
|
@@ -59,9 +93,9 @@ For normal interactive UI work in Prisma PHP, the default approach should be:
|
|
|
59
93
|
3. call PHP from the frontend with `pp.fetchFunction(...)`
|
|
60
94
|
4. expose callable functions with `#[Exposed]`
|
|
61
95
|
|
|
62
|
-
This is the preferred pattern for live search, inline validation, toggles, quick edits, filtering, lightweight mutations, and similar route-local interactions.
|
|
96
|
+
This is the preferred pattern for live search, inline validation, toggles, quick edits, filtering, lightweight mutations, pagination, modal workflows, and similar route-local interactions.
|
|
63
97
|
|
|
64
|
-
Do **not** default to building extra `route.php` endpoints for every interactive action when `pp.fetchFunction(...)` is the better fit. Reserve `route.php` for explicit API-style endpoints, webhooks, JSON handlers, or routes that must be called independently of the page.
|
|
98
|
+
Do **not** default to building extra `route.php` endpoints for every interactive action when `pp.fetchFunction(...)` is the better fit. Also do **not** default to a PHP-only interaction model for normal reactive page behavior unless the user explicitly asks for that style. Reserve `route.php` for explicit API-style endpoints, webhooks, JSON handlers, or routes that must be called independently of the page.
|
|
65
99
|
|
|
66
100
|
## Fetching data in Prisma PHP
|
|
67
101
|
|
|
@@ -617,7 +651,7 @@ When fetching data from Prisma PHP:
|
|
|
617
651
|
- every function called through `pp.fetchFunction(...)` must use `#[Exposed]`
|
|
618
652
|
- return structured validation results instead of relying on thrown exceptions for routine failures
|
|
619
653
|
- use `Exposed` options to enforce auth, roles, or rate limits
|
|
620
|
-
- prefer `route.php` for dedicated public or integration-facing endpoints
|
|
654
|
+
- prefer `route.php` for dedicated public or integration-facing endpoints, not as the default answer for normal page-local interactivity
|
|
621
655
|
- keep sensitive database access on the server side
|
|
622
656
|
|
|
623
657
|
Because Prisma PHP runs the data logic in PHP, database credentials and internal query logic stay on the server.
|
|
@@ -634,4 +668,4 @@ Because Prisma PHP runs the data logic in PHP, database credentials and internal
|
|
|
634
668
|
- `abortPrevious: true` helps cancel stale requests.
|
|
635
669
|
- file uploads can be handled automatically without manual `FormData` in many cases.
|
|
636
670
|
- `Exposed` can be used to declare authentication, allowed roles, and rate limits for callable functions.
|
|
637
|
-
- for full-stack routes, load page data in `index.php` and use direct function invocation for interactive updates.
|
|
671
|
+
- for full-stack routes, load page data in `index.php` and use PulsePoint plus direct function invocation for interactive updates unless the user explicitly asks for a PHP-only flow.
|
|
@@ -15,6 +15,7 @@ related:
|
|
|
15
15
|
Prisma PHP file handling should follow the documented **File Manager** model and standard PHP upload rules, not assumptions copied from Laravel storage disks, Symfony upload abstractions, Livewire temporary uploads, or custom Node-style multipart pipelines.
|
|
16
16
|
|
|
17
17
|
If a task involves file uploads, upload forms, `$_FILES`, upload size limits, allowed file types, renaming, deleting, replacing files, or building a file manager UI, AI agents should read the relevant Prisma PHP File Manager docs first and keep the implementation aligned with the installed Prisma PHP version.
|
|
18
|
+
When the task also involves validating rename fields, labels, descriptions, or other non-file inputs, read `validator.md` alongside this page.
|
|
18
19
|
|
|
19
20
|
## AI rule: read the File Manager docs first
|
|
20
21
|
|
|
@@ -32,7 +33,7 @@ Do not assume another framework's storage abstraction applies directly.
|
|
|
32
33
|
## Read this doc when you need
|
|
33
34
|
|
|
34
35
|
- **basic upload form setup, `multipart/form-data`, or raw `$_FILES` behavior** → official `get-started-file`
|
|
35
|
-
- **upload validation and normalization for names or request values** → official `php-validator
|
|
36
|
+
- **upload validation and normalization for names or request values** → `validator.md` first, then official `php-validator`, plus local validation guidance in `fetching-data.md`, `error-handling.md`, and `route-handlers.md`
|
|
36
37
|
- **a rendered upload page or full-stack file manager screen** → `index.php` plus `layouts-and-pages.md`
|
|
37
38
|
- **a standalone upload endpoint, webhook-like file receiver, or direct JSON upload handler** → `route.php` plus `route-handlers.md`
|
|
38
39
|
- **local dev reload issues caused by uploaded files changing on disk** → inspect `./settings/bs-config.ts` and exclude the upload directory from BrowserSync tracking
|
|
@@ -210,6 +211,7 @@ For file manager pages and upload-related actions, keep these concerns separate:
|
|
|
210
211
|
- use route pages or route handlers according to the documented `index.php` versus `route.php` split
|
|
211
212
|
|
|
212
213
|
Do not use filename cleanup as a substitute for validating other request data.
|
|
214
|
+
For the full local validation contract, read `validator.md`.
|
|
213
215
|
|
|
214
216
|
## Organization guidance
|
|
215
217
|
|
|
@@ -277,7 +279,7 @@ When the user asks for upload or file-manager functionality, AI should usually f
|
|
|
277
279
|
4. choose the upload destination directory
|
|
278
280
|
5. if local reload becomes noisy, exclude the upload directory in `./settings/bs-config.ts`
|
|
279
281
|
6. use `UploadFile` for upload, rename, update, and delete operations when it fits the documented workflow
|
|
280
|
-
7. use `PP\Validator` for rename fields or other non-file request values
|
|
282
|
+
7. read `validator.md`, then use `PP\Validator` for rename fields or other non-file request values
|
|
281
283
|
8. return structured messages for expected failures
|
|
282
284
|
9. inspect Prisma PHP internals only if the docs and local project usage are not enough
|
|
283
285
|
|
package/dist/docs/index.md
CHANGED
|
@@ -8,7 +8,7 @@ related:
|
|
|
8
8
|
- /docs/get-started
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
{/
|
|
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 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 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. _/}
|
|
12
12
|
|
|
13
13
|
Welcome to the Prisma PHP documentation!
|
|
14
14
|
|
|
@@ -33,143 +33,99 @@ Use this order:
|
|
|
33
33
|
3. Inspect local project files.
|
|
34
34
|
4. Inspect `vendor/tsnc/prisma-php/src` only when framework internals are necessary.
|
|
35
35
|
|
|
36
|
+
### Default interactive pattern
|
|
37
|
+
|
|
38
|
+
For typical full-stack Prisma PHP work, AI should assume this default:
|
|
39
|
+
|
|
40
|
+
1. render route UI in `index.php`
|
|
41
|
+
2. keep browser-side interactivity in **PulsePoint**
|
|
42
|
+
3. call PHP from the frontend with **`pp.fetchFunction(...)`**
|
|
43
|
+
4. expose callable functions with **`#[Exposed]`**
|
|
44
|
+
5. validate and normalize incoming values in PHP with **`PP\Validator`**
|
|
45
|
+
|
|
46
|
+
Do **not** default to PHP-only interaction flows for normal reactive UI work unless the user explicitly asks for that style.
|
|
47
|
+
|
|
36
48
|
### Read this doc when you need
|
|
37
49
|
|
|
38
50
|
- **project setup or file placement** → `project-structure.md`
|
|
39
|
-
- **pages, layouts, route creation, nested routes** → `layouts-and-pages.md`
|
|
40
|
-
-
|
|
51
|
+
- **pages, layouts, route creation, nested routes, or PulsePoint-aware `index.php` and `layout.php` structure** → `layouts-and-pages.md`
|
|
52
|
+
- **PHPX components, props, children, fragments, icons, buttons, accordions, or component composition** → `components.md`
|
|
53
|
+
- **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`
|
|
54
|
+
- **authentication strategy, `AuthConfig.php`, sign-in, sign-out, route privacy model, RBAC, credentials auth, social login, or auth state manager usage** → `authentication.md`
|
|
55
|
+
- **validation, sanitization, casting, `PP\Validator`, `Rule`, or `Validator::withRules(...)`** → `validator.md`
|
|
56
|
+
- **`pp.fetchFunction(...)`, `#[Exposed]`, page data loading, interactive validation with `Validator`** → `fetching-data.md`
|
|
41
57
|
- **cache behavior and `CacheHandler`** → `caching.md`
|
|
42
|
-
- **
|
|
43
|
-
- **error handling, `error.php`, `not-found.php
|
|
58
|
+
- **ORM, `schema.prisma`, database provider, migrations, generated PHP classes, `prisma.config.ts`, `.env` `DATABASE_URL`, or Prisma CLI workflow** → `prisma-php-orm.md`
|
|
59
|
+
- **error handling, `error.php`, `not-found.php`, expected validation errors** → `error-handling.md`
|
|
44
60
|
- **metadata, title, description, favicon, icons** → `metadata-and-og-images.md`
|
|
45
|
-
- **API-style endpoints
|
|
61
|
+
- **API-style endpoints, `route.php`, request validation with `Validator`** → `route-handlers.md`
|
|
46
62
|
- **PulsePoint runtime APIs such as `pp.state`, `pp.effect`, `pp.ref`, `pp-for`, `pp-ref`, `pp-spread`** → `pulsepoint.md`
|
|
47
|
-
- **updating the project
|
|
63
|
+
- **updating the project or enabling features** → `upgrading.md`
|
|
64
|
+
- **first-time project creation** → `installation.md`
|
|
48
65
|
|
|
49
66
|
### Important AI rules
|
|
50
67
|
|
|
51
68
|
- treat `node_modules/prisma-php/dist/docs` as the primary documentation source for the installed version
|
|
52
69
|
- do not assume Laravel, Symfony, React, Vue, Alpine, Livewire, or Next.js behavior maps directly
|
|
53
|
-
- do not guess routing, file conventions, request helpers, reactive syntax, or
|
|
70
|
+
- do not guess routing, file conventions, request helpers, component APIs, reactive syntax, or auth behavior when local docs already define them
|
|
54
71
|
- create routes by adding folders and route files under `src/app`
|
|
55
72
|
- do not create, edit, or maintain `files-list.json`; Prisma PHP generates route listings automatically
|
|
56
|
-
- when building interactive frontend behavior, prefer the documented PulsePoint pattern with browser-side reactive state and `pp.fetchFunction(...)` for server calls
|
|
73
|
+
- 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
|
|
74
|
+
- when building PulsePoint inside `index.php` or `layout.php`, read `layouts-and-pages.md` together with `pulsepoint.md`, use PHP then HTML then one `<script>` block, and keep route content inside a single parent HTML element
|
|
75
|
+
- when building backend validation logic, read `validator.md` first, then use the route-specific docs for the request entry point
|
|
57
76
|
- when using `pp.fetchFunction(...)`, expose the PHP function explicitly with `#[Exposed]`
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
- do not treat `npx ppo generate` as a migration step or as proof that the database is already synced
|
|
63
|
-
- do not use `npx pp update project -y` as a replacement for Prisma migration or ORM class generation; that command is for updating the project structure, dependencies, and enabled framework features
|
|
64
|
-
- when changing feature flags in `prisma-php.json`, follow the documented project update workflow
|
|
65
|
-
- for AI-driven project updates, prefer the documented non-interactive command: `npx pp update project -y`
|
|
66
|
-
|
|
67
|
-
## Important PHPX and XML syntax rules
|
|
68
|
-
|
|
69
|
-
Prisma PHP uses **XML-style syntax** for PHPX and framework template markup.
|
|
70
|
-
|
|
71
|
-
This means AI agents and developers should not write tags using permissive HTML shorthand. Prisma PHP markup should be treated as **strict XML**, where tags and attributes must follow explicit closing and quoting rules.
|
|
72
|
-
|
|
73
|
-
### Closing tags
|
|
74
|
-
|
|
75
|
-
All tags must be properly closed.
|
|
76
|
-
|
|
77
|
-
Correct:
|
|
78
|
-
|
|
79
|
-
```xml
|
|
80
|
-
<hr />
|
|
81
|
-
<input type="text" />
|
|
82
|
-
<div></div>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Incorrect:
|
|
86
|
-
|
|
87
|
-
```xml
|
|
88
|
-
<hr>
|
|
89
|
-
<input type="text">
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Attributes
|
|
93
|
-
|
|
94
|
-
All attributes must use double quotes.
|
|
95
|
-
|
|
96
|
-
Correct:
|
|
97
|
-
|
|
98
|
-
```xml
|
|
99
|
-
<input required="true" />
|
|
100
|
-
<input id="input" />
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Incorrect:
|
|
104
|
-
|
|
105
|
-
```xml
|
|
106
|
-
<input required />
|
|
107
|
-
<input id=input />
|
|
108
|
-
```
|
|
77
|
+
- when changing feature flags, update `prisma-php.json` first, then follow the documented update workflow
|
|
78
|
+
- when building reusable PHPX components, read `components.md` first
|
|
79
|
+
- 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
|
|
80
|
+
- 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
|
|
109
81
|
|
|
110
|
-
|
|
82
|
+
## File Manager
|
|
111
83
|
|
|
112
|
-
|
|
84
|
+
Prisma PHP includes a documented File Manager model for uploads and file operations based on standard PHP uploads plus `PP\FileManager\UploadFile`.
|
|
113
85
|
|
|
114
|
-
|
|
86
|
+
Use `file-manager.md` as the local AI-awareness guide for:
|
|
115
87
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
88
|
+
- upload forms with `multipart/form-data`
|
|
89
|
+
- `$_FILES` handling
|
|
90
|
+
- `PP\FileManager\UploadFile`
|
|
91
|
+
- upload size and type restrictions
|
|
92
|
+
- rename, replace, and delete flows
|
|
93
|
+
- choosing between a rendered upload page and a direct upload handler
|
|
94
|
+
- validating non-file request values with `PP\Validator`
|
|
120
95
|
|
|
121
|
-
|
|
96
|
+
After reading `file-manager.md`, read `validator.md` when non-file request values are involved, then verify the matching official docs at:
|
|
122
97
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
```
|
|
98
|
+
1. `get-started-file`
|
|
99
|
+
2. `php-validator` when auxiliary request validation is needed
|
|
100
|
+
3. `route-php` or `pages-and-layouts` depending on whether the task is a direct handler or a full-stack page
|
|
127
101
|
|
|
128
|
-
|
|
102
|
+
## Authentication
|
|
129
103
|
|
|
130
|
-
|
|
104
|
+
Prisma PHP includes a documented authentication model centered on sessions, route protection strategy, RBAC, and provider-based sign-in flows.
|
|
131
105
|
|
|
132
|
-
|
|
106
|
+
Use `authentication.md` as the local AI-awareness guide for:
|
|
133
107
|
|
|
134
|
-
|
|
108
|
+
- `AuthConfig.php`
|
|
109
|
+
- public-default vs private-default route strategy
|
|
110
|
+
- `Auth::signIn(...)`
|
|
111
|
+
- `Auth::signOut(...)`
|
|
112
|
+
- `refreshUserSession(...)`
|
|
113
|
+
- route-level RBAC
|
|
114
|
+
- function-level protection with `#[Exposed(allowedRoles: [...])]`
|
|
115
|
+
- credential authentication
|
|
116
|
+
- social authentication
|
|
135
117
|
|
|
136
|
-
|
|
137
|
-
- [Starter Kits](/docs): Learn how installation works, how starter kits are structured, and how to create your own.
|
|
138
|
-
- [PHPX](/docs): Learn the component model and how to build reusable UI with PHP-first syntax.
|
|
139
|
-
- [ORM](/docs): Learn Prisma config, database setup, CLI usage, seeding, relations, reading, writing, filtering, aggregates, raw queries, transactions, and field selection.
|
|
140
|
-
- [API](/docs): Learn the API features and Swagger docs support.
|
|
141
|
-
- [AI](/docs): Learn the AI-related features, MCP support, and framework rules.
|
|
142
|
-
- [Additional Features](/docs): Explore file manager, pagination, debug tooling, websocket support, and email.
|
|
143
|
-
- [PulsePoint Runtime Rules](./pulsepoint): Learn the approved PulsePoint runtime surface, directives, refs, effects, and frontend reactive patterns AI should follow.
|
|
118
|
+
After reading `authentication.md`, verify the matching official docs in this order:
|
|
144
119
|
|
|
145
|
-
|
|
120
|
+
1. `auth-get-started`
|
|
121
|
+
2. `credentials`
|
|
122
|
+
3. `state-manager-auth`
|
|
146
123
|
|
|
147
|
-
##
|
|
124
|
+
## Routing and file conventions
|
|
148
125
|
|
|
149
|
-
Prisma PHP
|
|
126
|
+
Prisma PHP uses file-based routing.
|
|
150
127
|
|
|
151
|
-
|
|
152
|
-
- **PulsePoint reactivity**: Use browser-resident state and reactive UI patterns directly in your pages.
|
|
153
|
-
- **Prisma ORM**: Query your database with a type-safe developer experience.
|
|
154
|
-
- **PHPX UI approach**: Build reusable components with HTML-like syntax and server-rendered ergonomics.
|
|
155
|
-
- **Routing and file conventions**: Follow Next.js-style routing concepts adapted for Prisma PHP.
|
|
156
|
-
|
|
157
|
-
This combination lets you keep your backend and frontend closer together, with less transformation and less glue code between server data and interactive UI.
|
|
158
|
-
|
|
159
|
-
## Routing and application structure
|
|
160
|
-
|
|
161
|
-
Prisma PHP includes a documented routing system with dedicated pages for:
|
|
162
|
-
|
|
163
|
-
- Routing Fundamentals
|
|
164
|
-
- Defining Routes
|
|
165
|
-
- Pages and Layouts
|
|
166
|
-
- Redirects
|
|
167
|
-
- Route Groups
|
|
168
|
-
- Private Folders
|
|
169
|
-
- Dynamic Routes
|
|
170
|
-
- Middleware
|
|
171
|
-
|
|
172
|
-
It also defines file conventions such as:
|
|
128
|
+
Important files include:
|
|
173
129
|
|
|
174
130
|
- `index.php`
|
|
175
131
|
- `layout.php`
|
|
@@ -183,61 +139,19 @@ Routes are created from the `src/app` folder structure and route files. AI agent
|
|
|
183
139
|
|
|
184
140
|
If you are changing route behavior or navigation patterns, read the routing documentation first.
|
|
185
141
|
|
|
186
|
-
## Data
|
|
142
|
+
## Data and reactivity
|
|
187
143
|
|
|
188
144
|
One of Prisma PHP’s core ideas is keeping data flow simple across the stack:
|
|
189
145
|
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
146
|
+
- Query data with Prisma ORM in PHP
|
|
147
|
+
- Render full-stack UI directly from route files
|
|
148
|
+
- Use PulsePoint for frontend reactivity
|
|
149
|
+
- Use `pp.fetchFunction(...)` for reactive frontend-to-server calls
|
|
150
|
+
- Expose callable PHP functions with `#[Exposed]`
|
|
151
|
+
- Validate incoming request data with `PP\Validator`
|
|
195
152
|
|
|
196
153
|
This makes it easier to build interactive applications without maintaining separate DTO layers, excessive transformation code, or client-heavy hydration logic.
|
|
197
154
|
|
|
198
|
-
When
|
|
199
|
-
|
|
200
|
-
When a task involves Prisma ORM setup or schema changes, read `prisma-php-orm.md` first. That document should be the source of truth for:
|
|
201
|
-
|
|
202
|
-
- confirming whether the project is using SQLite, MySQL, PostgreSQL, or another configured provider
|
|
203
|
-
- reading `.env` and validating `DATABASE_URL` before making ORM setup assumptions
|
|
204
|
-
- resolving the correct database setup path for the configured provider
|
|
205
|
-
- understanding when to run `npx prisma migrate dev`
|
|
206
|
-
- understanding when to run `npx ppo generate`
|
|
207
|
-
- avoiding the mistake of treating generated PHP classes as proof that the database is already initialized
|
|
208
|
-
- avoiding the mistake of treating project update commands as ORM sync commands
|
|
209
|
-
|
|
210
|
-
When a task involves frontend interaction that needs server data or mutations, prefer the documented Prisma PHP pattern of PulsePoint reactive state plus `pp.fetchFunction(...)` before inventing custom endpoint flows.
|
|
211
|
-
|
|
212
|
-
## Pre-requisite knowledge
|
|
213
|
-
|
|
214
|
-
Our documentation assumes some familiarity with web development. Before getting started, it helps if you are comfortable with:
|
|
215
|
-
|
|
216
|
-
- PHP
|
|
217
|
-
- HTML
|
|
218
|
-
- CSS
|
|
219
|
-
- JavaScript
|
|
220
|
-
- Databases and basic ORM concepts
|
|
221
|
-
|
|
222
|
-
Familiarity with reactive UI concepts is also useful when working with PulsePoint-powered interfaces.
|
|
223
|
-
|
|
224
|
-
## Documentation philosophy
|
|
225
|
-
|
|
226
|
-
Prisma PHP evolves quickly, and framework behavior may differ across versions.
|
|
227
|
-
|
|
228
|
-
If you are an AI coding agent or working with generated code:
|
|
229
|
-
|
|
230
|
-
- do not rely on assumptions from other PHP frameworks
|
|
231
|
-
- do not assume Laravel, Symfony, or Next.js behavior maps directly
|
|
232
|
-
- do not guess file conventions, routing behavior, or Prisma workflow
|
|
233
|
-
- always read the relevant local documentation for the installed version before making changes
|
|
234
|
-
- always read `pulsepoint.md` before generating PulsePoint-specific reactive UI code
|
|
235
|
-
- always read `prisma-php-orm.md` before making database-provider, `.env`, migration, or ORM generation decisions
|
|
236
|
-
- always follow Prisma PHP XML-style syntax rules when generating PHPX or template markup
|
|
237
|
-
- never manually maintain framework-generated route listing files such as `files-list.json`
|
|
238
|
-
|
|
239
|
-
The installed documentation should be treated as the source of truth.
|
|
240
|
-
|
|
241
|
-
## Join the community
|
|
155
|
+
When Prisma ORM data is loaded in `index.php`, treat normal query results as the model-shaped objects returned by the generated Prisma PHP classes that follow `prisma/schema.prisma`.
|
|
242
156
|
|
|
243
|
-
|
|
157
|
+
Do not introduce defensive serializer layers by default just to make normal ORM results usable. Use `PP\Validator` for incoming payload validation, sanitization, casting, and rule-based checks. Only add a presentation mapper when you intentionally need a client-facing shape, such as flattening included relations, hiding sensitive fields, or formatting values for display.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Layouts and Pages
|
|
3
|
-
description: Learn how to create your first pages and layouts in Prisma PHP,
|
|
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.
|
|
4
4
|
related:
|
|
5
5
|
title: API Reference
|
|
6
|
-
description: Learn more about the features mentioned in this page by reading the Prisma PHP routing documentation.
|
|
6
|
+
description: Learn more about the features mentioned in this page by reading the Prisma PHP routing and PulsePoint documentation.
|
|
7
7
|
links:
|
|
8
8
|
- /docs/pages-and-layouts
|
|
9
9
|
- /docs/defining-routes
|
|
@@ -11,6 +11,7 @@ related:
|
|
|
11
11
|
- /docs/private-folders
|
|
12
12
|
- /docs/dynamic-route
|
|
13
13
|
- /docs/index-php
|
|
14
|
+
- /docs/pulsepoint
|
|
14
15
|
- /docs/route-php
|
|
15
16
|
---
|
|
16
17
|
|
|
@@ -28,7 +29,7 @@ When adding a page or nested route, create the correct folder and add the proper
|
|
|
28
29
|
|
|
29
30
|
Prisma PHP has two important route entry files, and they serve different purposes.
|
|
30
31
|
|
|
31
|
-
- `index.php` is the **UI entry point** for a route. Use it when the route should render HTML or a normal full-stack page.
|
|
32
|
+
- `index.php` is the **UI entry point** for a route. Use it when the route should render HTML or a normal full-stack page. In full-stack projects, this is also the default home for route-local PulsePoint-driven interactivity.
|
|
32
33
|
- `route.php` is the **direct handler entry point** for a route. Use it when the route should behave like an API endpoint, JSON endpoint, AJAX handler, form-processing endpoint, or other no-view server handler.
|
|
33
34
|
|
|
34
35
|
A helpful project-level rule comes from `prisma-php.json`:
|
|
@@ -44,7 +45,56 @@ For the example project configuration below, `backendOnly` is `false`, so the de
|
|
|
44
45
|
}
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
If the user asks for a **route or page**, prefer `index.php`. If the user asks for an **API route**, direct handler, JSON endpoint, webhook, or AJAX route, prefer `route.php`.
|
|
48
|
+
If the user asks for a **route or page**, prefer `index.php`. If the user asks for an **API route**, direct handler, JSON endpoint, webhook, or AJAX route, prefer `route.php`. Do not default to a PHP-only interaction style for normal page behavior when PulsePoint inside `index.php` is the better fit.
|
|
49
|
+
|
|
50
|
+
## PulsePoint-aware file structure for `index.php` and `layout.php`
|
|
51
|
+
|
|
52
|
+
For normal interactive full-stack routes, the default Prisma PHP mental model should be:
|
|
53
|
+
|
|
54
|
+
1. page UI in `index.php`
|
|
55
|
+
2. browser-side state in PulsePoint
|
|
56
|
+
3. route-local server calls through `pp.fetchFunction(...)`
|
|
57
|
+
4. backend validation through `PP\Validator`
|
|
58
|
+
|
|
59
|
+
Only shift to a more PHP-only pattern when the user explicitly asks for it or when the route is intentionally non-reactive.
|
|
60
|
+
|
|
61
|
+
When `index.php` or `layout.php` includes PulsePoint, keep the file in this order:
|
|
62
|
+
|
|
63
|
+
1. PHP
|
|
64
|
+
2. HTML
|
|
65
|
+
3. SCRIPT
|
|
66
|
+
|
|
67
|
+
In practice, that means:
|
|
68
|
+
|
|
69
|
+
- put imports, server-side queries, request access, helper functions, and exposed PHP functions in the top PHP block
|
|
70
|
+
- render the route markup after the PHP block
|
|
71
|
+
- place one PulsePoint `<script>` block at the bottom of the file
|
|
72
|
+
|
|
73
|
+
For the HTML portion, keep a **single parent HTML tag** around the route content, similar to React's single-root component rule.
|
|
74
|
+
|
|
75
|
+
- In `index.php`, wrap the page UI in one parent element such as `<main>`, `<section>`, or `<article>`.
|
|
76
|
+
- In nested `layout.php`, wrap the shared layout UI and `<?= MainLayout::$children; ?>` in one parent element.
|
|
77
|
+
- The root `layout.php` is the document shell and is the only layout that should contain `<html>` and `<body>`. Inside `<body>`, keep one clear wrapper around `<?= MainLayout::$children; ?>` when PulsePoint behavior is present.
|
|
78
|
+
|
|
79
|
+
Example PulsePoint page structure:
|
|
80
|
+
|
|
81
|
+
```php filename="src/app/dashboard/index.php"
|
|
82
|
+
<?php
|
|
83
|
+
|
|
84
|
+
$title = 'Dashboard';
|
|
85
|
+
?>
|
|
86
|
+
<section class="dashboard-page">
|
|
87
|
+
<h1><?= htmlspecialchars($title); ?></h1>
|
|
88
|
+
<p>Count: {count}</p>
|
|
89
|
+
<button onclick="setCount(count + 1)">Increment</button>
|
|
90
|
+
</section>
|
|
91
|
+
|
|
92
|
+
<script>
|
|
93
|
+
const [count, setCount] = pp.state(0);
|
|
94
|
+
</script>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
This order keeps server logic, rendered markup, and client reactivity easy to scan for both humans and AI tools.
|
|
48
98
|
|
|
49
99
|
## Creating a page
|
|
50
100
|
|
|
@@ -88,6 +138,7 @@ For example, to create a root layout:
|
|
|
88
138
|
```
|
|
89
139
|
|
|
90
140
|
The root layout is defined at the top level of your app directory and wraps the content for the entire application.
|
|
141
|
+
If this root layout uses PulsePoint, keep the same file order: PHP first, then the document HTML, then a single `<script>` block near the end of `<body>`.
|
|
91
142
|
|
|
92
143
|
## Creating a nested route
|
|
93
144
|
|
|
@@ -159,6 +210,7 @@ src/app/
|
|
|
159
210
|
```
|
|
160
211
|
|
|
161
212
|
If you combine both layouts, the root layout wraps the blog layout, and the blog layout wraps both `src/app/blog/index.php` and `src/app/blog/[slug]/index.php`.
|
|
213
|
+
Nested layouts should behave like single-root route views: one parent element should wrap the shared layout UI and `MainLayout::$children;`.
|
|
162
214
|
|
|
163
215
|
## Creating a dynamic segment
|
|
164
216
|
|
|
@@ -283,6 +335,8 @@ echo json_encode([
|
|
|
283
335
|
- If a user asks for an API route or direct handler, prefer `route.php`.
|
|
284
336
|
- The root layout is required and should contain the global HTML document structure.
|
|
285
337
|
- Only the root layout should contain `<html>` and `<body>` tags.
|
|
338
|
+
- When `index.php` or `layout.php` uses PulsePoint, structure the file as PHP, then HTML, then one `<script>` block.
|
|
339
|
+
- `index.php` and nested `layout.php` should render one parent HTML element; only the root layout should contain `<html>` and `<body>`.
|
|
286
340
|
- Layouts can be nested by placing `layout.php` files inside route folders.
|
|
287
341
|
- Dynamic route parameters are available through `Request::$dynamicParams`.
|
|
288
342
|
- Route groups let you organize routes and assign different layouts without affecting the URL.
|
|
@@ -39,6 +39,7 @@ vendor/tsnc/prisma-php/src/Validator.php
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
`Validator` is the server-side validation layer for user input. It is not the ORM result layer.
|
|
42
|
+
For the full local validation contract, helper overview, and rule patterns, read `validator.md`.
|
|
42
43
|
|
|
43
44
|
Use this split:
|
|
44
45
|
|
|
@@ -59,13 +59,22 @@ If an AI agent is working on the project, it should inspect `prisma-php.json` be
|
|
|
59
59
|
|
|
60
60
|
One of the most important capability flags is `backendOnly`.
|
|
61
61
|
|
|
62
|
-
- When `backendOnly` is `false`, the project is a **full-stack Prisma PHP app**. In that mode, normal route UI should be implemented with `index.php`.
|
|
62
|
+
- When `backendOnly` is `false`, the project is a **full-stack Prisma PHP app**. In that mode, normal route UI should be implemented with `index.php`, and interactive page behavior should usually be implemented with PulsePoint plus `pp.fetchFunction(...)`.
|
|
63
63
|
- When `backendOnly` is `true`, the project is a **backend-only Prisma PHP app**. In that mode, route behavior will usually center on direct handlers such as `route.php`.
|
|
64
|
-
- If a `route.php` file exists at a route segment, it acts as the direct handler entry point for that route and should be treated as the API-style or no-view path for that segment.
|
|
64
|
+
- If a `route.php` file exists at a route segment, it acts as the direct handler entry point for that route and should be treated as the API-style or no-view path for that segment, not as the default destination for ordinary route-local interactivity.
|
|
65
65
|
- In full-stack projects, if the user asks for a normal route or page, prefer `index.php`. If the user asks for an API route, JSON endpoint, form-processing endpoint, AJAX endpoint, or direct handler, prefer `route.php`.
|
|
66
66
|
|
|
67
67
|
This helps AI and contributors choose the correct file without guessing based on other frameworks.
|
|
68
68
|
|
|
69
|
+
For AI-assisted generation, the default full-stack route pattern should be:
|
|
70
|
+
|
|
71
|
+
1. render page UI in `index.php`
|
|
72
|
+
2. keep browser interactivity in PulsePoint
|
|
73
|
+
3. use `pp.fetchFunction(...)` for frontend-to-PHP calls that belong to the page
|
|
74
|
+
4. use `route.php` only when the behavior must exist as a standalone handler or API-style endpoint
|
|
75
|
+
|
|
76
|
+
Only prefer a more PHP-only interaction pattern when the user explicitly asks for it.
|
|
77
|
+
|
|
69
78
|
### Framework-managed generated files
|
|
70
79
|
|
|
71
80
|
Some files in a Prisma PHP project are framework-managed and should not be manually maintained as part of normal route work.
|
|
@@ -42,9 +42,13 @@ When PulsePoint is used inside a Prisma PHP application, the default full-stack
|
|
|
42
42
|
- `#[Exposed]` on PHP functions or methods that the frontend should be allowed to call
|
|
43
43
|
- `PP\Validator` on the PHP side for authoritative input validation and normalization
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
For normal interactive Prisma PHP page work, AI should treat this as the **default implementation path**, not as an optional enhancement. Choose a more PHP-only interaction style only when the user explicitly asks for it or when the route is intentionally non-reactive.
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
Do not invent parallel client/server patterns when the built-in Prisma PHP RPC flow already fits the task. In typical Prisma PHP page work, prefer PulsePoint plus `pp.fetchFunction(...)` over ad hoc API wiring, manual JSON fetch boilerplate, or PHP-only interaction patterns that the user did not request.
|
|
48
|
+
|
|
49
|
+
If the PulsePoint code lives inside Prisma PHP `index.php` or `layout.php`, also follow the route-file structure rules from `layouts-and-pages.md`: PHP first, HTML second, one `<script>` block last, and a single parent HTML element for normal route content.
|
|
50
|
+
|
|
51
|
+
Use `route.php` only when you explicitly need a standalone endpoint such as a webhook, public JSON route, external integration endpoint, or other no-view handler. Do not move normal route-local interactivity into `route.php` by default.
|
|
48
52
|
|
|
49
53
|
## Validation boundary
|
|
50
54
|
|
|
@@ -139,7 +143,9 @@ If any assumption conflicts with the official PulsePoint docs, follow the PulseP
|
|
|
139
143
|
|
|
140
144
|
## File layout rules
|
|
141
145
|
|
|
142
|
-
For PulsePoint runtime code, keep a predictable layout
|
|
146
|
+
For PulsePoint runtime code, keep a predictable layout.
|
|
147
|
+
|
|
148
|
+
### Standalone runtime snippet order
|
|
143
149
|
|
|
144
150
|
1. HTML markup first
|
|
145
151
|
2. One `<script>` block at the bottom
|
|
@@ -161,10 +167,43 @@ Example:
|
|
|
161
167
|
</script>
|
|
162
168
|
```
|
|
163
169
|
|
|
170
|
+
### Prisma PHP route file order
|
|
171
|
+
|
|
172
|
+
When PulsePoint is used inside Prisma PHP `index.php` or `layout.php` files, keep this order:
|
|
173
|
+
|
|
174
|
+
1. PHP
|
|
175
|
+
2. HTML
|
|
176
|
+
3. SCRIPT
|
|
177
|
+
|
|
178
|
+
Example:
|
|
179
|
+
|
|
180
|
+
```php filename="src/app/dashboard/index.php"
|
|
181
|
+
<?php
|
|
182
|
+
|
|
183
|
+
$title = "Dashboard";
|
|
184
|
+
?>
|
|
185
|
+
<section class="dashboard-page">
|
|
186
|
+
<h1><?= htmlspecialchars($title); ?></h1>
|
|
187
|
+
<p>Count: {count}</p>
|
|
188
|
+
<button onclick="setCount(count + 1)">Increment</button>
|
|
189
|
+
</section>
|
|
190
|
+
|
|
191
|
+
<script>
|
|
192
|
+
const [count, setCount] = pp.state(0);
|
|
193
|
+
</script>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Additional Prisma PHP route rules:
|
|
197
|
+
|
|
198
|
+
- `index.php` and nested `layout.php` should render a single parent HTML element.
|
|
199
|
+
- Treat them like single-root route views; do not emit multiple sibling root nodes for normal PulsePoint pages.
|
|
200
|
+
- The root `layout.php` is the only file that should define `<html>`, `<head>`, and `<body>`.
|
|
201
|
+
- When the root layout uses PulsePoint, keep the script block near the end of `<body>` and keep `MainLayout::$children;` inside one clear wrapper element.
|
|
202
|
+
|
|
164
203
|
Rules:
|
|
165
204
|
|
|
166
|
-
- Use **exactly one** `<script>` block per page or component unless the project explicitly requires something else.
|
|
167
|
-
- Place the script block **after** the markup.
|
|
205
|
+
- Use **exactly one** `<script>` block per page, layout, or component unless the project explicitly requires something else.
|
|
206
|
+
- Place the script block **after** the markup. In Prisma PHP route files, that means after the HTML section.
|
|
168
207
|
- JavaScript should only reference data that already exists when the script runs.
|
|
169
208
|
- Do not scatter PulsePoint runtime logic across multiple disconnected script blocks unless the docs or project structure explicitly requires it.
|
|
170
209
|
|
|
@@ -410,6 +449,7 @@ When a user asks for PulsePoint code, the AI should:
|
|
|
410
449
|
3. Separate frontend PulsePoint behavior from backend implementation details.
|
|
411
450
|
4. Avoid claiming a PulsePoint feature exists unless the docs support it.
|
|
412
451
|
5. Prefer working examples that are ready to paste into a project.
|
|
452
|
+
6. If the code lives in `index.php` or `layout.php`, use PHP, then HTML, then one `<script>` block, and keep a single parent HTML element for route content.
|
|
413
453
|
|
|
414
454
|
A good PulsePoint answer should feel:
|
|
415
455
|
|
|
@@ -7,6 +7,7 @@ related:
|
|
|
7
7
|
description: Learn more about route handlers in Prisma PHP.
|
|
8
8
|
links:
|
|
9
9
|
- /docs/route-php
|
|
10
|
+
- /docs/php-validator
|
|
10
11
|
- /docs/index-php
|
|
11
12
|
- /docs/pages-and-layouts
|
|
12
13
|
---
|
|
@@ -109,6 +110,7 @@ A good handler pattern is:
|
|
|
109
110
|
5. return structured JSON for expected validation failures
|
|
110
111
|
|
|
111
112
|
This keeps the handler consistent whether the request came from a form, a `fetch()` call, or another client.
|
|
113
|
+
For the full local validation guidance, read `validator.md` alongside this page.
|
|
112
114
|
|
|
113
115
|
## Request Helper
|
|
114
116
|
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Validator
|
|
3
|
+
description: Learn how Prisma PHP validation works so AI agents can sanitize, cast, and validate request data with PP\Validator and the documented Rule workflow instead of inventing custom validation patterns.
|
|
4
|
+
related:
|
|
5
|
+
title: Related docs
|
|
6
|
+
description: Read the official Prisma PHP Validator docs before generating or editing validation code.
|
|
7
|
+
links:
|
|
8
|
+
- /docs/php-validator
|
|
9
|
+
- /docs/fetch-function
|
|
10
|
+
- /docs/route-php
|
|
11
|
+
- /docs/error-handler
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
Prisma PHP validation should follow the documented `PP\Validator` model, not assumptions copied from Laravel FormRequest, Symfony Validator, Joi, Yup, Zod, or ad hoc request-wrapper patterns.
|
|
15
|
+
|
|
16
|
+
If a task involves sanitization, casting, validation rules, `Rule`, `Validator::withRules(...)`, request normalization, or expected validation failures, AI agents should read the relevant Prisma PHP Validator docs first and keep the implementation aligned with the installed Prisma PHP version.
|
|
17
|
+
|
|
18
|
+
## AI rule: read the Validator docs first
|
|
19
|
+
|
|
20
|
+
Before generating, editing, or reviewing validation code, use this order:
|
|
21
|
+
|
|
22
|
+
1. Read `./prisma-php.json`.
|
|
23
|
+
2. Read the installed local docs in `node_modules/prisma-php/dist/docs`.
|
|
24
|
+
3. Read this `validator.md` file.
|
|
25
|
+
4. Inspect the current `index.php`, `layout.php`, exposed function, or `route.php` that receives the data.
|
|
26
|
+
5. Inspect the payload shape and expected response contract.
|
|
27
|
+
6. Inspect Prisma PHP core internals only when the docs do not answer the task.
|
|
28
|
+
|
|
29
|
+
Do not assume another framework's validation lifecycle applies directly.
|
|
30
|
+
|
|
31
|
+
## Read this doc when you need
|
|
32
|
+
|
|
33
|
+
- **sanitization, casting, normalization, `PP\Validator`, `Rule`, or `Validator::withRules(...)`** → `validator.md`
|
|
34
|
+
- **interactive validation with `pp.fetchFunction(...)` inside page routes** → `fetching-data.md` plus `validator.md`
|
|
35
|
+
- **request validation in `route.php`** → `route-handlers.md` plus `validator.md`
|
|
36
|
+
- **expected validation failures and response shaping** → `error-handling.md` plus `validator.md`
|
|
37
|
+
- **credentials, registration, login, or auth form validation** → `authentication.md` plus `validator.md`
|
|
38
|
+
- **rename fields, labels, or other non-file request values in upload flows** → `file-manager.md` plus `validator.md`
|
|
39
|
+
|
|
40
|
+
## Core validation model AI should follow
|
|
41
|
+
|
|
42
|
+
The official Prisma PHP Validator docs describe `PP\Validator` as the central server-side validation layer.
|
|
43
|
+
|
|
44
|
+
Use this split:
|
|
45
|
+
|
|
46
|
+
- use **PulsePoint** or browser-side logic for local UX only
|
|
47
|
+
- use **`PP\Validator`** on the PHP side for authoritative sanitization, casting, and validation
|
|
48
|
+
- use **`PP\Rule`** when business constraints must be checked declaratively
|
|
49
|
+
- return structured failures for expected validation problems instead of treating them like crashes
|
|
50
|
+
|
|
51
|
+
`Validator` is not the ORM result layer, not a frontend schema runtime, and not a replacement for route or function structure.
|
|
52
|
+
|
|
53
|
+
## Exact core file location
|
|
54
|
+
|
|
55
|
+
The Prisma PHP core `Validator` class lives here:
|
|
56
|
+
|
|
57
|
+
```txt
|
|
58
|
+
vendor/tsnc/prisma-php/src/Validator.php
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
When AI needs to inspect framework internals because the docs do not fully answer a validation task, this is the exact core file to review.
|
|
62
|
+
|
|
63
|
+
## Identity and string helpers
|
|
64
|
+
|
|
65
|
+
The official docs describe these common helpers:
|
|
66
|
+
|
|
67
|
+
- `string($value, bool $escapeHtml = true): string`
|
|
68
|
+
- `email($value): ?string`
|
|
69
|
+
- `url($value): ?string`
|
|
70
|
+
- `ip($value): ?string`
|
|
71
|
+
- `uuid($value): ?string`
|
|
72
|
+
- `ulid($value): ?string`
|
|
73
|
+
- `cuid($value): ?string`
|
|
74
|
+
- `cuid2($value): ?string`
|
|
75
|
+
- `emojis(string $content): string`
|
|
76
|
+
|
|
77
|
+
Use these helpers when the goal is to normalize or validate a single incoming value before applying additional rules.
|
|
78
|
+
|
|
79
|
+
## Number and utility helpers
|
|
80
|
+
|
|
81
|
+
The official docs also describe:
|
|
82
|
+
|
|
83
|
+
- `int($value): ?int`
|
|
84
|
+
- `float($value): ?float`
|
|
85
|
+
- `bigInt($value): ?BigInteger`
|
|
86
|
+
- `decimal($value, int $scale = 30): ?BigDecimal`
|
|
87
|
+
- `bytes($value): ?string`
|
|
88
|
+
- `boolean($value): ?bool`
|
|
89
|
+
- `json($value): string`
|
|
90
|
+
- `enum($value, array $allowed): bool`
|
|
91
|
+
- `enumClass($value, string $class)`
|
|
92
|
+
- `date($value, string $format = "Y-m-d"): ?string`
|
|
93
|
+
- `dateTime($value, string $format = "Y-m-d H:i:s"): ?string`
|
|
94
|
+
|
|
95
|
+
Important behavior to remember:
|
|
96
|
+
|
|
97
|
+
- many helper methods return `null` when the value is invalid
|
|
98
|
+
- `enum(...)` checks membership against a simple allowed array
|
|
99
|
+
- `json(...)` accepts JSON strings or safely encodes arrays
|
|
100
|
+
- `boolean(...)` performs smart casting for values such as `"true"`, `"1"`, `"on"`, and `"yes"`
|
|
101
|
+
|
|
102
|
+
## Rule-based validation
|
|
103
|
+
|
|
104
|
+
The main rule-based entry point is:
|
|
105
|
+
|
|
106
|
+
```php
|
|
107
|
+
Validator::withRules($value, string|Rule|array $rules, $confirm = null)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Return contract:
|
|
111
|
+
|
|
112
|
+
- `true` when all rules pass
|
|
113
|
+
- `string` when the first rule fails
|
|
114
|
+
|
|
115
|
+
Always use a strict success check:
|
|
116
|
+
|
|
117
|
+
```php
|
|
118
|
+
if ($result === true) {
|
|
119
|
+
// valid
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Recommended rule syntax
|
|
124
|
+
|
|
125
|
+
The official docs support three rule styles.
|
|
126
|
+
|
|
127
|
+
### 1. Rule builder, recommended
|
|
128
|
+
|
|
129
|
+
This is the preferred style for most application code because it is easier to discover, safer to refactor, and clearer in reviews.
|
|
130
|
+
|
|
131
|
+
```php
|
|
132
|
+
use PP\Rule;
|
|
133
|
+
|
|
134
|
+
$rules = Rule::required()
|
|
135
|
+
->min(3)
|
|
136
|
+
->max(50)
|
|
137
|
+
->startsWith('J');
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 2. Pipe string syntax
|
|
141
|
+
|
|
142
|
+
Useful for small inline rules or dynamic rules loaded from config.
|
|
143
|
+
|
|
144
|
+
```php
|
|
145
|
+
$rules = 'required|min:3|max:50';
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 3. Array syntax
|
|
149
|
+
|
|
150
|
+
Useful when rules need to be appended conditionally.
|
|
151
|
+
|
|
152
|
+
```php
|
|
153
|
+
$rules = ['required', 'min:8'];
|
|
154
|
+
$rules[] = 'confirmed';
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Common documented rules
|
|
158
|
+
|
|
159
|
+
The official docs list rules such as:
|
|
160
|
+
|
|
161
|
+
- `required`
|
|
162
|
+
- `min:n`
|
|
163
|
+
- `max:n`
|
|
164
|
+
- `size:n`
|
|
165
|
+
- `between:min,max`
|
|
166
|
+
- `email`
|
|
167
|
+
- `url`
|
|
168
|
+
- `ip`
|
|
169
|
+
- `uuid`
|
|
170
|
+
- `ulid`
|
|
171
|
+
- `cuid`
|
|
172
|
+
- `int`
|
|
173
|
+
- `float`
|
|
174
|
+
- `boolean`
|
|
175
|
+
- `startsWith:value`
|
|
176
|
+
- `endsWith:value`
|
|
177
|
+
- `confirmed`
|
|
178
|
+
- `in:a,b,c`
|
|
179
|
+
- `notIn:a,b,c`
|
|
180
|
+
- `date:format`
|
|
181
|
+
- `dateFormat:format`
|
|
182
|
+
- `before:date`
|
|
183
|
+
- `after:date`
|
|
184
|
+
- `json`
|
|
185
|
+
- `timezone`
|
|
186
|
+
- `regex:pattern`
|
|
187
|
+
- `digits:n`
|
|
188
|
+
- `digitsBetween:min,max`
|
|
189
|
+
- `extensions:jpg,png`
|
|
190
|
+
- `mimes:image/jpeg,image/png`
|
|
191
|
+
- `file`
|
|
192
|
+
|
|
193
|
+
AI should not invent undocumented rule names when these already cover the common Prisma PHP validation workflow.
|
|
194
|
+
|
|
195
|
+
## Recommended example patterns
|
|
196
|
+
|
|
197
|
+
### Basic casting and validation
|
|
198
|
+
|
|
199
|
+
```php
|
|
200
|
+
<?php
|
|
201
|
+
|
|
202
|
+
use PP\Validator;
|
|
203
|
+
|
|
204
|
+
$name = Validator::string($_POST['name'] ?? '');
|
|
205
|
+
$age = Validator::int($_POST['age'] ?? null);
|
|
206
|
+
$email = Validator::email($_POST['email'] ?? '');
|
|
207
|
+
|
|
208
|
+
if ($email === null) {
|
|
209
|
+
return [
|
|
210
|
+
'success' => false,
|
|
211
|
+
'errors' => [
|
|
212
|
+
'email' => 'A valid email address is required.',
|
|
213
|
+
],
|
|
214
|
+
];
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Rule builder, recommended
|
|
219
|
+
|
|
220
|
+
```php
|
|
221
|
+
<?php
|
|
222
|
+
|
|
223
|
+
use PP\Rule;
|
|
224
|
+
use PP\Validator;
|
|
225
|
+
|
|
226
|
+
$username = Validator::string($_POST['username'] ?? '');
|
|
227
|
+
|
|
228
|
+
$result = Validator::withRules(
|
|
229
|
+
$username,
|
|
230
|
+
Rule::required()->min(3)->max(50)
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
if ($result !== true) {
|
|
234
|
+
return [
|
|
235
|
+
'success' => false,
|
|
236
|
+
'errors' => [
|
|
237
|
+
'username' => $result,
|
|
238
|
+
],
|
|
239
|
+
];
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Confirmation rule
|
|
244
|
+
|
|
245
|
+
```php
|
|
246
|
+
<?php
|
|
247
|
+
|
|
248
|
+
use PP\Validator;
|
|
249
|
+
|
|
250
|
+
$password = Validator::string($_POST['password'] ?? '', false);
|
|
251
|
+
$confirm = Validator::string($_POST['password_confirmation'] ?? '', false);
|
|
252
|
+
|
|
253
|
+
$result = Validator::withRules($password, ['required', 'min:8', 'confirmed'], $confirm);
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Operational notes
|
|
257
|
+
|
|
258
|
+
- use `=== true` when checking `Validator::withRules(...)`
|
|
259
|
+
- use the third parameter for `confirmed` comparisons
|
|
260
|
+
- pass full regex patterns with delimiters when using `regex`
|
|
261
|
+
- use array syntax when rules depend on runtime conditions
|
|
262
|
+
- apply validation before database writes, auth state changes, uploads, or other side effects
|
|
263
|
+
|
|
264
|
+
## Validation boundary
|
|
265
|
+
|
|
266
|
+
Keep these concerns separate:
|
|
267
|
+
|
|
268
|
+
- use **browser-side checks** for immediate feedback only
|
|
269
|
+
- use **`PP\Validator`** for authoritative backend validation
|
|
270
|
+
- use **`error-handling.md`** patterns for expected validation failures
|
|
271
|
+
- use **`fetching-data.md`** or **`route-handlers.md`** based on where the request enters PHP
|
|
272
|
+
|
|
273
|
+
Do not treat browser validation, HTML attributes, or frontend checks as the final source of truth.
|
|
274
|
+
|
|
275
|
+
## AI rules for validation work
|
|
276
|
+
|
|
277
|
+
- read the official Validator docs before generating validation code
|
|
278
|
+
- do not guess validation APIs from Laravel, Symfony, Joi, Yup, Zod, or other ecosystems
|
|
279
|
+
- prefer `PP\Validator` for sanitization, casting, and helper-based validation
|
|
280
|
+
- prefer the `Rule` builder for most rule-based validation
|
|
281
|
+
- do not assume `Validator::withRules(...)` throws exceptions for normal failures
|
|
282
|
+
- return structured validation results for expected user-input errors
|
|
283
|
+
- inspect `vendor/tsnc/prisma-php/src/Validator.php` only when the docs and current code are not enough
|
|
284
|
+
|
|
285
|
+
## Suggested file name
|
|
286
|
+
|
|
287
|
+
Use this file name:
|
|
288
|
+
|
|
289
|
+
```txt
|
|
290
|
+
validator.md
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
It is clear, consistent with the existing local docs set, and easy for AI agents to discover alongside files such as `authentication.md`, `file-manager.md`, and `route-handlers.md`.
|
package/package.json
CHANGED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Prisma PHP Docs
|
|
3
|
-
description: Welcome to the Prisma PHP Documentation.
|
|
4
|
-
related:
|
|
5
|
-
title: Next Steps
|
|
6
|
-
description: Create your first Prisma PHP application and learn the core framework features.
|
|
7
|
-
links:
|
|
8
|
-
- /docs/get-started
|
|
9
|
-
---
|
|
10
|
-
|
|
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 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 backend validation, sanitization, `Validator`, `Rule`, `pp.fetchFunction(...)` validation flows, or request validation in `route.php`, read `fetching-data.md`, `error-handling.md`, and `route-handlers.md`, 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. _/}
|
|
12
|
-
|
|
13
|
-
Welcome to the Prisma PHP documentation!
|
|
14
|
-
|
|
15
|
-
## What is Prisma PHP?
|
|
16
|
-
|
|
17
|
-
Prisma PHP is a full-stack PHP framework for building modern, reactive web applications.
|
|
18
|
-
|
|
19
|
-
You use native PHP to build your application, Prisma ORM for type-safe data access, and PulsePoint to add reactive browser state without the usual API glue or hydration-heavy workflow.
|
|
20
|
-
|
|
21
|
-
It is designed to give you a server-first development model with modern UI interactivity, reusable PHPX components, Next.js-style routing concepts adapted for Prisma PHP, and CLI tooling.
|
|
22
|
-
|
|
23
|
-
Whether you're building an internal dashboard, a content-rich platform, or a custom product, Prisma PHP helps you move fast while keeping your stack cohesive and expressive.
|
|
24
|
-
|
|
25
|
-
## AI quick start
|
|
26
|
-
|
|
27
|
-
If you are using AI-assisted development, do not guess framework behavior from other ecosystems.
|
|
28
|
-
|
|
29
|
-
Use this order:
|
|
30
|
-
|
|
31
|
-
1. Read `./prisma-php.json` first.
|
|
32
|
-
2. Read the relevant local docs in `node_modules/prisma-php/dist/docs`.
|
|
33
|
-
3. Inspect local project files.
|
|
34
|
-
4. Inspect `vendor/tsnc/prisma-php/src` only when framework internals are necessary.
|
|
35
|
-
|
|
36
|
-
### Read this doc when you need
|
|
37
|
-
|
|
38
|
-
- **project setup or file placement** → `project-structure.md`
|
|
39
|
-
- **pages, layouts, route creation, nested routes** → `layouts-and-pages.md`
|
|
40
|
-
- **PHPX components, props, children, fragments, icons, buttons, accordions, or component composition** → `components.md`
|
|
41
|
-
- **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`
|
|
42
|
-
- **authentication strategy, `AuthConfig.php`, sign-in, sign-out, route privacy model, RBAC, credentials auth, social login, or auth state manager usage** → `authentication.md`
|
|
43
|
-
- **`pp.fetchFunction(...)`, `#[Exposed]`, page data loading, interactive validation with `Validator`** → `fetching-data.md`
|
|
44
|
-
- **cache behavior and `CacheHandler`** → `caching.md`
|
|
45
|
-
- **ORM, `schema.prisma`, database provider, migrations, generated PHP classes, `prisma.config.ts`, `.env` `DATABASE_URL`, or Prisma CLI workflow** → `prisma-php-orm.md`
|
|
46
|
-
- **error handling, `error.php`, `not-found.php`, expected validation errors** → `error-handling.md`
|
|
47
|
-
- **metadata, title, description, favicon, icons** → `metadata-and-og-images.md`
|
|
48
|
-
- **API-style endpoints, `route.php`, request validation with `Validator`** → `route-handlers.md`
|
|
49
|
-
- **PulsePoint runtime APIs such as `pp.state`, `pp.effect`, `pp.ref`, `pp-for`, `pp-ref`, `pp-spread`** → `pulsepoint.md`
|
|
50
|
-
- **updating the project or enabling features** → `upgrading.md`
|
|
51
|
-
- **first-time project creation** → `installation.md`
|
|
52
|
-
|
|
53
|
-
### Important AI rules
|
|
54
|
-
|
|
55
|
-
- treat `node_modules/prisma-php/dist/docs` as the primary documentation source for the installed version
|
|
56
|
-
- do not assume Laravel, Symfony, React, Vue, Alpine, Livewire, or Next.js behavior maps directly
|
|
57
|
-
- do not guess routing, file conventions, request helpers, component APIs, reactive syntax, or auth behavior when local docs already define them
|
|
58
|
-
- create routes by adding folders and route files under `src/app`
|
|
59
|
-
- do not create, edit, or maintain `files-list.json`; Prisma PHP generates route listings automatically
|
|
60
|
-
- when building interactive frontend behavior, prefer the documented PulsePoint pattern with browser-side reactive state and `pp.fetchFunction(...)` for server calls
|
|
61
|
-
- when using `pp.fetchFunction(...)`, expose the PHP function explicitly with `#[Exposed]`
|
|
62
|
-
- when changing feature flags, update `prisma-php.json` first, then follow the documented update workflow
|
|
63
|
-
- when building reusable PHPX components, read `components.md` first
|
|
64
|
-
- 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
|
|
65
|
-
- 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
|
|
66
|
-
|
|
67
|
-
## File Manager
|
|
68
|
-
|
|
69
|
-
Prisma PHP includes a documented File Manager model for uploads and file operations based on standard PHP uploads plus `PP\FileManager\UploadFile`.
|
|
70
|
-
|
|
71
|
-
Use `file-manager.md` as the local AI-awareness guide for:
|
|
72
|
-
|
|
73
|
-
- upload forms with `multipart/form-data`
|
|
74
|
-
- `$_FILES` handling
|
|
75
|
-
- `PP\FileManager\UploadFile`
|
|
76
|
-
- upload size and type restrictions
|
|
77
|
-
- rename, replace, and delete flows
|
|
78
|
-
- choosing between a rendered upload page and a direct upload handler
|
|
79
|
-
- validating non-file request values with `PP\Validator`
|
|
80
|
-
|
|
81
|
-
After reading `file-manager.md`, verify the matching official docs at:
|
|
82
|
-
|
|
83
|
-
1. `get-started-file`
|
|
84
|
-
2. `php-validator` when auxiliary request validation is needed
|
|
85
|
-
3. `route-php` or `pages-and-layouts` depending on whether the task is a direct handler or a full-stack page
|
|
86
|
-
|
|
87
|
-
## Authentication
|
|
88
|
-
|
|
89
|
-
Prisma PHP includes a documented authentication model centered on sessions, route protection strategy, RBAC, and provider-based sign-in flows.
|
|
90
|
-
|
|
91
|
-
Use `authentication.md` as the local AI-awareness guide for:
|
|
92
|
-
|
|
93
|
-
- `AuthConfig.php`
|
|
94
|
-
- public-default vs private-default route strategy
|
|
95
|
-
- `Auth::signIn(...)`
|
|
96
|
-
- `Auth::signOut(...)`
|
|
97
|
-
- `refreshUserSession(...)`
|
|
98
|
-
- route-level RBAC
|
|
99
|
-
- function-level protection with `#[Exposed(allowedRoles: [...])]`
|
|
100
|
-
- credential authentication
|
|
101
|
-
- social authentication
|
|
102
|
-
|
|
103
|
-
After reading `authentication.md`, verify the matching official docs in this order:
|
|
104
|
-
|
|
105
|
-
1. `auth-get-started`
|
|
106
|
-
2. `credentials`
|
|
107
|
-
3. `state-manager-auth`
|
|
108
|
-
|
|
109
|
-
## Routing and file conventions
|
|
110
|
-
|
|
111
|
-
Prisma PHP uses file-based routing.
|
|
112
|
-
|
|
113
|
-
Important files include:
|
|
114
|
-
|
|
115
|
-
- `index.php`
|
|
116
|
-
- `layout.php`
|
|
117
|
-
- `loading.php`
|
|
118
|
-
- `route.php`
|
|
119
|
-
- `not-found.php`
|
|
120
|
-
- `error.php`
|
|
121
|
-
- metadata files and icons
|
|
122
|
-
|
|
123
|
-
Routes are created from the `src/app` folder structure and route files. AI agents should not try to register routes manually in framework-generated route list files.
|
|
124
|
-
|
|
125
|
-
If you are changing route behavior or navigation patterns, read the routing documentation first.
|
|
126
|
-
|
|
127
|
-
## Data and reactivity
|
|
128
|
-
|
|
129
|
-
One of Prisma PHP’s core ideas is keeping data flow simple across the stack:
|
|
130
|
-
|
|
131
|
-
- Query data with Prisma ORM in PHP
|
|
132
|
-
- Render full-stack UI directly from route files
|
|
133
|
-
- Use PulsePoint for frontend reactivity
|
|
134
|
-
- Use `pp.fetchFunction(...)` for reactive frontend-to-server calls
|
|
135
|
-
- Expose callable PHP functions with `#[Exposed]`
|
|
136
|
-
- Validate incoming request data with `PP\Validator`
|
|
137
|
-
|
|
138
|
-
This makes it easier to build interactive applications without maintaining separate DTO layers, excessive transformation code, or client-heavy hydration logic.
|
|
139
|
-
|
|
140
|
-
When Prisma ORM data is loaded in `index.php`, treat normal query results as the model-shaped objects returned by the generated Prisma PHP classes that follow `prisma/schema.prisma`.
|
|
141
|
-
|
|
142
|
-
Do not introduce defensive serializer layers by default just to make normal ORM results usable. Use `PP\Validator` for incoming payload validation, sanitization, casting, and rule-based checks. Only add a presentation mapper when you intentionally need a client-facing shape, such as flattening included relations, hiding sensitive fields, or formatting values for display.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/docs/{01-getting-started/metadata-and-og-images.md → metadata-and-og-images.md}
RENAMED
|
File without changes
|
|
File without changes
|