create-prisma-php-app 5.0.0-alpha.7 → 5.0.0
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/README.md +23 -2
- package/dist/.github/copilot-instructions.md +191 -0
- package/dist/AGENTS.md +588 -193
- package/dist/bootstrap.php +426 -213
- package/dist/index.js +2 -2
- package/dist/phpunit.xml +25 -0
- package/dist/postcss.config.js +4 -2
- package/dist/prisma-php.js +2 -2
- package/dist/public/.htaccess +1 -1
- package/dist/public/js/main.js +13 -1
- package/dist/public/js/pp-reactive-v2.min.js +1 -0
- package/dist/settings/auto-swagger-docs.ts +10 -10
- package/dist/settings/bs-config.ts +47 -27
- package/dist/settings/build.ts +2 -32
- package/dist/settings/component-map.ts +476 -0
- package/dist/settings/files-list.ts +2 -2
- package/dist/settings/project-name.ts +3 -6
- package/dist/settings/restart-mcp.ts +2 -2
- package/dist/settings/restart-websocket.ts +2 -2
- package/dist/settings/run-postcss.ts +205 -0
- package/dist/settings/run-tests.ts +35 -0
- package/dist/settings/swagger-config.ts +3 -3
- package/dist/settings/utils.ts +3 -3
- package/dist/src/Lib/Auth/Auth.php +63 -35
- package/dist/src/Lib/MCP/mcp-server.php +2 -3
- package/dist/src/Lib/Middleware/AuthMiddleware.php +2 -2
- package/dist/src/Lib/Middleware/CorsMiddleware.php +72 -0
- package/dist/src/Lib/Websocket/ConnectionManager.php +460 -7
- package/dist/src/Lib/Websocket/Socket.php +170 -0
- package/dist/src/Lib/Websocket/SocketPool.php +50 -0
- package/dist/src/Lib/Websocket/SocketRegistry.php +88 -0
- package/dist/src/Lib/Websocket/sockets.php +50 -0
- package/dist/src/Lib/Websocket/websocket-server.php +10 -3
- package/dist/src/app/globals.css +3 -1
- package/dist/src/app/layout.php +1 -1
- package/dist/tests/AuthTest.php +59 -0
- package/dist/tests/ConnectionManagerTest.php +277 -0
- package/dist/tests/CsrfTest.php +119 -0
- package/dist/tests/DeferComponentRootsTest.php +147 -0
- package/dist/tests/FeaturesTest.php +41 -0
- package/dist/tests/README.md +119 -0
- package/dist/tests/RpcWireContractTest.php +101 -0
- package/dist/tests/SocketPoolTest.php +69 -0
- package/dist/tests/SocketRegistryTest.php +77 -0
- package/dist/tests/SocketTest.php +124 -0
- package/dist/tests/SocketsRegistrationTest.php +40 -0
- package/dist/tests/Support/FakeConnection.php +62 -0
- package/dist/tests/Support/Features.php +38 -0
- package/dist/tests/Support/RequiresFeature.php +26 -0
- package/dist/tests/bootstrap.php +44 -0
- package/dist/ts/main.ts +21 -3
- package/dist/ts/tailwind-merge.ts +13 -0
- package/package.json +4 -4
- package/dist/README.md +0 -213
- package/dist/public/js/pp-reactive-v2.js +0 -1
- package/dist/settings/bs-config.json +0 -6
- package/dist/settings/class-imports.ts +0 -165
- package/dist/settings/class-log.ts +0 -244
- package/dist/settings/component-import-checker.ts +0 -90
- package/dist/settings/files-list.json +0 -1
- package/dist/settings/prisma-schema-config.json +0 -16
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
declare(strict_types=1);
|
|
4
|
+
|
|
5
|
+
namespace Tests;
|
|
6
|
+
|
|
7
|
+
use Lib\Websocket\SocketRegistry;
|
|
8
|
+
use PHPUnit\Framework\TestCase;
|
|
9
|
+
use Tests\Support\RequiresFeature;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The app's real registration file loads cleanly and registers every socket
|
|
13
|
+
* the frontend connects to. A socket the browser names but the server never
|
|
14
|
+
* registered is a refused connection in production — catch it here instead.
|
|
15
|
+
*/
|
|
16
|
+
final class SocketsRegistrationTest extends TestCase
|
|
17
|
+
{
|
|
18
|
+
use RequiresFeature;
|
|
19
|
+
|
|
20
|
+
protected function setUp(): void
|
|
21
|
+
{
|
|
22
|
+
$this->requireFeature('websocket');
|
|
23
|
+
SocketRegistryTest::resetRegistry();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
protected function tearDown(): void
|
|
27
|
+
{
|
|
28
|
+
SocketRegistryTest::resetRegistry();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public function testTheRegistrationFileLoadsAndNamesItsSockets(): void
|
|
32
|
+
{
|
|
33
|
+
require DOCUMENT_PATH . '/src/Lib/Websocket/sockets.php';
|
|
34
|
+
|
|
35
|
+
$names = SocketRegistry::names();
|
|
36
|
+
|
|
37
|
+
self::assertContains('echo', $names);
|
|
38
|
+
self::assertContains('chat', $names);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
declare(strict_types=1);
|
|
4
|
+
|
|
5
|
+
namespace Tests\Support;
|
|
6
|
+
|
|
7
|
+
use Ratchet\ConnectionInterface;
|
|
8
|
+
use GuzzleHttp\Psr7\Request as Psr7Request;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A Ratchet connection stand-in that records what the server sends.
|
|
12
|
+
*
|
|
13
|
+
* The named-socket wire is frames and closes, so a test only needs to see
|
|
14
|
+
* both: `$sentFrames` collects every `send(...)` payload (decoded from JSON
|
|
15
|
+
* when possible) and `$closeCodes` collects every `close(...)` code. The
|
|
16
|
+
* `httpRequest` property mirrors how Ratchet exposes the handshake request.
|
|
17
|
+
*/
|
|
18
|
+
final class FakeConnection implements ConnectionInterface
|
|
19
|
+
{
|
|
20
|
+
/** @var list<mixed> Decoded JSON frames (raw string when not JSON). */
|
|
21
|
+
public array $sentFrames = [];
|
|
22
|
+
|
|
23
|
+
/** @var list<string> Raw frames exactly as sent. */
|
|
24
|
+
public array $rawFrames = [];
|
|
25
|
+
|
|
26
|
+
/** @var list<int> */
|
|
27
|
+
public array $closeCodes = [];
|
|
28
|
+
|
|
29
|
+
public bool $isClosed = false;
|
|
30
|
+
|
|
31
|
+
public ?Psr7Request $httpRequest = null;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param array<string, string> $headers Handshake headers (e.g. Origin, Cookie).
|
|
35
|
+
*/
|
|
36
|
+
public function __construct(string $uri = '/__pulsepoint/ws', array $headers = [])
|
|
37
|
+
{
|
|
38
|
+
$this->httpRequest = new Psr7Request('GET', $uri, $headers);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public function send($data): ConnectionInterface
|
|
42
|
+
{
|
|
43
|
+
$this->rawFrames[] = (string) $data;
|
|
44
|
+
|
|
45
|
+
$decoded = json_decode((string) $data, true);
|
|
46
|
+
$this->sentFrames[] = json_last_error() === JSON_ERROR_NONE ? $decoded : (string) $data;
|
|
47
|
+
|
|
48
|
+
return $this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public function close($code = 1000): void
|
|
52
|
+
{
|
|
53
|
+
$this->closeCodes[] = (int) $code;
|
|
54
|
+
$this->isClosed = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The last frame the server sent, decoded. */
|
|
58
|
+
public function lastFrame(): mixed
|
|
59
|
+
{
|
|
60
|
+
return $this->sentFrames === [] ? null : end($this->sentFrames);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
declare(strict_types=1);
|
|
4
|
+
|
|
5
|
+
namespace Tests\Support;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Feature flags for the test suite, read from `prisma-php.json`.
|
|
9
|
+
*
|
|
10
|
+
* `prisma-php.json` is the single source of truth for which optional Prisma
|
|
11
|
+
* PHP features are enabled in the current app (`websocket`, `mcp`,
|
|
12
|
+
* `swaggerDocs`, `prisma`, `tailwindcss`, `typescript`, `backendOnly`).
|
|
13
|
+
* Tests that exercise an optional feature's scaffold must guard on the flag —
|
|
14
|
+
* when the feature is off, its files do not exist and the test must skip,
|
|
15
|
+
* not fatal.
|
|
16
|
+
*/
|
|
17
|
+
final class Features
|
|
18
|
+
{
|
|
19
|
+
/** @var array<string, mixed>|null */
|
|
20
|
+
private static ?array $config = null;
|
|
21
|
+
|
|
22
|
+
/** @return array<string, mixed> The parsed prisma-php.json. */
|
|
23
|
+
public static function config(): array
|
|
24
|
+
{
|
|
25
|
+
if (self::$config === null) {
|
|
26
|
+
$raw = @file_get_contents(DOCUMENT_PATH . '/prisma-php.json');
|
|
27
|
+
$decoded = is_string($raw) ? json_decode($raw, true) : null;
|
|
28
|
+
self::$config = is_array($decoded) ? $decoded : [];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return self::$config;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public static function enabled(string $feature): bool
|
|
35
|
+
{
|
|
36
|
+
return (self::config()[$feature] ?? false) === true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
declare(strict_types=1);
|
|
4
|
+
|
|
5
|
+
namespace Tests\Support;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Skip guard for tests of optional Prisma PHP features.
|
|
9
|
+
*
|
|
10
|
+
* Call `$this->requireFeature('websocket')` as the FIRST line of `setUp()`,
|
|
11
|
+
* before touching any class from the feature's scaffold — a disabled
|
|
12
|
+
* feature's files are not generated, so reaching them would fatal instead
|
|
13
|
+
* of failing cleanly. A skipped test reports why and how to enable it.
|
|
14
|
+
*/
|
|
15
|
+
trait RequiresFeature
|
|
16
|
+
{
|
|
17
|
+
protected function requireFeature(string $feature): void
|
|
18
|
+
{
|
|
19
|
+
if (!Features::enabled($feature)) {
|
|
20
|
+
self::markTestSkipped(
|
|
21
|
+
"The `$feature` feature is disabled in prisma-php.json; "
|
|
22
|
+
. "enable it and run `npx pp update project -y` to use this suite."
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
declare(strict_types=1);
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Shared PHPUnit setup for the app-level test suite.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors what the runtime gives app code — the composer autoloader and the
|
|
9
|
+
* path constants from `settings/paths.php` — without booting the framework:
|
|
10
|
+
* `bootstrap.php` (route resolution, CSRF cookie, rendering) is NOT loaded
|
|
11
|
+
* here, so tests exercise app classes directly.
|
|
12
|
+
*
|
|
13
|
+
* The real `.env` is deliberately NOT loaded. Tests run against deterministic
|
|
14
|
+
* environment defaults so the suite behaves the same on any machine and can
|
|
15
|
+
* never depend on (or leak) real secrets. Each default is only applied when
|
|
16
|
+
* the variable is not already set, so CI can still override.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
require_once dirname(__DIR__) . '/vendor/autoload.php';
|
|
20
|
+
require_once dirname(__DIR__) . '/settings/paths.php';
|
|
21
|
+
|
|
22
|
+
// Keep the app in its non-production code paths during tests (dev origin
|
|
23
|
+
// relaxations, readable error messages).
|
|
24
|
+
if (getenv('APP_ENV') === false) {
|
|
25
|
+
putenv('APP_ENV=development');
|
|
26
|
+
$_ENV['APP_ENV'] = 'development';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Deterministic secrets so Auth and Csrf construct without a real .env.
|
|
30
|
+
// HS256 requires at least 32 bytes of key material.
|
|
31
|
+
if (getenv('AUTH_SECRET') === false) {
|
|
32
|
+
putenv('AUTH_SECRET=test-secret-not-for-production-32bytes');
|
|
33
|
+
$_ENV['AUTH_SECRET'] = 'test-secret-not-for-production-32bytes';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (getenv('FUNCTION_CALL_SECRET') === false) {
|
|
37
|
+
putenv('FUNCTION_CALL_SECRET=test-function-call-secret');
|
|
38
|
+
$_ENV['FUNCTION_CALL_SECRET'] = 'test-function-call-secret';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Auth::signIn writes the session payload; give CLI tests a session store.
|
|
42
|
+
if (!isset($_SESSION)) {
|
|
43
|
+
$_SESSION = [];
|
|
44
|
+
}
|
package/dist/ts/main.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
|
-
import "/js/pp-reactive-v2.js";
|
|
1
|
+
import "/js/pp-reactive-v2.min.js";
|
|
2
2
|
|
|
3
3
|
// The following global names have already been declared elsewhere in the project:
|
|
4
4
|
// - pp: Used for the Reactive Core functionality.
|
|
5
|
-
|
|
6
|
-
//
|
|
5
|
+
|
|
6
|
+
// Imports goes here --Start
|
|
7
|
+
|
|
8
|
+
// Uncomment the following line if you need to use the createGlobalSingleton function in this file.
|
|
9
|
+
// import { createGlobalSingleton } from "./global-functions.js";
|
|
10
|
+
// import { myCustomFunction } from "./money.js";
|
|
11
|
+
|
|
12
|
+
// createGlobalSingleton("myCustomFunction", myCustomFunction);
|
|
13
|
+
|
|
14
|
+
// Imports goes here --End
|
|
15
|
+
|
|
16
|
+
const pp = (globalThis as any).pp;
|
|
17
|
+
|
|
18
|
+
if (document.readyState !== "loading") {
|
|
19
|
+
pp?.mount?.();
|
|
20
|
+
} else {
|
|
21
|
+
document.addEventListener("DOMContentLoaded", () => pp?.mount?.(), {
|
|
22
|
+
once: true,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { twMerge } from "tailwind-merge";
|
|
2
|
+
|
|
3
|
+
export type MergeableClassName = string | false | null | undefined;
|
|
4
|
+
|
|
5
|
+
export function mergeTailwindClasses(
|
|
6
|
+
...classNames: MergeableClassName[]
|
|
7
|
+
): string {
|
|
8
|
+
return twMerge(
|
|
9
|
+
classNames
|
|
10
|
+
.filter((className): className is string => Boolean(className))
|
|
11
|
+
.join(" "),
|
|
12
|
+
);
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-prisma-php-app",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"author": "Jefferson Abraham Omier <thesteelninjacode@gmail.com>",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"chalk": "^
|
|
35
|
+
"chalk": "^6.0.0",
|
|
36
36
|
"crypto-js": "^4.2.0",
|
|
37
37
|
"prompts": "^2.4.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/crypto-js": "^4.2.2",
|
|
41
|
-
"@types/node": "^
|
|
41
|
+
"@types/node": "^26.4.0",
|
|
42
42
|
"@types/prompts": "^2.4.9",
|
|
43
43
|
"ts-node": "^10.9.2",
|
|
44
|
-
"typescript": "^
|
|
44
|
+
"typescript": "^7.0.2"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/dist/README.md
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
# Prisma PHP
|
|
2
|
-
|
|
3
|
-
Prisma PHP is a modern full-stack PHP framework that combines native PHP, PulsePoint reactivity, PHPX components, and a Prisma-inspired ORM into one cohesive developer experience.
|
|
4
|
-
|
|
5
|
-
Build reactive interfaces with a server-first mental model, structured routing, type-safe data access, and a project layout designed for real applications.
|
|
6
|
-
|
|
7
|
-
## Getting Started
|
|
8
|
-
|
|
9
|
-
Create a new Prisma PHP project:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npx create-prisma-php-app@latest my-app
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Start the development server:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm run dev
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Open the local app in your browser after the dev server starts.
|
|
22
|
-
|
|
23
|
-
## Prerequisites
|
|
24
|
-
|
|
25
|
-
Before creating a Prisma PHP project, make sure you have:
|
|
26
|
-
|
|
27
|
-
- Node.js 22.x or higher
|
|
28
|
-
- PHP 8.2 or higher
|
|
29
|
-
- Composer 2.x or higher
|
|
30
|
-
- XAMPP or another local PHP environment
|
|
31
|
-
|
|
32
|
-
If you are using XAMPP on Windows, enabling `extension=zip` in `php.ini` is recommended so Composer dependencies install correctly.
|
|
33
|
-
|
|
34
|
-
## What Prisma PHP Includes
|
|
35
|
-
|
|
36
|
-
Prisma PHP brings together the core pieces needed to build full-stack PHP apps:
|
|
37
|
-
|
|
38
|
-
- **Native PHP + modern reactivity** with PulsePoint
|
|
39
|
-
- **PHPX component system** for reusable UI composition
|
|
40
|
-
- **Prisma PHP ORM** for schema-first, type-safe database access
|
|
41
|
-
- **Built-in authentication patterns** for sessions, route protection, RBAC, credentials auth, and provider login
|
|
42
|
-
- **File-based routing** with clear route file conventions
|
|
43
|
-
- **CLI scaffolding** for new apps, starter kits, and optional features
|
|
44
|
-
- **Flexible deployment options** for local development and production workflows
|
|
45
|
-
|
|
46
|
-
## Common Create Commands
|
|
47
|
-
|
|
48
|
-
Create a default full-stack app:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
npx create-prisma-php-app@latest my-app
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Create a project with common options:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
npx create-prisma-php-app@latest my-app --tailwindcss --typescript
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Use a starter kit:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
npx create-prisma-php-app my-app --starter-kit=fullstack
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Other documented flags may include capabilities such as WebSocket support, MCP support, backend-only mode, Swagger docs, and Prisma integration depending on the installed version.
|
|
67
|
-
|
|
68
|
-
## Documentation
|
|
69
|
-
|
|
70
|
-
Prisma PHP ships with local documentation for the installed project version.
|
|
71
|
-
|
|
72
|
-
The installed docs live here:
|
|
73
|
-
|
|
74
|
-
```txt
|
|
75
|
-
node_modules/prisma-php/dist/docs
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Treat these installed docs as the primary documentation source for the current project version.
|
|
79
|
-
|
|
80
|
-
You can also explore the public docs site:
|
|
81
|
-
|
|
82
|
-
```txt
|
|
83
|
-
https://prismaphp.tsnc.tech/
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## AI Quick Start
|
|
87
|
-
|
|
88
|
-
If you are using AI-assisted development in a Prisma PHP project:
|
|
89
|
-
|
|
90
|
-
1. Read `./prisma-php.json` first.
|
|
91
|
-
2. Read the installed docs in `node_modules/prisma-php/dist/docs`.
|
|
92
|
-
3. Read `AGENTS.md` for task-routing rules, framework constraints, and code-generation guidance.
|
|
93
|
-
4. Inspect `vendor/tsnc/prisma-php/src` only when the docs do not answer the task.
|
|
94
|
-
|
|
95
|
-
### Default interactive UI rule
|
|
96
|
-
|
|
97
|
-
In Prisma PHP, AI should treat **PulsePoint as the default frontend interactivity model**.
|
|
98
|
-
|
|
99
|
-
For normal full-stack page work:
|
|
100
|
-
|
|
101
|
-
- render the page with `index.php`
|
|
102
|
-
- manage browser-side state and UI behavior with **PulsePoint**
|
|
103
|
-
- call PHP from the frontend with **`pp.fetchFunction(...)`**
|
|
104
|
-
- expose callable PHP functions with **`#[Exposed]`**
|
|
105
|
-
- validate incoming data on the PHP side with **`PP\Validator`**
|
|
106
|
-
|
|
107
|
-
Do **not** default to PHP-only refresh cycles, handcrafted `fetch('/api/...')` patterns, or extra `route.php` handlers for normal interactive page behavior when PulsePoint plus `pp.fetchFunction(...)` already fits the task.
|
|
108
|
-
|
|
109
|
-
Only prefer a more PHP-only interaction style when the **user explicitly asks for PHP-only behavior**, or when the task is clearly non-reactive.
|
|
110
|
-
|
|
111
|
-
## Project Capability Manifest
|
|
112
|
-
|
|
113
|
-
Prisma PHP uses `prisma-php.json` at the repository root as the source of truth for enabled framework features and local environment configuration.
|
|
114
|
-
|
|
115
|
-
Use it to verify capabilities such as:
|
|
116
|
-
|
|
117
|
-
- Tailwind CSS support
|
|
118
|
-
- backend-only mode
|
|
119
|
-
- Prisma ORM support
|
|
120
|
-
- Swagger docs
|
|
121
|
-
- WebSocket support
|
|
122
|
-
- MCP support
|
|
123
|
-
- TypeScript support
|
|
124
|
-
- local development paths and BrowserSync settings
|
|
125
|
-
|
|
126
|
-
Do not assume a feature is enabled unless `prisma-php.json` confirms it.
|
|
127
|
-
|
|
128
|
-
## Documentation Map
|
|
129
|
-
|
|
130
|
-
Use these docs as the main entry points for common work:
|
|
131
|
-
|
|
132
|
-
- `index.md` for the general documentation entry point
|
|
133
|
-
- `project-structure.md` for project structure, route placement, and file conventions
|
|
134
|
-
- `layouts-and-pages.md` for pages, layouts, nested routes, and dynamic routes
|
|
135
|
-
- `components.md` for PHPX components, props, children, fragments, icons, buttons, and composition
|
|
136
|
-
- `fetching-data.md` for `pp.fetchFunction(...)`, `#[Exposed]`, and interactive backend flows
|
|
137
|
-
- `prisma-php-orm.md` for Prisma ORM, `schema.prisma`, migrations, and generated PHP classes
|
|
138
|
-
- `authentication.md` for auth strategy, sessions, RBAC, credentials auth, and provider flows
|
|
139
|
-
- `file-manager.md` for uploads, `multipart/form-data`, `$_FILES`, and `PP\FileManager\UploadFile`
|
|
140
|
-
- `route-handlers.md` for `route.php`, JSON responses, and direct server handlers
|
|
141
|
-
- `error-handling.md` for expected errors, `error.php`, `not-found.php`, and validation failures
|
|
142
|
-
- `caching.md` for cache behavior and `CacheHandler`
|
|
143
|
-
- `metadata-and-og-images.md` for metadata, title, description, icons, and head behavior
|
|
144
|
-
- `pulsepoint.md` for PulsePoint runtime usage and reactivity patterns
|
|
145
|
-
- `upgrading.md` for feature enablement and project update workflows
|
|
146
|
-
|
|
147
|
-
## Recommended Development Approach
|
|
148
|
-
|
|
149
|
-
When working in Prisma PHP:
|
|
150
|
-
|
|
151
|
-
- prefer the installed Prisma PHP docs over assumptions from other frameworks
|
|
152
|
-
- use `AGENTS.md` as the strict AI operating guide
|
|
153
|
-
- inspect nearby project files before generating new framework-specific code
|
|
154
|
-
- inspect framework internals only when the installed docs are not enough
|
|
155
|
-
|
|
156
|
-
## Route and File Conventions
|
|
157
|
-
|
|
158
|
-
Prisma PHP uses file-based routing with special route files such as:
|
|
159
|
-
|
|
160
|
-
- `index.php` for rendered UI routes
|
|
161
|
-
- `layout.php` for shared UI wrappers
|
|
162
|
-
- `route.php` for direct handlers such as JSON or API-style endpoints
|
|
163
|
-
- `loading.php` for loading UI
|
|
164
|
-
- `not-found.php` for route-level not-found UI
|
|
165
|
-
- `error.php` for route-level or app-level error UI
|
|
166
|
-
|
|
167
|
-
For task-specific route decision rules and framework generation rules, read `AGENTS.md`.
|
|
168
|
-
|
|
169
|
-
## PulsePoint and Frontend Reactivity
|
|
170
|
-
|
|
171
|
-
Prisma PHP uses PulsePoint for browser-side reactivity, and AI should assume this is the **default choice** for interactive UI behavior in full-stack routes.
|
|
172
|
-
|
|
173
|
-
When working with runtime features such as:
|
|
174
|
-
|
|
175
|
-
- `pp.state`
|
|
176
|
-
- `pp.effect`
|
|
177
|
-
- `pp.ref`
|
|
178
|
-
- `pp-for`
|
|
179
|
-
- `pp-spread`
|
|
180
|
-
- `pp-ref`
|
|
181
|
-
|
|
182
|
-
read the installed Prisma PHP docs for the current version first, then consult:
|
|
183
|
-
|
|
184
|
-
```txt
|
|
185
|
-
https://pulsepoint.tsnc.tech/llms
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## Project Structure
|
|
189
|
-
|
|
190
|
-
A generated Prisma PHP project typically includes folders like these:
|
|
191
|
-
|
|
192
|
-
```text
|
|
193
|
-
prisma-php-project/
|
|
194
|
-
├── prisma/ # schema, migrations, seed files
|
|
195
|
-
├── public/ # public entry point and assets
|
|
196
|
-
├── settings/ # project configuration
|
|
197
|
-
├── src/ # application source code
|
|
198
|
-
├── package.json # frontend/dev scripts
|
|
199
|
-
├── composer.json # PHP dependencies
|
|
200
|
-
└── prisma-php.json # Prisma PHP project capability manifest
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
## Updating Existing Projects
|
|
204
|
-
|
|
205
|
-
When enabling features or syncing framework-managed project files:
|
|
206
|
-
|
|
207
|
-
1. Update `prisma-php.json` first.
|
|
208
|
-
2. Read `upgrading.md` in the installed docs.
|
|
209
|
-
3. Run the documented project update workflow for the current version.
|
|
210
|
-
|
|
211
|
-
## Learn More
|
|
212
|
-
|
|
213
|
-
Start with the installed docs for the current project version, use the topic-specific markdown guides for focused work, and rely on `AGENTS.md` when strict AI generation rules are needed.
|