prisma-php 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/copilot-instructions.md +18 -5
- package/dist/docs/backend-only.md +204 -0
- package/dist/docs/commands.md +458 -0
- package/dist/docs/email.md +6 -0
- package/dist/docs/env.md +224 -0
- package/dist/docs/error-handling.md +35 -23
- package/dist/docs/fetching-data.md +3 -1
- package/dist/docs/get-started-ia.md +482 -0
- package/dist/docs/index.md +62 -2
- package/dist/docs/installation.md +21 -2
- package/dist/docs/layouts-and-pages.md +13 -1
- package/dist/docs/mcp.md +4 -1
- package/dist/docs/metadata-and-og-images.md +34 -22
- package/dist/docs/prisma-php-orm.md +20 -16
- package/dist/docs/project-structure.md +47 -1
- package/dist/docs/pulsepoint.md +14 -1
- package/dist/docs/route-handlers.md +18 -2
- package/dist/docs/swagger-docs.md +189 -0
- package/dist/docs/typescript.md +195 -0
- package/dist/docs/upgrading.md +13 -9
- package/dist/docs/websocket.md +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Commands
|
|
3
|
+
description: Learn the core Prisma PHP CLI commands so AI agents can choose the right create, update, and non-interactive project workflows.
|
|
4
|
+
related:
|
|
5
|
+
title: Related docs
|
|
6
|
+
description: Use installation for first-time setup and upgrading for feature refreshes on existing apps.
|
|
7
|
+
links:
|
|
8
|
+
- /docs/installation
|
|
9
|
+
- /docs/upgrading
|
|
10
|
+
- /docs/typescript
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
This guide explains what each Prisma PHP CLI command does, when to use it, and how the create and update workflows fit together.
|
|
14
|
+
|
|
15
|
+
If a task involves CLI project creation, starter kits, feature flags, or refreshing an existing Prisma PHP app, AI agents should read this page first and keep project creation separate from existing-project updates.
|
|
16
|
+
|
|
17
|
+
## AI rule: read the commands docs first
|
|
18
|
+
|
|
19
|
+
Before generating Prisma PHP CLI commands, use this order:
|
|
20
|
+
|
|
21
|
+
1. Decide whether the task is for a brand-new app or an existing project.
|
|
22
|
+
2. Use `create-prisma-php-app` only for new projects.
|
|
23
|
+
3. Use `npx pp update project` only for existing projects that already have `prisma-php.json`.
|
|
24
|
+
4. For AI-driven or scripted workflows, prefer the documented non-interactive `-y` flag.
|
|
25
|
+
5. Read `prisma-php-orm.md` before suggesting ORM migration or generation commands.
|
|
26
|
+
|
|
27
|
+
## Main idea
|
|
28
|
+
|
|
29
|
+
Prisma PHP has two main command groups:
|
|
30
|
+
|
|
31
|
+
- `create-prisma-php-app` creates a new project
|
|
32
|
+
- `pp update project` refreshes an existing project from the saved `prisma-php.json` configuration
|
|
33
|
+
|
|
34
|
+
Use `create` when you are starting a new project.
|
|
35
|
+
|
|
36
|
+
Use `update` when the project already exists and you want to re-apply the saved project configuration, enable newly saved features, or refresh framework-managed files.
|
|
37
|
+
|
|
38
|
+
## Command reference
|
|
39
|
+
|
|
40
|
+
### Create a new project
|
|
41
|
+
|
|
42
|
+
```bash package="npm"
|
|
43
|
+
npx create-prisma-php-app@<version> <project-name> [feature flags] [-y]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you omit `@<version>`, `npx` uses the default published package resolution.
|
|
47
|
+
|
|
48
|
+
### Update an existing project
|
|
49
|
+
|
|
50
|
+
```bash package="npm"
|
|
51
|
+
npx pp update project [@version-or-tag] [-y]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Run this inside an existing Prisma PHP project that already has `prisma-php.json`.
|
|
55
|
+
|
|
56
|
+
## Create project command
|
|
57
|
+
|
|
58
|
+
### `npx create-prisma-php-app <project-name>`
|
|
59
|
+
|
|
60
|
+
This is the main Prisma PHP project generator.
|
|
61
|
+
|
|
62
|
+
It creates a new project, installs the selected feature set, writes the initial configuration, creates the folder structure, and prepares the app for local development.
|
|
63
|
+
|
|
64
|
+
During project creation, the selected feature flags are written into `prisma-php.json`. Those saved values are what later allow `npx pp update project` to refresh the project without re-entering every option manually.
|
|
65
|
+
|
|
66
|
+
### Use this when
|
|
67
|
+
|
|
68
|
+
- creating a brand-new Prisma PHP project
|
|
69
|
+
- starting from a starter kit
|
|
70
|
+
- scaffolding a project with selected features already enabled
|
|
71
|
+
- automating project creation in scripts or CI
|
|
72
|
+
|
|
73
|
+
### Basic examples
|
|
74
|
+
|
|
75
|
+
```bash package="npm"
|
|
76
|
+
npx create-prisma-php-app my-app
|
|
77
|
+
npx create-prisma-php-app my-app -y
|
|
78
|
+
npx create-prisma-php-app my-app --backend-only --prisma --swagger-docs
|
|
79
|
+
npx create-prisma-php-app my-app --tailwindcss --typescript --prisma
|
|
80
|
+
npx create-prisma-php-app my-app --tailwindcss --typescript --websocket --mcp --prisma --swagger-docs
|
|
81
|
+
npx create-prisma-php-app my-app --starter-kit=basic
|
|
82
|
+
npx create-prisma-php-app my-app --starter-kit=fullstack --typescript -y
|
|
83
|
+
npx create-prisma-php-app my-app --starter-kit=custom --starter-kit-source=https://github.com/user/repo --prisma --tailwindcss
|
|
84
|
+
npx create-prisma-php-app --list-starter-kits
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Non-interactive mode
|
|
88
|
+
|
|
89
|
+
### `-y`
|
|
90
|
+
|
|
91
|
+
This flag enables non-interactive mode.
|
|
92
|
+
|
|
93
|
+
Instead of stopping for terminal prompts, the CLI proceeds with the provided flags and default values.
|
|
94
|
+
|
|
95
|
+
### Use this when
|
|
96
|
+
|
|
97
|
+
- running automation or CI
|
|
98
|
+
- scaffolding quickly without prompts
|
|
99
|
+
- generating predictable output from scripts
|
|
100
|
+
|
|
101
|
+
### Example
|
|
102
|
+
|
|
103
|
+
```bash package="npm"
|
|
104
|
+
npx create-prisma-php-app my-app -y
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Create command feature flags
|
|
108
|
+
|
|
109
|
+
### `--backend-only`
|
|
110
|
+
|
|
111
|
+
Creates a backend-only project.
|
|
112
|
+
|
|
113
|
+
This is appropriate for API-first or server-only applications where the project should center on handler-style routes instead of the usual full-stack page flow.
|
|
114
|
+
|
|
115
|
+
### Use this when
|
|
116
|
+
|
|
117
|
+
- building REST APIs
|
|
118
|
+
- creating server-only services
|
|
119
|
+
- building a backend for a separate frontend client
|
|
120
|
+
|
|
121
|
+
### Example
|
|
122
|
+
|
|
123
|
+
```bash package="npm"
|
|
124
|
+
npx create-prisma-php-app my-app --backend-only
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### `--swagger-docs`
|
|
128
|
+
|
|
129
|
+
Enables Swagger and OpenAPI documentation support.
|
|
130
|
+
|
|
131
|
+
This prepares the project for API schema generation and API documentation workflows.
|
|
132
|
+
|
|
133
|
+
### Use this when
|
|
134
|
+
|
|
135
|
+
- documenting API endpoints
|
|
136
|
+
- sharing API contracts with frontend or third-party consumers
|
|
137
|
+
- generating OpenAPI-based tooling from the project
|
|
138
|
+
|
|
139
|
+
### Example
|
|
140
|
+
|
|
141
|
+
```bash package="npm"
|
|
142
|
+
npx create-prisma-php-app my-app --backend-only --swagger-docs
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### `--tailwindcss`
|
|
146
|
+
|
|
147
|
+
Enables Tailwind CSS support.
|
|
148
|
+
|
|
149
|
+
This prepares frontend styling with Tailwind-related files and scripts.
|
|
150
|
+
|
|
151
|
+
### Use this when
|
|
152
|
+
|
|
153
|
+
- building dashboards or admin panels
|
|
154
|
+
- creating a styled full-stack UI
|
|
155
|
+
- starting a project that should use utility-first CSS from day one
|
|
156
|
+
|
|
157
|
+
### Example
|
|
158
|
+
|
|
159
|
+
```bash package="npm"
|
|
160
|
+
npx create-prisma-php-app my-app --tailwindcss
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### `--typescript`
|
|
164
|
+
|
|
165
|
+
Enables TypeScript support for the frontend toolchain.
|
|
166
|
+
|
|
167
|
+
When this flag is enabled, Prisma PHP should keep frontend TypeScript in the root `ts/` directory, register browser helpers from `ts/main.ts`, and use those registered globals from template expressions and PulsePoint component scripts.
|
|
168
|
+
|
|
169
|
+
Read `typescript.md` for the TypeScript-specific workflow.
|
|
170
|
+
|
|
171
|
+
### Use this when
|
|
172
|
+
|
|
173
|
+
- you want typed frontend code
|
|
174
|
+
- you want stronger editor tooling for frontend work
|
|
175
|
+
- your project will include frontend TypeScript assets
|
|
176
|
+
|
|
177
|
+
### Example
|
|
178
|
+
|
|
179
|
+
```bash package="npm"
|
|
180
|
+
npx create-prisma-php-app my-app --typescript
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### `--websocket`
|
|
184
|
+
|
|
185
|
+
Enables WebSocket support.
|
|
186
|
+
|
|
187
|
+
This prepares the project for real-time server and client workflows.
|
|
188
|
+
|
|
189
|
+
### Use this when
|
|
190
|
+
|
|
191
|
+
- building chat systems
|
|
192
|
+
- creating live dashboards
|
|
193
|
+
- sending notifications or push-style realtime updates
|
|
194
|
+
|
|
195
|
+
### Example
|
|
196
|
+
|
|
197
|
+
```bash package="npm"
|
|
198
|
+
npx create-prisma-php-app my-app --websocket
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### `--mcp`
|
|
202
|
+
|
|
203
|
+
Enables MCP support.
|
|
204
|
+
|
|
205
|
+
This prepares the project for Model Context Protocol server and tool workflows.
|
|
206
|
+
|
|
207
|
+
### Use this when
|
|
208
|
+
|
|
209
|
+
- integrating AI tooling
|
|
210
|
+
- exposing tools through MCP
|
|
211
|
+
- building model-connected workflows
|
|
212
|
+
|
|
213
|
+
### Example
|
|
214
|
+
|
|
215
|
+
```bash package="npm"
|
|
216
|
+
npx create-prisma-php-app my-app --mcp
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### `--prisma`
|
|
220
|
+
|
|
221
|
+
Enables Prisma ORM support.
|
|
222
|
+
|
|
223
|
+
This prepares the project for database-backed development and ORM generation workflows.
|
|
224
|
+
|
|
225
|
+
### Use this when
|
|
226
|
+
|
|
227
|
+
- your project needs a database
|
|
228
|
+
- you want Prisma ORM available from the start
|
|
229
|
+
- you are building CRUD apps, APIs, dashboards, or content systems
|
|
230
|
+
|
|
231
|
+
### Example
|
|
232
|
+
|
|
233
|
+
```bash package="npm"
|
|
234
|
+
npx create-prisma-php-app my-app --prisma
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Starter kits
|
|
238
|
+
|
|
239
|
+
### `--list-starter-kits`
|
|
240
|
+
|
|
241
|
+
Shows the starter kits available in the installed CLI version.
|
|
242
|
+
|
|
243
|
+
Use this before choosing a starter if you want to inspect the currently supported templates.
|
|
244
|
+
|
|
245
|
+
### Example
|
|
246
|
+
|
|
247
|
+
```bash package="npm"
|
|
248
|
+
npx create-prisma-php-app --list-starter-kits
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### `--starter-kit=<kit>`
|
|
252
|
+
|
|
253
|
+
Creates the project from a starter kit.
|
|
254
|
+
|
|
255
|
+
Starter kits provide opinionated starting points so you do not have to assemble every feature combination manually.
|
|
256
|
+
|
|
257
|
+
The exact built-in starter kit names depend on the installed CLI version, so `--list-starter-kits` is the safest way to confirm the current list.
|
|
258
|
+
|
|
259
|
+
### Example
|
|
260
|
+
|
|
261
|
+
```bash package="npm"
|
|
262
|
+
npx create-prisma-php-app my-app --starter-kit=basic
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### `--starter-kit-source=<url>`
|
|
266
|
+
|
|
267
|
+
Uses a custom external starter kit source.
|
|
268
|
+
|
|
269
|
+
This is intended for custom or team-managed boilerplates and is typically paired with `--starter-kit=custom`.
|
|
270
|
+
|
|
271
|
+
### Example
|
|
272
|
+
|
|
273
|
+
```bash package="npm"
|
|
274
|
+
npx create-prisma-php-app my-app --starter-kit=custom --starter-kit-source=https://github.com/user/repo
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Combining create flags
|
|
278
|
+
|
|
279
|
+
You can combine multiple feature flags during project creation.
|
|
280
|
+
|
|
281
|
+
### Example: full-stack app
|
|
282
|
+
|
|
283
|
+
```bash package="npm"
|
|
284
|
+
npx create-prisma-php-app my-app --tailwindcss --typescript --prisma
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Example: realtime app
|
|
288
|
+
|
|
289
|
+
```bash package="npm"
|
|
290
|
+
npx create-prisma-php-app my-app --tailwindcss --typescript --websocket --mcp --prisma --swagger-docs
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Example: backend API
|
|
294
|
+
|
|
295
|
+
```bash package="npm"
|
|
296
|
+
npx create-prisma-php-app my-app --backend-only --prisma --swagger-docs
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Example: automated generation
|
|
300
|
+
|
|
301
|
+
```bash package="npm"
|
|
302
|
+
npx create-prisma-php-app my-app --starter-kit=fullstack --typescript -y
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Update command
|
|
306
|
+
|
|
307
|
+
### `npx pp update project`
|
|
308
|
+
|
|
309
|
+
This is the dedicated updater for an existing Prisma PHP project.
|
|
310
|
+
|
|
311
|
+
It reads the saved project configuration from `prisma-php.json`, then refreshes the project using those saved values instead of asking you to pass the full feature set again.
|
|
312
|
+
|
|
313
|
+
Use this when the project already exists and you want to regenerate or refresh framework-managed files.
|
|
314
|
+
|
|
315
|
+
If you are enabling or changing features on an existing project, update `prisma-php.json` first, then run `npx pp update project`.
|
|
316
|
+
|
|
317
|
+
### Example
|
|
318
|
+
|
|
319
|
+
```bash package="npm"
|
|
320
|
+
npx pp update project
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### `npx pp update project @latest`
|
|
324
|
+
|
|
325
|
+
Refreshes the current project using the latest published version of `create-prisma-php-app`.
|
|
326
|
+
|
|
327
|
+
### Example
|
|
328
|
+
|
|
329
|
+
```bash package="npm"
|
|
330
|
+
npx pp update project @latest
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### `npx pp update project @v5-alpha`
|
|
334
|
+
|
|
335
|
+
Refreshes the project using a tagged prerelease such as an alpha build.
|
|
336
|
+
|
|
337
|
+
### Use this when
|
|
338
|
+
|
|
339
|
+
- testing prerelease framework changes
|
|
340
|
+
- validating upcoming CLI behavior
|
|
341
|
+
- trying an experimental version on an existing project
|
|
342
|
+
|
|
343
|
+
### Example
|
|
344
|
+
|
|
345
|
+
```bash package="npm"
|
|
346
|
+
npx pp update project @v5-alpha
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### `npx pp update project @1.2.3`
|
|
350
|
+
|
|
351
|
+
Refreshes the project using a fixed package version.
|
|
352
|
+
|
|
353
|
+
### Use this when
|
|
354
|
+
|
|
355
|
+
- you need reproducible updates
|
|
356
|
+
- you want to stay on a known working version
|
|
357
|
+
- you want strict version control over generator behavior
|
|
358
|
+
|
|
359
|
+
### Example
|
|
360
|
+
|
|
361
|
+
```bash package="npm"
|
|
362
|
+
npx pp update project @1.2.3
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### `npx pp update project -y`
|
|
366
|
+
|
|
367
|
+
Runs the update in non-interactive mode.
|
|
368
|
+
|
|
369
|
+
This skips the confirmation prompt and proceeds directly.
|
|
370
|
+
|
|
371
|
+
### Use this when
|
|
372
|
+
|
|
373
|
+
- running scripted updates
|
|
374
|
+
- using CI or automation
|
|
375
|
+
- updating from AI-driven workflows
|
|
376
|
+
|
|
377
|
+
### Example
|
|
378
|
+
|
|
379
|
+
```bash package="npm"
|
|
380
|
+
npx pp update project -y
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### Combined update examples
|
|
384
|
+
|
|
385
|
+
```bash package="npm"
|
|
386
|
+
npx pp update project
|
|
387
|
+
npx pp update project -y
|
|
388
|
+
npx pp update project @latest
|
|
389
|
+
npx pp update project @v5-alpha
|
|
390
|
+
npx pp update project @1.2.3
|
|
391
|
+
npx pp update project @latest -y
|
|
392
|
+
npx pp update project @v5-alpha -y
|
|
393
|
+
npx pp update project @1.2.3 -y
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## Important update clarification
|
|
397
|
+
|
|
398
|
+
`npx pp update project` is a project scaffolding and refresh command.
|
|
399
|
+
|
|
400
|
+
It is not a substitute for Prisma ORM schema migration commands.
|
|
401
|
+
|
|
402
|
+
If your database schema changed, use the Prisma ORM workflow documented in `prisma-php-orm.md` and `upgrading.md`.
|
|
403
|
+
|
|
404
|
+
## Recommended mental model
|
|
405
|
+
|
|
406
|
+
### Use create when
|
|
407
|
+
|
|
408
|
+
- starting a new project
|
|
409
|
+
- selecting a starter kit for the first time
|
|
410
|
+
- choosing feature flags for initial scaffolding
|
|
411
|
+
- generating a project structure from scratch
|
|
412
|
+
|
|
413
|
+
### Use update when
|
|
414
|
+
|
|
415
|
+
- the project already has `prisma-php.json`
|
|
416
|
+
- you want to refresh default project files
|
|
417
|
+
- you want to keep the saved feature set
|
|
418
|
+
- you want to move the project to a newer or pinned generator version
|
|
419
|
+
|
|
420
|
+
## Quick summary table
|
|
421
|
+
|
|
422
|
+
| Command | What it does | Best use case |
|
|
423
|
+
| ------------------------------------- | ------------------------------------- | --------------------------------------- |
|
|
424
|
+
| `npx create-prisma-php-app my-app` | Creates a new project | Starting fresh |
|
|
425
|
+
| `npx create-prisma-php-app my-app -y` | Creates a new project without prompts | Automation or CI |
|
|
426
|
+
| `--backend-only` | Creates a server-only setup | APIs or services |
|
|
427
|
+
| `--swagger-docs` | Enables API docs | Documented APIs |
|
|
428
|
+
| `--tailwindcss` | Enables Tailwind styling | UI projects |
|
|
429
|
+
| `--typescript` | Enables TypeScript support | Typed frontend work |
|
|
430
|
+
| `--websocket` | Enables realtime support | Chat or live updates |
|
|
431
|
+
| `--mcp` | Enables MCP support | AI or tool workflows |
|
|
432
|
+
| `--prisma` | Enables Prisma ORM support | Database-backed projects |
|
|
433
|
+
| `--list-starter-kits` | Lists starter templates | Inspect available starters |
|
|
434
|
+
| `--starter-kit=<kit>` | Creates a project from a starter kit | Opinionated bootstrapping |
|
|
435
|
+
| `--starter-kit-source=<url>` | Uses a custom external starter kit | Team or company boilerplates |
|
|
436
|
+
| `npx pp update project` | Refreshes an existing project | Existing Prisma PHP apps |
|
|
437
|
+
| `npx pp update project @latest` | Uses the latest generator version | Upgrade to the newest published version |
|
|
438
|
+
| `npx pp update project @v5-alpha` | Uses a prerelease tag | Testing alpha behavior |
|
|
439
|
+
| `npx pp update project @1.2.3` | Uses a fixed version | Reproducible updates |
|
|
440
|
+
| `npx pp update project -y` | Updates without prompts | Automation or CI |
|
|
441
|
+
|
|
442
|
+
## Final recommendation
|
|
443
|
+
|
|
444
|
+
For most users, start with:
|
|
445
|
+
|
|
446
|
+
```bash package="npm"
|
|
447
|
+
npx create-prisma-php-app my-app
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Then add only the flags you actually need.
|
|
451
|
+
|
|
452
|
+
Later, use:
|
|
453
|
+
|
|
454
|
+
```bash package="npm"
|
|
455
|
+
npx pp update project
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
when you want to refresh an existing project with its saved Prisma PHP configuration.
|
package/dist/docs/email.md
CHANGED
|
@@ -5,6 +5,7 @@ related:
|
|
|
5
5
|
title: Related docs
|
|
6
6
|
description: Read the official Prisma PHP email docs before generating or editing mail flows.
|
|
7
7
|
links:
|
|
8
|
+
- /docs/env
|
|
8
9
|
- /docs/email-get-started
|
|
9
10
|
- /docs/env-file
|
|
10
11
|
- /docs/php-validator
|
|
@@ -33,6 +34,7 @@ Do not assume another framework's mailer abstraction applies directly.
|
|
|
33
34
|
## Read this doc when you need
|
|
34
35
|
|
|
35
36
|
- **SMTP setup, `.env` mail variables, `PP\PHPMailer\Mailer`, `sendEmail`, HTML email, text email, `from`, `to`, `cc`, `bcc`, `replyTo`, or attachments** → official `email-get-started`
|
|
37
|
+
- **custom runtime reads of SMTP values, mail feature flags, or `.env` loading boundaries** → `env.md` plus `email.md`
|
|
36
38
|
- **contact forms or page-local email sends via PulsePoint** → `fetching-data.md` plus `email.md`
|
|
37
39
|
- **direct POST handlers or handler-only email routes** → `route-handlers.md` plus `email.md`
|
|
38
40
|
- **validation of recipient, sender, or contact-form input** → `validator.md` plus `email.md`
|
|
@@ -44,6 +46,8 @@ The Prisma PHP mailer is a PHPMailer wrapper with a fluent API.
|
|
|
44
46
|
|
|
45
47
|
The constructor initializes a `PHPMailer` instance, forces `UTF-8`, configures SMTP transport from `.env`, and applies a default sender when `MAIL_FROM` is present and valid.
|
|
46
48
|
|
|
49
|
+
When a task goes beyond the built-in mailer workflow and needs direct runtime config access, AI should route that part through `PP\Env` and `env.md` instead of adding ad hoc `getenv()` parsing.
|
|
50
|
+
|
|
47
51
|
AI should preserve that model instead of replacing it with undocumented helpers or raw `mail()` calls.
|
|
48
52
|
|
|
49
53
|
## Exact core file location
|
|
@@ -82,6 +86,8 @@ Behavior notes:
|
|
|
82
86
|
|
|
83
87
|
AI should update `.env` whenever email support is introduced and should not hardcode SMTP credentials in route files or components.
|
|
84
88
|
|
|
89
|
+
If application code needs to read related mail settings directly, prefer `PP\Env` typed helpers so defaults and empty-value handling stay consistent with the Prisma PHP env implementation.
|
|
90
|
+
|
|
85
91
|
## Public fluent methods AI should know
|
|
86
92
|
|
|
87
93
|
The current `Mailer` class exposes:
|
package/dist/docs/env.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Env
|
|
3
|
+
description: Learn how Prisma PHP reads environment values with PP\Env so AI agents can use typed env helpers, understand the .env loading boundary, and avoid ad hoc getenv parsing.
|
|
4
|
+
related:
|
|
5
|
+
title: Related docs
|
|
6
|
+
description: Read the official Prisma PHP env docs before generating or editing configuration access code.
|
|
7
|
+
links:
|
|
8
|
+
- /docs/env
|
|
9
|
+
- /docs/env-file
|
|
10
|
+
- /docs/project-structure
|
|
11
|
+
- /docs/prisma-php-ai-mcp
|
|
12
|
+
- /docs/websocket-get-started
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
Prisma PHP environment access should follow the documented `PP\Env` model, not ad hoc parsing copied from Laravel config helpers, Symfony parameter bags, or repeated raw `getenv()` checks scattered across the codebase.
|
|
16
|
+
|
|
17
|
+
If a task involves `.env`, environment variables, feature flags, host and port values, timezones, API keys, numeric limits, or typed runtime configuration reads, AI agents should read the relevant Prisma PHP env docs first and keep the implementation aligned with the installed Prisma PHP version.
|
|
18
|
+
|
|
19
|
+
## AI rule: read the Env docs first
|
|
20
|
+
|
|
21
|
+
Before generating, editing, or reviewing environment-related code, use this order:
|
|
22
|
+
|
|
23
|
+
1. Read `./prisma-php.json` when the task is in a generated Prisma PHP app.
|
|
24
|
+
2. Read the installed local docs in `node_modules/prisma-php/dist/docs`.
|
|
25
|
+
3. Read this `env.md` file.
|
|
26
|
+
4. Inspect the current `.env` file or deployment environment when the task depends on real values.
|
|
27
|
+
5. Inspect the bootstrap or server entry file that loads or consumes environment variables.
|
|
28
|
+
6. Inspect Prisma PHP core internals only when the docs do not answer the task.
|
|
29
|
+
|
|
30
|
+
Do not assume another framework's env loader or configuration container applies directly.
|
|
31
|
+
|
|
32
|
+
## Read this doc when you need
|
|
33
|
+
|
|
34
|
+
- **`.env`, environment variables, `PP\Env`, `Env::get(...)`, `Env::string(...)`, `Env::bool(...)`, or `Env::int(...)`** -> official `env`
|
|
35
|
+
- **`.env` file placement, runtime loading, or dotenv bootstrapping** -> official `env-file` plus `env.md`
|
|
36
|
+
- **runtime settings for websocket or MCP servers** -> `websocket.md` or `mcp.md` plus `env.md`
|
|
37
|
+
- **SMTP credentials, sender defaults, or provider secrets** -> `email.md` or `get-started-ia.md` plus `env.md`
|
|
38
|
+
- **database connection strings and Prisma datasource config** -> `prisma-php-orm.md` plus `env.md`
|
|
39
|
+
|
|
40
|
+
## Core Env model AI should follow
|
|
41
|
+
|
|
42
|
+
Prisma PHP documents environment access around a lightweight helper class:
|
|
43
|
+
|
|
44
|
+
- `PP\Env` reads values that already exist in the runtime
|
|
45
|
+
- it provides raw access through `get()`
|
|
46
|
+
- it provides typed helpers through `string()`, `bool()`, and `int()`
|
|
47
|
+
- it centralizes default handling instead of repeating parsing logic in multiple files
|
|
48
|
+
|
|
49
|
+
AI should preserve that model instead of re-implementing manual conversion everywhere.
|
|
50
|
+
|
|
51
|
+
## Exact core file location
|
|
52
|
+
|
|
53
|
+
The Prisma PHP core `Env` class lives here:
|
|
54
|
+
|
|
55
|
+
```txt
|
|
56
|
+
vendor/tsnc/prisma-php/src/Env.php
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
When AI needs to inspect framework internals because the docs do not fully answer an env task, this is the exact core file to review.
|
|
60
|
+
|
|
61
|
+
## Resolution order and normalization
|
|
62
|
+
|
|
63
|
+
The current `Env` implementation resolves values in this order:
|
|
64
|
+
|
|
65
|
+
1. `getenv()`
|
|
66
|
+
2. `$_ENV`
|
|
67
|
+
3. `$_SERVER`
|
|
68
|
+
|
|
69
|
+
Normalization behavior:
|
|
70
|
+
|
|
71
|
+
- booleans become `'true'` or `'false'`
|
|
72
|
+
- scalar values are cast to strings
|
|
73
|
+
- unsupported types such as arrays or objects return `null`
|
|
74
|
+
|
|
75
|
+
That means `Env` is safe for central configuration reads, but it is not a substitute for validating arbitrary request payloads.
|
|
76
|
+
|
|
77
|
+
## Public methods AI should know
|
|
78
|
+
|
|
79
|
+
The current `Env` class exposes:
|
|
80
|
+
|
|
81
|
+
- `static get(string $key): ?string`
|
|
82
|
+
- `static string(string $key, string $default = ''): string`
|
|
83
|
+
- `static bool(string $key, bool $default = false): bool`
|
|
84
|
+
- `static int(string $key, int $default = 0): int`
|
|
85
|
+
|
|
86
|
+
Do not invent undocumented helper methods when this public surface already covers the common Prisma PHP configuration workflow.
|
|
87
|
+
|
|
88
|
+
## Method behavior summary
|
|
89
|
+
|
|
90
|
+
Use `get()` when you want the raw nullable string value and plan to handle parsing yourself.
|
|
91
|
+
|
|
92
|
+
Use `string()` for values such as:
|
|
93
|
+
|
|
94
|
+
- app names
|
|
95
|
+
- timezones
|
|
96
|
+
- URLs
|
|
97
|
+
- API keys
|
|
98
|
+
- driver names
|
|
99
|
+
|
|
100
|
+
Behavior note:
|
|
101
|
+
|
|
102
|
+
- `string()` returns the default when the value is missing or when it is an empty string
|
|
103
|
+
|
|
104
|
+
Use `bool()` for values such as:
|
|
105
|
+
|
|
106
|
+
- feature flags
|
|
107
|
+
- verbose logging toggles
|
|
108
|
+
- JSON response toggles
|
|
109
|
+
- debug mode switches
|
|
110
|
+
|
|
111
|
+
Accepted boolean-like values are case-insensitive:
|
|
112
|
+
|
|
113
|
+
- `true` and `false`
|
|
114
|
+
- `1` and `0`
|
|
115
|
+
- `yes` and `no`
|
|
116
|
+
- `on` and `off`
|
|
117
|
+
|
|
118
|
+
Behavior note:
|
|
119
|
+
|
|
120
|
+
- invalid boolean strings fall back to the provided default
|
|
121
|
+
|
|
122
|
+
Use `int()` for values such as:
|
|
123
|
+
|
|
124
|
+
- port numbers
|
|
125
|
+
- timeouts
|
|
126
|
+
- retry limits
|
|
127
|
+
- upload limits
|
|
128
|
+
- cache durations
|
|
129
|
+
|
|
130
|
+
Behavior note:
|
|
131
|
+
|
|
132
|
+
- `int()` only converts numeric values; otherwise it returns the default
|
|
133
|
+
|
|
134
|
+
## Important `.env` boundary
|
|
135
|
+
|
|
136
|
+
`PP\Env` does not parse a `.env` file by itself.
|
|
137
|
+
|
|
138
|
+
It only reads values that are already present in the PHP runtime. When Prisma PHP needs to load `.env` values from disk first, the bootstrap or server entry typically does that explicitly, for example with `Dotenv::createImmutable(...)->safeLoad()`.
|
|
139
|
+
|
|
140
|
+
AI should keep that boundary clear:
|
|
141
|
+
|
|
142
|
+
- use dotenv loading when the runtime has not loaded `.env` yet
|
|
143
|
+
- use `PP\Env` when reading values after the environment is available
|
|
144
|
+
- do not describe `PP\Env` as a standalone dotenv parser
|
|
145
|
+
|
|
146
|
+
## Recommended example patterns
|
|
147
|
+
|
|
148
|
+
### Bootstrap runtime settings
|
|
149
|
+
|
|
150
|
+
```php
|
|
151
|
+
<?php
|
|
152
|
+
|
|
153
|
+
declare(strict_types=1);
|
|
154
|
+
|
|
155
|
+
use Dotenv\Dotenv;
|
|
156
|
+
use PP\Env;
|
|
157
|
+
|
|
158
|
+
if (file_exists(DOCUMENT_PATH . '/.env')) {
|
|
159
|
+
Dotenv::createImmutable(DOCUMENT_PATH)->safeLoad();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
date_default_timezone_set(Env::string('APP_TIMEZONE', 'UTC'));
|
|
163
|
+
|
|
164
|
+
$showErrors = Env::bool('SHOW_ERRORS', false);
|
|
165
|
+
$appName = Env::string('APP_NAME', 'Prisma PHP App');
|
|
166
|
+
$appPort = Env::int('APP_PORT', 3000);
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Fail early for required secrets
|
|
170
|
+
|
|
171
|
+
```php
|
|
172
|
+
<?php
|
|
173
|
+
|
|
174
|
+
use PP\Env;
|
|
175
|
+
|
|
176
|
+
$openAiKey = Env::string('OPENAI_API_KEY', '');
|
|
177
|
+
|
|
178
|
+
if ($openAiKey === '') {
|
|
179
|
+
throw new Exception('OPENAI_API_KEY is missing.');
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Inspect a raw value directly
|
|
184
|
+
|
|
185
|
+
```php
|
|
186
|
+
<?php
|
|
187
|
+
|
|
188
|
+
use PP\Env;
|
|
189
|
+
|
|
190
|
+
$driver = Env::get('DB_DRIVER');
|
|
191
|
+
|
|
192
|
+
if ($driver === null) {
|
|
193
|
+
$driver = 'mysql';
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Example environment values
|
|
198
|
+
|
|
199
|
+
```dotenv
|
|
200
|
+
APP_NAME="Prisma PHP"
|
|
201
|
+
APP_TIMEZONE="UTC"
|
|
202
|
+
APP_PORT=3000
|
|
203
|
+
SHOW_ERRORS=true
|
|
204
|
+
OPENAI_API_KEY="sk-..."
|
|
205
|
+
DB_DRIVER="mysql"
|
|
206
|
+
MAX_UPLOAD_MB=20
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Common patterns AI should preserve
|
|
210
|
+
|
|
211
|
+
- prefer `string()`, `bool()`, and `int()` over repeated manual parsing
|
|
212
|
+
- always provide a sensible default for optional settings
|
|
213
|
+
- validate critical secrets explicitly and fail early when they are missing
|
|
214
|
+
- keep configuration reads near bootstrap or server setup when possible
|
|
215
|
+
- pass resolved configuration into the parts of the system that need it instead of re-reading the same keys everywhere
|
|
216
|
+
|
|
217
|
+
## AI rules for env tasks
|
|
218
|
+
|
|
219
|
+
- read `env.md` before generating environment-related Prisma PHP code
|
|
220
|
+
- prefer `PP\Env` over ad hoc `getenv()` parsing when working inside documented Prisma PHP code paths
|
|
221
|
+
- keep secrets and deployment values in `.env` or the runtime environment, not hardcoded in route files or components
|
|
222
|
+
- remember that `PP\Env` reads already-loaded values and does not load `.env` on its own
|
|
223
|
+
- use defaults for optional settings and explicit checks for required secrets
|
|
224
|
+
- inspect `vendor/tsnc/prisma-php/src/Env.php` only when the docs and current app code do not answer the task
|