prisma-php 0.0.1 → 0.0.2

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.
@@ -8,7 +8,7 @@ related:
8
8
  - /docs/get-started
9
9
  ---
10
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 PulsePoint runtime behavior specifically, read `pulsepoint.md` before generating reactive UI code. For Prisma ORM work, read `prisma-php-orm.md` before choosing provider checks, schema workflow, migration commands, or ORM generation commands. 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._/}
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
12
 
13
13
  Welcome to the Prisma PHP documentation!
14
14
 
@@ -37,139 +37,80 @@ Use this order:
37
37
 
38
38
  - **project setup or file placement** → `project-structure.md`
39
39
  - **pages, layouts, route creation, nested routes** → `layouts-and-pages.md`
40
- - **`pp.fetchFunction(...)`, `#[Exposed]`, page data loading** → `fetching-data.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`
41
44
  - **cache behavior and `CacheHandler`** → `caching.md`
42
- - **Prisma ORM setup, database provider checks, `.env` validation, SQLite database path checks, schema workflow, migration flow, `npx prisma migrate dev`, `npx ppo generate`, and Prisma query patterns** → `prisma-php-orm.md`
43
- - **error handling, `error.php`, `not-found.php`** → `error-handling.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`
44
47
  - **metadata, title, description, favicon, icons** → `metadata-and-og-images.md`
45
- - **API-style endpoints and `route.php`** → `route-handlers.md`
48
+ - **API-style endpoints, `route.php`, request validation with `Validator`** → `route-handlers.md`
46
49
  - **PulsePoint runtime APIs such as `pp.state`, `pp.effect`, `pp.ref`, `pp-for`, `pp-ref`, `pp-spread`** → `pulsepoint.md`
47
- - **updating the project structure, installing enabled framework features, or refreshing project-managed files** → `upgrading.md`
50
+ - **updating the project or enabling features** → `upgrading.md`
51
+ - **first-time project creation** → `installation.md`
48
52
 
49
53
  ### Important AI rules
50
54
 
51
55
  - treat `node_modules/prisma-php/dist/docs` as the primary documentation source for the installed version
52
56
  - 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 ORM workflow when local docs already define them
57
+ - do not guess routing, file conventions, request helpers, component APIs, reactive syntax, or auth behavior when local docs already define them
54
58
  - create routes by adding folders and route files under `src/app`
55
59
  - do not create, edit, or maintain `files-list.json`; Prisma PHP generates route listings automatically
56
60
  - when building interactive frontend behavior, prefer the documented PulsePoint pattern with browser-side reactive state and `pp.fetchFunction(...)` for server calls
57
61
  - when using `pp.fetchFunction(...)`, expose the PHP function explicitly with `#[Exposed]`
58
- - for Prisma ORM work, confirm the configured database provider first before choosing setup or migration commands
59
- - for SQLite projects, read `.env`, confirm `DATABASE_URL` exists, resolve the SQLite database file path, and treat a missing, invalid, or not-yet-created SQLite database file as a signal to run `npx prisma migrate dev` before relying on generated ORM classes
60
- - for MySQL and PostgreSQL projects, run `npx prisma migrate dev` during first setup and whenever `schema.prisma` changes
61
- - after first ORM setup, and after any `schema.prisma` change, run `npx ppo generate` so the generated PHP classes match the database structure
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`
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
66
 
67
- ## Important PHPX and XML syntax rules
67
+ ## File Manager
68
68
 
69
- Prisma PHP uses **XML-style syntax** for PHPX and framework template markup.
69
+ Prisma PHP includes a documented File Manager model for uploads and file operations based on standard PHP uploads plus `PP\FileManager\UploadFile`.
70
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.
71
+ Use `file-manager.md` as the local AI-awareness guide for:
72
72
 
73
- ### Closing tags
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`
74
80
 
75
- All tags must be properly closed.
81
+ After reading `file-manager.md`, verify the matching official docs at:
76
82
 
77
- Correct:
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
78
86
 
79
- ```xml
80
- <hr />
81
- <input type="text" />
82
- <div></div>
83
- ```
87
+ ## Authentication
84
88
 
85
- Incorrect:
89
+ Prisma PHP includes a documented authentication model centered on sessions, route protection strategy, RBAC, and provider-based sign-in flows.
86
90
 
87
- ```xml
88
- <hr>
89
- <input type="text">
90
- ```
91
+ Use `authentication.md` as the local AI-awareness guide for:
91
92
 
92
- ### Attributes
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
93
102
 
94
- All attributes must use double quotes.
103
+ After reading `authentication.md`, verify the matching official docs in this order:
95
104
 
96
- Correct:
105
+ 1. `auth-get-started`
106
+ 2. `credentials`
107
+ 3. `state-manager-auth`
97
108
 
98
- ```xml
99
- <input required="true" />
100
- <input id="input" />
101
- ```
109
+ ## Routing and file conventions
102
110
 
103
- Incorrect:
111
+ Prisma PHP uses file-based routing.
104
112
 
105
- ```xml
106
- <input required />
107
- <input id=input />
108
- ```
109
-
110
- ### Boolean attributes
111
-
112
- Do not use shorthand boolean attributes in Prisma PHP markup. Write them explicitly.
113
-
114
- Correct:
115
-
116
- ```xml
117
- <input disabled="true" />
118
- <option selected="true">Admin</option>
119
- ```
120
-
121
- Incorrect:
122
-
123
- ```xml
124
- <input disabled />
125
- <option selected>Admin</option>
126
- ```
127
-
128
- ### AI rule
129
-
130
- When generating Prisma PHP markup, always treat it as **strict XML**, not permissive HTML and not JSX shorthand.
131
-
132
- ## How to use the docs
133
-
134
- The docs are organized into multiple sections so you can learn Prisma PHP progressively:
135
-
136
- - [Get Started](/docs): Learn the fundamentals, project structure, commands, tools, environment setup, routing, file conventions, HTML attributes, JavaScript usage, class usage, and authentication.
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.
144
-
145
- Use the sidebar to navigate through sections, or search with the command palette (`Ctrl+K`) to quickly find a page.
146
-
147
- ## Core framework areas
148
-
149
- Prisma PHP brings together a few major parts of the stack:
150
-
151
- - **Native PHP application model**: Build with PHP-first conventions instead of shifting your app architecture around JavaScript tooling.
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:
113
+ Important files include:
173
114
 
174
115
  - `index.php`
175
116
  - `layout.php`
@@ -183,61 +124,19 @@ Routes are created from the `src/app` folder structure and route files. AI agent
183
124
 
184
125
  If you are changing route behavior or navigation patterns, read the routing documentation first.
185
126
 
186
- ## Data, ORM, and reactivity
127
+ ## Data and reactivity
187
128
 
188
129
  One of Prisma PHP’s core ideas is keeping data flow simple across the stack:
189
130
 
190
- - query data with Prisma ORM in PHP
191
- - render full-stack UI directly from route files
192
- - use PulsePoint for frontend reactivity
193
- - use `pp.fetchFunction(...)` for reactive frontend-to-server calls
194
- - expose callable PHP functions with `#[Exposed]`
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`
195
137
 
196
138
  This makes it easier to build interactive applications without maintaining separate DTO layers, excessive transformation code, or client-heavy hydration logic.
197
139
 
198
- When a task specifically involves PulsePoint runtime behavior such as `pp.state`, `pp.effect`, `pp.ref`, `pp-for`, `pp-spread`, or `pp-ref`, read `pulsepoint.md` before generating code.
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
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`.
242
141
 
243
- If you want to explore Prisma PHP further, start with the official documentation, check the GitHub repository, and follow the broader ecosystem around PulsePoint, PHPX UI, and related tooling.
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-php",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Prisma PHP tooling",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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.