create-prisma-php-app 5.1.0-alpha.28 → 5.1.0-alpha.30

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.
@@ -51,7 +51,7 @@
51
51
  - In Tailwind-enabled Prisma PHP apps, Tailwind utility conflict resolution belongs to the frontend `twMerge(...)` runtime helper.
52
52
  - `getMergeClasses(...)` and `PP\PHPX\TwMerge::merge(...)` emit frontend `twMerge(...)` expressions for the browser runtime to resolve.
53
53
  - `twMerge(...)` is an app-level browser helper, not a PulsePoint built-in.
54
- - In TypeScript-enabled apps, Prisma PHP registers that helper from `ts/main.ts`; use `typescript.md` for route usage and `components.md` for PHPX usage.
54
+ - In TypeScript-enabled apps, Prisma PHP registers that helper from `ts/main.ts`; in non-TypeScript Tailwind apps it is registered from `public/js/main.js` (importing `public/js/tailwind-merge.mjs`). Use `typescript.md` for route usage and `components.md` for PHPX usage.
55
55
  - Keep Tailwind merge decisions on the frontend runtime instead of trying to finalize conflicting utility classes in PHP.
56
56
 
57
57
  ## Framework-Managed Package Scripts
@@ -90,6 +90,7 @@
90
90
  ## Authentication Route Strategy
91
91
 
92
92
  - Prisma PHP defaults to public routes.
93
+ - Auth classes are app-owned under `src/Lib/Auth` in the `Lib\Auth` namespace: `use Lib\Auth\Auth;`, `use Lib\Auth\AuthConfig;`, `use Lib\Auth\AuthRole;` — never `PP\Auth\...`.
93
94
  - Choose the route privacy strategy at the start of the app, before creating most routes.
94
95
  - If the app will have many public pages, keep the public-default strategy.
95
96
  - If the app will have only a few public entry points and most routes should require login, use the private-default strategy.
@@ -113,11 +114,11 @@
113
114
 
114
115
  ## Runtime Wire Contract
115
116
 
116
- - `pp.rpc(functionName, data?, optionsOrAbort?)` is the frontend-to-PHP call API. The former `pp.fetchFunction(...)` no longer exists in the runtime; never generate or document it.
117
+ - `pp.rpc(functionName, data?, optionsOrAbort?)` is the frontend-to-PHP call API.
117
118
  - Every function called through `pp.rpc(...)` must be marked `#[Exposed]` on the PHP side.
118
119
  - Framework-level RPC failures (unknown function, auth, roles, CSRF, origin, content type, rate limit, server error) arrive as HTTP error statuses with an `{"error": "..."}` JSON body and reject the `pp.rpc(...)` promise; wrap calls in `try/catch` when the UI reacts to failures. Return routine validation feedback as structured data instead of throwing. Throwing `InvalidArgumentException` in an exposed function is the sanctioned validation crossover: its message reaches the caller as a 400.
119
120
  - Streamed responses: an exposed function that yields streams SSE `data:` lines; consume them with `onStream`, `onStreamError`, and `onStreamComplete`.
120
- - CSRF: the runtime reads the `pp_csrf` cookie family (`pp_csrf_<port>` in development, `pp_csrf` otherwise), managed server-side by `PP\Security\Csrf` and signed with `FUNCTION_CALL_SECRET`. Do not document or generate the removed `prisma_php_csrf` cookie.
121
+ - CSRF: the runtime reads the `pp_csrf` cookie family (`pp_csrf_<port>` in development, `pp_csrf` otherwise), managed server-side by `PP\Security\Csrf` and signed with `FUNCTION_CALL_SECRET`.
121
122
  - Realtime: use `pp.socket(name, args, handlers)` (named sockets) for long-lived bidirectional flows. Server handlers are registered with `SocketRegistry::register(...)` in `src/Lib/Websocket/sockets.php`; the wire is one endpoint (`/__pulsepoint/ws?name=...`), arguments as the first JSON frame, JSON frames both ways, and `{"error": "..."}` reserved for failures. Do not generate raw `new WebSocket(...)` wiring for app realtime work.
122
123
  - Read `node_modules/prisma-php/dist/docs/fetching-data.md`, `bootstrap-runtime.md`, and `websocket.md` for the full contracts.
123
124
 
@@ -127,7 +128,7 @@
127
128
  - `index.php` and nested `layout.php` must render a single parent HTML element. Treat that root like a component boundary rather than loose sibling markup.
128
129
  - If the visible page or layout content should stay inside a semantic element such as `<main>`, `<section>`, or `<article>`, wrap it in a neutral parent such as `<div>` so the route boundary can still own the `<script>`.
129
130
  - For pages and nested layouts, author a plain single root element and let Prisma PHP inject the PulsePoint `pp-component` scope automatically.
130
- - Author plain `<script>` tags inside that boundary root when PulsePoint is needed, usually as a sibling of the visible content container instead of nesting the script inside the semantic content element by default. Put the PulsePoint code at the top level of that script. Do not manually add `type="text/pp"`, `DOMContentLoaded` wrappers, IIFEs, or manual bootstrap code; Prisma PHP normalizes the script contract for the runtime.
131
+ - Author plain `<script>` tags inside that boundary root when PulsePoint is needed, usually as a sibling of the visible content container instead of nesting the script inside the semantic content element by default. Put the PulsePoint code at the top level of that script. Never put a `type` attribute on a component script — the runtime only recognizes untyped scripts. Do not add `DOMContentLoaded` wrappers, IIFEs, or manual bootstrap code.
131
132
  - Do not leave the route `<script>` outside the route boundary.
132
133
  - Only the root `layout.php` should define `<html>`, `<head>`, and `<body>`. When PulsePoint is present, keep `MainLayout::$children;` and any `<script>` inside one clear wrapper.
133
134
 
@@ -136,7 +137,7 @@
136
137
  - Distinguish PHPX class components from `ImportComponent` partials.
137
138
  - `ImportComponent` partials must output exactly one root element because Prisma PHP uses that root as the imported component boundary and serializes props there.
138
139
  - Do not manually add `pp-component` inside `ImportComponent` partial source; Prisma PHP injects it there.
139
- - When imported partials need PulsePoint logic, keep the `<script>` inside that same root element and author it as a plain `<script>` tag without `type="text/pp"`, DOM-ready wrappers, or manual bootstrap code.
140
+ - When imported partials need PulsePoint logic, keep the `<script>` inside that same root element and author it as a plain `<script>` tag with no `type` attribute (the runtime ignores typed scripts), without DOM-ready wrappers or manual bootstrap code.
140
141
 
141
142
  ## Validation Rules
142
143
 
package/dist/AGENTS.md CHANGED
@@ -173,7 +173,7 @@ Use the docs router to learn how Prisma PHP implements a task. Use `./prisma-php
173
173
  - **API-style routes, JSON responses, handlers, webhooks, form-processing endpoints, `route.php`, or request validation in handlers**
174
174
  Read `route-handlers.md`
175
175
 
176
- - **Swagger or OpenAPI generation, `swaggerDocs`, `pphp-swagger.json`, `create-swagger-docs`, or `settings/prisma-schema-config.json`**
176
+ - **Swagger or OpenAPI generation, `swaggerDocs`, generated per-model swagger docs, `create-swagger-docs`, or `settings/prisma-schema-config.json`**
177
177
  Read `swagger-docs.md`
178
178
 
179
179
  - **Writing or running app tests, PHPUnit, the root `tests/` directory, `npm run test`, or verifying a change with the test suite**
@@ -329,7 +329,7 @@ Default interaction stack:
329
329
  5. validate and normalize input on the PHP side with `PP\Validator`
330
330
  6. use `pp.socket(...)` (named sockets) only when the flow is genuinely long-lived and bidirectional — chat, presence, live feeds
331
331
 
332
- `pp.rpc(...)` is the current runtime API. The former `pp.fetchFunction(...)` does not exist any more — never generate or document it. Framework-level RPC failures (unknown function, auth, roles, CSRF, origin, rate limit, server error) arrive as HTTP error statuses with an `{"error": "..."}` body and **reject** the `pp.rpc(...)` promise, so wrap calls in `try/catch` when the UI reacts to failures. Routine, expected validation feedback should still be returned as structured data (`success`, `errors`, normalized values), not thrown.
332
+ `pp.rpc(...)` is the runtime RPC API. Framework-level RPC failures (unknown function, auth, roles, CSRF, origin, rate limit, server error) arrive as HTTP error statuses with an `{"error": "..."}` body and **reject** the `pp.rpc(...)` promise, so wrap calls in `try/catch` when the UI reacts to failures. Routine, expected validation feedback should still be returned as structured data (`success`, `errors`, normalized values), not thrown.
333
333
 
334
334
  Treat this as the default for:
335
335
 
@@ -379,7 +379,7 @@ Also follow these route-file rules:
379
379
  - `index.php` and nested `layout.php` must render a single parent HTML element
380
380
  - use that single parent element as the route boundary; if the visible content should stay inside a semantic element such as `<main>`, `<section>`, or `<article>`, wrap it in a neutral parent such as `<div>`
381
381
  - for normal pages and nested layouts, do **not** manually author `pp-component` on that root; Prisma PHP adds it automatically
382
- - author a plain `<script>` tag inside that root when PulsePoint logic is needed and do **not** add `type="text/pp"` manually
382
+ - author a plain `<script>` tag inside that root when PulsePoint logic is needed and do **not** put any `type` attribute on it — the runtime only recognizes untyped component scripts
383
383
  - keep the `<script>` as the last child of the route boundary, usually as a sibling of the visible content container instead of nesting it inside the semantic content element by default
384
384
  - do **not** leave the `<script>` outside the route boundary
385
385
  - write PulsePoint state, derived values, and functions directly at the top level of that script; do **not** wrap them in `DOMContentLoaded`, an IIFE, manual `pp.mount()` calls, or custom scoping helpers
@@ -439,7 +439,7 @@ Do not:
439
439
 
440
440
  - put a sibling `<script>` next to a route root or imported partial root
441
441
  - manually add `pp-component` inside imported partial source
442
- - manually add `type="text/pp"` to route or imported-partial scripts
442
+ - add any `type` attribute to route or imported-partial component scripts
443
443
  - wrap imported-partial PulsePoint code in `DOMContentLoaded`, an IIFE, manual `pp.mount()` calls, or custom auto-execute helpers
444
444
 
445
445
  ## Metadata rules
@@ -531,6 +531,7 @@ Use this auth decision flow:
531
531
 
532
532
  Important auth rules:
533
533
 
534
+ - the auth classes are app-owned files under `src/Lib/Auth` in the `Lib\Auth` namespace — write `use Lib\Auth\Auth;` and `use Lib\Auth\AuthConfig;`, never `PP\Auth\...`
534
535
  - route privacy strategy is configured from `AuthConfig.php`
535
536
  - Prisma PHP supports both public-default and private-default route protection strategies
536
537
  - Prisma PHP defaults to public routes, so keep the public-default strategy when the app will expose many public pages
@@ -68,9 +68,8 @@ try {
68
68
  $port,
69
69
  $prefix,
70
70
  null, // sslContext
71
- true, // logger
72
- $enableJson // enableJsonResponse
73
- // , false // (optional) stateless
71
+ $enableJson, // enableJsonResponse
72
+ false // stateless
74
73
  );
75
74
  echo $color("✓ Listening on {$base}", '32') . PHP_EOL;
76
75
  $server->listen($transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "5.1.0-alpha.28",
3
+ "version": "5.1.0-alpha.30",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",