@baldurpan/create-ai-workflow 0.2.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/LICENSE +21 -0
- package/README.md +165 -0
- package/dist/agents-block.js +70 -0
- package/dist/bin.js +14 -0
- package/dist/check/markdown.js +47 -0
- package/dist/check/parse.js +113 -0
- package/dist/check/rules.js +245 -0
- package/dist/cli.js +109 -0
- package/dist/commands/check.js +41 -0
- package/dist/commands/install.js +76 -0
- package/dist/commands/standards-add.js +145 -0
- package/dist/commands/update.js +214 -0
- package/dist/layout.js +115 -0
- package/dist/log.js +20 -0
- package/dist/manifest.js +53 -0
- package/dist/paths.js +41 -0
- package/package.json +37 -0
- package/templates/blocks/agents-block.md +30 -0
- package/templates/claude/agents/planner.agent.md +60 -0
- package/templates/claude/agents/reviewer.agent.md +77 -0
- package/templates/context/README.md +81 -0
- package/templates/context/plan-template.md +69 -0
- package/templates/context/plan-template.notes.md +55 -0
- package/templates/context/roles/coder.md +76 -0
- package/templates/context/workflow.md +143 -0
- package/templates/skills/feature-close/SKILL.md +102 -0
- package/templates/skills/feature-implement/SKILL.md +142 -0
- package/templates/skills/feature-plan/SKILL.md +138 -0
- package/templates/skills/feature-status/SKILL.md +86 -0
- package/templates/skills/onboard/SKILL.md +122 -0
- package/templates/skills/orchestrate/SKILL.md +92 -0
- package/templates/skills/roadmap/SKILL.md +97 -0
- package/templates/standards/.source +8 -0
- package/templates/standards/README.md +104 -0
- package/templates/standards/architecture/api-design.md +212 -0
- package/templates/standards/architecture/dependency-boundaries.md +104 -0
- package/templates/standards/architecture/feature-driven.md +102 -0
- package/templates/standards/architecture/folder-structure.md +108 -0
- package/templates/standards/architecture/monorepos.md +107 -0
- package/templates/standards/architecture/refactoring.md +97 -0
- package/templates/standards/architecture/shared-code.md +81 -0
- package/templates/standards/docs/PHP-SPEC.md +1195 -0
- package/templates/standards/docs/SPEC.md +540 -0
- package/templates/standards/examples/bad/data-fetching.tsx +52 -0
- package/templates/standards/examples/bad/derived-state.tsx +60 -0
- package/templates/standards/examples/bad/feature-component.tsx +80 -0
- package/templates/standards/examples/bad/prop-drilling.tsx +70 -0
- package/templates/standards/examples/good/data-fetching.tsx +53 -0
- package/templates/standards/examples/good/derived-state.tsx +52 -0
- package/templates/standards/examples/good/feature-component.tsx +141 -0
- package/templates/standards/examples/good/invoice.schema.ts +20 -0
- package/templates/standards/examples/good/prop-drilling.tsx +83 -0
- package/templates/standards/philosophy/ai-agent-behavior.md +93 -0
- package/templates/standards/philosophy/core-principles.md +49 -0
- package/templates/standards/philosophy/incremental-abstraction.md +56 -0
- package/templates/standards/philosophy/maintainability.md +66 -0
- package/templates/standards/philosophy/readability.md +87 -0
- package/templates/standards/php/README.md +62 -0
- package/templates/standards/php/anti-patterns.md +259 -0
- package/templates/standards/php/architecture.md +241 -0
- package/templates/standards/php/frameworks.md +197 -0
- package/templates/standards/php/rules.md +205 -0
- package/templates/standards/php/security.md +190 -0
- package/templates/standards/php/testing.md +139 -0
- package/templates/standards/php/tooling.md +245 -0
- package/templates/standards/react/accessibility.md +130 -0
- package/templates/standards/react/anti-patterns.md +187 -0
- package/templates/standards/react/component-design.md +139 -0
- package/templates/standards/react/error-boundaries.md +195 -0
- package/templates/standards/react/forms.md +147 -0
- package/templates/standards/react/hooks.md +88 -0
- package/templates/standards/react/memoization.md +87 -0
- package/templates/standards/react/state-management.md +123 -0
- package/templates/standards/react/testing.md +118 -0
- package/templates/standards/react/use-effect.md +110 -0
- package/templates/standards/security/api-security.md +136 -0
- package/templates/standards/security/auth.md +112 -0
- package/templates/standards/security/secrets.md +105 -0
- package/templates/standards/security/validation.md +89 -0
- package/templates/standards/templates/.editorconfig +16 -0
- package/templates/standards/templates/.nvmrc +1 -0
- package/templates/standards/templates/AGENTS.md +46 -0
- package/templates/standards/templates/CLAUDE.md +3 -0
- package/templates/standards/templates/_dot_gitignore +50 -0
- package/templates/standards/templates/biome.json +53 -0
- package/templates/standards/templates/eslint.config.js +61 -0
- package/templates/standards/templates/project-readme.md +76 -0
- package/templates/standards/templates/pull-request-template.md +46 -0
- package/templates/standards/templates/tsconfig.json +35 -0
- package/templates/standards/tooling/biome.md +92 -0
- package/templates/standards/tooling/ci.md +128 -0
- package/templates/standards/tooling/dates.md +194 -0
- package/templates/standards/tooling/dependencies.md +90 -0
- package/templates/standards/tooling/nx.md +113 -0
- package/templates/standards/tooling/observability.md +183 -0
- package/templates/standards/tooling/prisma.md +152 -0
- package/templates/standards/tooling/shadcn.md +115 -0
- package/templates/standards/tooling/tailwind.md +135 -0
- package/templates/standards/tooling/tanstack-query.md +214 -0
- package/templates/standards/tooling/tanstack-router.md +365 -0
- package/templates/standards/tooling/tanstack.md +31 -0
- package/templates/standards/tooling/vite.md +135 -0
- package/templates/standards/typescript/anti-patterns.md +107 -0
- package/templates/standards/typescript/error-handling.md +216 -0
- package/templates/standards/typescript/naming.md +78 -0
- package/templates/standards/typescript/rules.md +159 -0
- package/templates/standards/typescript/tsconfig/base.json +32 -0
- package/templates/standards/typescript/tsconfig/nextjs.json +12 -0
- package/templates/standards/typescript/tsconfig/react.json +9 -0
- package/templates/standards/typescript/validation.md +104 -0
- package/templates/stubs/executors.md +49 -0
- package/templates/stubs/findings.md +40 -0
- package/templates/stubs/history.md +13 -0
- package/templates/stubs/roadmap.md +29 -0
- package/templates/stubs/stack.md +35 -0
- package/templates/stubs/verify.md +48 -0
|
@@ -0,0 +1,1195 @@
|
|
|
1
|
+
Modern PHP Engineering Standards (2026)
|
|
2
|
+
|
|
3
|
+
Philosophy
|
|
4
|
+
|
|
5
|
+
Modern PHP is no longer “sprinkle PHP into HTML templates.”
|
|
6
|
+
|
|
7
|
+
A modern PHP codebase should:
|
|
8
|
+
|
|
9
|
+
- Be strongly typed wherever possible
|
|
10
|
+
- Follow PSR standards
|
|
11
|
+
- Prefer composition over inheritance
|
|
12
|
+
- Be framework-agnostic at the domain layer
|
|
13
|
+
- Embrace dependency injection
|
|
14
|
+
- Use async/event-driven approaches only where they truly add value
|
|
15
|
+
- Treat PHP as a serious backend engineering language
|
|
16
|
+
- Avoid global state and magic-heavy abstractions
|
|
17
|
+
- Be testable by design
|
|
18
|
+
- Favor explicitness over convenience magic
|
|
19
|
+
|
|
20
|
+
⸻
|
|
21
|
+
|
|
22
|
+
Recommended Stack Philosophy
|
|
23
|
+
|
|
24
|
+
Runtime
|
|
25
|
+
|
|
26
|
+
Target:
|
|
27
|
+
|
|
28
|
+
- PHP 8.3+
|
|
29
|
+
|
|
30
|
+
Avoid supporting ancient versions unless required by business constraints.
|
|
31
|
+
|
|
32
|
+
Modern PHP features are genuinely valuable:
|
|
33
|
+
|
|
34
|
+
- Constructor property promotion
|
|
35
|
+
- Attributes
|
|
36
|
+
- Readonly properties/classes
|
|
37
|
+
- Union/intersection types
|
|
38
|
+
- Enums
|
|
39
|
+
- Match expressions
|
|
40
|
+
- First-class callable syntax
|
|
41
|
+
- Fibers (advanced use cases)
|
|
42
|
+
|
|
43
|
+
⸻
|
|
44
|
+
|
|
45
|
+
Project Structure
|
|
46
|
+
|
|
47
|
+
Recommended structure:
|
|
48
|
+
|
|
49
|
+
src/
|
|
50
|
+
Domain/
|
|
51
|
+
Application/
|
|
52
|
+
Infrastructure/
|
|
53
|
+
Presentation/
|
|
54
|
+
config/
|
|
55
|
+
bootstrap/
|
|
56
|
+
public/
|
|
57
|
+
storage/
|
|
58
|
+
tests/
|
|
59
|
+
|
|
60
|
+
Alternative lightweight structure:
|
|
61
|
+
|
|
62
|
+
src/
|
|
63
|
+
Core/
|
|
64
|
+
Services/
|
|
65
|
+
Repositories/
|
|
66
|
+
Http/
|
|
67
|
+
Support/
|
|
68
|
+
|
|
69
|
+
Prefer clear boundaries over deep nesting.
|
|
70
|
+
|
|
71
|
+
Avoid:
|
|
72
|
+
|
|
73
|
+
src/Everything/Managers/Helpers/Utilities/Common/Shared/
|
|
74
|
+
|
|
75
|
+
If naming becomes difficult, architecture is usually becoming unclear.
|
|
76
|
+
|
|
77
|
+
⸻
|
|
78
|
+
|
|
79
|
+
Composer Standards
|
|
80
|
+
|
|
81
|
+
Always Use Composer
|
|
82
|
+
|
|
83
|
+
Never manually include files.
|
|
84
|
+
|
|
85
|
+
Use:
|
|
86
|
+
|
|
87
|
+
composer install
|
|
88
|
+
composer require
|
|
89
|
+
composer update
|
|
90
|
+
|
|
91
|
+
Use PSR-4 autoloading:
|
|
92
|
+
|
|
93
|
+
{
|
|
94
|
+
"autoload": {
|
|
95
|
+
"psr-4": {
|
|
96
|
+
"App\\": "src/"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
Then:
|
|
102
|
+
|
|
103
|
+
composer dump-autoload
|
|
104
|
+
|
|
105
|
+
⸻
|
|
106
|
+
|
|
107
|
+
PSR Standards You Should Actually Follow
|
|
108
|
+
|
|
109
|
+
PSR-1 / PSR-12
|
|
110
|
+
|
|
111
|
+
Code style and formatting.
|
|
112
|
+
|
|
113
|
+
Use:
|
|
114
|
+
|
|
115
|
+
- 4 spaces
|
|
116
|
+
- Strict formatting
|
|
117
|
+
- One class per file
|
|
118
|
+
- Clear imports
|
|
119
|
+
|
|
120
|
+
Automate with:
|
|
121
|
+
|
|
122
|
+
- PHP-CS-Fixer
|
|
123
|
+
- Laravel Pint
|
|
124
|
+
|
|
125
|
+
Never argue about formatting manually in PRs.
|
|
126
|
+
|
|
127
|
+
⸻
|
|
128
|
+
|
|
129
|
+
PSR-4
|
|
130
|
+
|
|
131
|
+
Autoloading standard.
|
|
132
|
+
|
|
133
|
+
Namespace must mirror folder structure.
|
|
134
|
+
|
|
135
|
+
namespace App\Services\Billing;
|
|
136
|
+
|
|
137
|
+
Should exist at:
|
|
138
|
+
|
|
139
|
+
src/Services/Billing/
|
|
140
|
+
|
|
141
|
+
⸻
|
|
142
|
+
|
|
143
|
+
PSR-3
|
|
144
|
+
|
|
145
|
+
Logging interface.
|
|
146
|
+
|
|
147
|
+
Use:
|
|
148
|
+
|
|
149
|
+
Psr\Log\LoggerInterface
|
|
150
|
+
|
|
151
|
+
instead of custom loggers.
|
|
152
|
+
|
|
153
|
+
⸻
|
|
154
|
+
|
|
155
|
+
PSR-7 / PSR-15
|
|
156
|
+
|
|
157
|
+
HTTP messages and middleware.
|
|
158
|
+
|
|
159
|
+
Especially valuable in:
|
|
160
|
+
|
|
161
|
+
- Slim
|
|
162
|
+
- Mezzio
|
|
163
|
+
- Symfony ecosystems
|
|
164
|
+
- Custom APIs
|
|
165
|
+
|
|
166
|
+
Understanding middleware pipelines is important.
|
|
167
|
+
|
|
168
|
+
⸻
|
|
169
|
+
|
|
170
|
+
Strict Typing
|
|
171
|
+
|
|
172
|
+
Always Enable Strict Types
|
|
173
|
+
|
|
174
|
+
At the top of every PHP file:
|
|
175
|
+
|
|
176
|
+
<?php
|
|
177
|
+
declare(strict_types=1);
|
|
178
|
+
|
|
179
|
+
This should be non-negotiable.
|
|
180
|
+
|
|
181
|
+
⸻
|
|
182
|
+
|
|
183
|
+
Type Safety Standards
|
|
184
|
+
|
|
185
|
+
Always Type Everything
|
|
186
|
+
|
|
187
|
+
Good:
|
|
188
|
+
|
|
189
|
+
public function calculateTotal(Order $order): Money
|
|
190
|
+
|
|
191
|
+
Bad:
|
|
192
|
+
|
|
193
|
+
public function calculateTotal($order)
|
|
194
|
+
|
|
195
|
+
Type:
|
|
196
|
+
|
|
197
|
+
* Parameters
|
|
198
|
+
* Return values
|
|
199
|
+
* Properties
|
|
200
|
+
* Collection generics via PHPStan/Psalm annotations
|
|
201
|
+
|
|
202
|
+
⸻
|
|
203
|
+
|
|
204
|
+
Static Analysis Is Mandatory
|
|
205
|
+
|
|
206
|
+
Use PHPStan
|
|
207
|
+
|
|
208
|
+
Target:
|
|
209
|
+
|
|
210
|
+
* PHPStan level 8 or max
|
|
211
|
+
|
|
212
|
+
Example:
|
|
213
|
+
|
|
214
|
+
composer require --dev phpstan/phpstan
|
|
215
|
+
|
|
216
|
+
Run:
|
|
217
|
+
|
|
218
|
+
vendor/bin/phpstan analyse
|
|
219
|
+
|
|
220
|
+
Static analysis catches enormous amounts of runtime bugs.
|
|
221
|
+
|
|
222
|
+
Modern PHP without static analysis is incomplete.
|
|
223
|
+
|
|
224
|
+
Psalm is also excellent.
|
|
225
|
+
|
|
226
|
+
⸻
|
|
227
|
+
|
|
228
|
+
Dependency Injection
|
|
229
|
+
|
|
230
|
+
Prefer Constructor Injection
|
|
231
|
+
|
|
232
|
+
Good:
|
|
233
|
+
|
|
234
|
+
final class OrderService
|
|
235
|
+
{
|
|
236
|
+
public function __construct(
|
|
237
|
+
private readonly PaymentGateway $payments,
|
|
238
|
+
) {}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
Avoid:
|
|
242
|
+
|
|
243
|
+
* Service locators
|
|
244
|
+
* Facade abuse
|
|
245
|
+
* Global helpers
|
|
246
|
+
* Static singleton state
|
|
247
|
+
|
|
248
|
+
⸻
|
|
249
|
+
|
|
250
|
+
Prefer Immutable Objects
|
|
251
|
+
|
|
252
|
+
Use readonly properties/classes when possible.
|
|
253
|
+
|
|
254
|
+
Good:
|
|
255
|
+
|
|
256
|
+
final readonly class Money
|
|
257
|
+
{
|
|
258
|
+
public function __construct(
|
|
259
|
+
public int $amount,
|
|
260
|
+
public string $currency,
|
|
261
|
+
) {}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
Immutable objects reduce debugging complexity significantly.
|
|
265
|
+
|
|
266
|
+
⸻
|
|
267
|
+
|
|
268
|
+
Value Objects Over Primitive Obsession
|
|
269
|
+
|
|
270
|
+
Avoid passing loose strings and arrays everywhere.
|
|
271
|
+
|
|
272
|
+
Bad:
|
|
273
|
+
|
|
274
|
+
createUser(string $email)
|
|
275
|
+
|
|
276
|
+
Better:
|
|
277
|
+
|
|
278
|
+
createUser(EmailAddress $email)
|
|
279
|
+
|
|
280
|
+
Common value objects:
|
|
281
|
+
|
|
282
|
+
* EmailAddress
|
|
283
|
+
* Money
|
|
284
|
+
* UserId
|
|
285
|
+
* OrderId
|
|
286
|
+
* PhoneNumber
|
|
287
|
+
* Currency
|
|
288
|
+
* DateRange
|
|
289
|
+
|
|
290
|
+
⸻
|
|
291
|
+
|
|
292
|
+
Arrays Are Overused in PHP
|
|
293
|
+
|
|
294
|
+
Avoid “God arrays.”
|
|
295
|
+
|
|
296
|
+
Bad:
|
|
297
|
+
|
|
298
|
+
$user['email']
|
|
299
|
+
|
|
300
|
+
Prefer DTOs or value objects.
|
|
301
|
+
|
|
302
|
+
Good:
|
|
303
|
+
|
|
304
|
+
$user->email
|
|
305
|
+
|
|
306
|
+
Or:
|
|
307
|
+
|
|
308
|
+
$user->email()
|
|
309
|
+
|
|
310
|
+
⸻
|
|
311
|
+
|
|
312
|
+
DTO Standards
|
|
313
|
+
|
|
314
|
+
DTOs are extremely useful for:
|
|
315
|
+
|
|
316
|
+
* Request validation
|
|
317
|
+
* API boundaries
|
|
318
|
+
* Queue payloads
|
|
319
|
+
* Service communication
|
|
320
|
+
|
|
321
|
+
Example:
|
|
322
|
+
|
|
323
|
+
final readonly class CreateUserDTO
|
|
324
|
+
{
|
|
325
|
+
public function __construct(
|
|
326
|
+
public string $name,
|
|
327
|
+
public string $email,
|
|
328
|
+
) {}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
⸻
|
|
332
|
+
|
|
333
|
+
Architecture Recommendations
|
|
334
|
+
|
|
335
|
+
Recommended Default
|
|
336
|
+
|
|
337
|
+
For most systems:
|
|
338
|
+
|
|
339
|
+
* Modular monolith first
|
|
340
|
+
* Domain-driven boundaries
|
|
341
|
+
* Clear application layer
|
|
342
|
+
* Avoid premature microservices
|
|
343
|
+
|
|
344
|
+
A well-structured modular monolith outperforms poorly managed microservices almost every time.
|
|
345
|
+
|
|
346
|
+
⸻
|
|
347
|
+
|
|
348
|
+
Layer Responsibilities
|
|
349
|
+
|
|
350
|
+
Domain Layer
|
|
351
|
+
|
|
352
|
+
Contains:
|
|
353
|
+
|
|
354
|
+
* Business rules
|
|
355
|
+
* Entities
|
|
356
|
+
* Value objects
|
|
357
|
+
* Domain services
|
|
358
|
+
* Domain events
|
|
359
|
+
|
|
360
|
+
Should NOT know about:
|
|
361
|
+
|
|
362
|
+
* Frameworks
|
|
363
|
+
* HTTP
|
|
364
|
+
* Databases
|
|
365
|
+
* Queues
|
|
366
|
+
* Redis
|
|
367
|
+
* External APIs
|
|
368
|
+
|
|
369
|
+
⸻
|
|
370
|
+
|
|
371
|
+
Application Layer
|
|
372
|
+
|
|
373
|
+
Coordinates use cases.
|
|
374
|
+
|
|
375
|
+
Contains:
|
|
376
|
+
|
|
377
|
+
* Commands
|
|
378
|
+
* Queries
|
|
379
|
+
* Handlers
|
|
380
|
+
* Orchestration
|
|
381
|
+
* Transactions
|
|
382
|
+
|
|
383
|
+
Should be thin.
|
|
384
|
+
|
|
385
|
+
⸻
|
|
386
|
+
|
|
387
|
+
Infrastructure Layer
|
|
388
|
+
|
|
389
|
+
Contains:
|
|
390
|
+
|
|
391
|
+
* Database access
|
|
392
|
+
* Redis
|
|
393
|
+
* Filesystems
|
|
394
|
+
* APIs
|
|
395
|
+
* Queue adapters
|
|
396
|
+
* Framework integration
|
|
397
|
+
|
|
398
|
+
Framework code belongs here.
|
|
399
|
+
|
|
400
|
+
⸻
|
|
401
|
+
|
|
402
|
+
Presentation Layer
|
|
403
|
+
|
|
404
|
+
Contains:
|
|
405
|
+
|
|
406
|
+
* Controllers
|
|
407
|
+
* HTTP handling
|
|
408
|
+
* Validation
|
|
409
|
+
* Serialization
|
|
410
|
+
* Response mapping
|
|
411
|
+
|
|
412
|
+
Controllers should stay thin.
|
|
413
|
+
|
|
414
|
+
⸻
|
|
415
|
+
|
|
416
|
+
Database Standards
|
|
417
|
+
|
|
418
|
+
Use Migrations
|
|
419
|
+
|
|
420
|
+
Never manually mutate production databases.
|
|
421
|
+
|
|
422
|
+
Use:
|
|
423
|
+
|
|
424
|
+
* Laravel migrations
|
|
425
|
+
* Doctrine migrations
|
|
426
|
+
* Phinx
|
|
427
|
+
|
|
428
|
+
⸻
|
|
429
|
+
|
|
430
|
+
ORM Guidance
|
|
431
|
+
|
|
432
|
+
ORMs Are Tools, Not Architecture
|
|
433
|
+
|
|
434
|
+
Use:
|
|
435
|
+
|
|
436
|
+
* Eloquent
|
|
437
|
+
* Doctrine
|
|
438
|
+
|
|
439
|
+
But avoid leaking ORM models everywhere.
|
|
440
|
+
|
|
441
|
+
Domain logic should not depend heavily on ORM internals.
|
|
442
|
+
|
|
443
|
+
⸻
|
|
444
|
+
|
|
445
|
+
Repository Guidance
|
|
446
|
+
|
|
447
|
+
Repositories are useful when:
|
|
448
|
+
|
|
449
|
+
* Abstracting persistence complexity
|
|
450
|
+
* Supporting domain boundaries
|
|
451
|
+
* Avoiding ORM leakage
|
|
452
|
+
|
|
453
|
+
Repositories are NOT useful when:
|
|
454
|
+
|
|
455
|
+
* They simply mirror ORM methods
|
|
456
|
+
* They become generic CRUD wrappers
|
|
457
|
+
|
|
458
|
+
Bad:
|
|
459
|
+
|
|
460
|
+
UserRepository->find()
|
|
461
|
+
UserRepository->save()
|
|
462
|
+
UserRepository->delete()
|
|
463
|
+
|
|
464
|
+
Good:
|
|
465
|
+
|
|
466
|
+
UserRepository->findActiveSubscribers()
|
|
467
|
+
|
|
468
|
+
⸻
|
|
469
|
+
|
|
470
|
+
Validation
|
|
471
|
+
|
|
472
|
+
Validation belongs at boundaries.
|
|
473
|
+
|
|
474
|
+
Examples:
|
|
475
|
+
|
|
476
|
+
* HTTP request validation
|
|
477
|
+
* Message validation
|
|
478
|
+
* DTO validation
|
|
479
|
+
|
|
480
|
+
Do not scatter validation logic randomly across services.
|
|
481
|
+
|
|
482
|
+
⸻
|
|
483
|
+
|
|
484
|
+
Exceptions
|
|
485
|
+
|
|
486
|
+
Exceptions Are For Exceptional Situations
|
|
487
|
+
|
|
488
|
+
Do not use exceptions for standard control flow.
|
|
489
|
+
|
|
490
|
+
Good candidates:
|
|
491
|
+
|
|
492
|
+
* Infrastructure failures
|
|
493
|
+
* Invalid state
|
|
494
|
+
* External service issues
|
|
495
|
+
* Security violations
|
|
496
|
+
|
|
497
|
+
Avoid:
|
|
498
|
+
|
|
499
|
+
try {
|
|
500
|
+
return false;
|
|
501
|
+
} catch (...) {}
|
|
502
|
+
|
|
503
|
+
⸻
|
|
504
|
+
|
|
505
|
+
Error Handling
|
|
506
|
+
|
|
507
|
+
Use structured exception hierarchies.
|
|
508
|
+
|
|
509
|
+
Example:
|
|
510
|
+
|
|
511
|
+
DomainException
|
|
512
|
+
InfrastructureException
|
|
513
|
+
ValidationException
|
|
514
|
+
AuthenticationException
|
|
515
|
+
|
|
516
|
+
Avoid giant catch-all exception patterns.
|
|
517
|
+
|
|
518
|
+
⸻
|
|
519
|
+
|
|
520
|
+
Async Processing
|
|
521
|
+
|
|
522
|
+
Use queues for:
|
|
523
|
+
|
|
524
|
+
* Emails
|
|
525
|
+
* Webhooks
|
|
526
|
+
* Heavy processing
|
|
527
|
+
* Video/image processing
|
|
528
|
+
* AI jobs
|
|
529
|
+
* Reporting
|
|
530
|
+
|
|
531
|
+
Avoid synchronous HTTP chains for long-running work.
|
|
532
|
+
|
|
533
|
+
⸻
|
|
534
|
+
|
|
535
|
+
Queue Recommendations
|
|
536
|
+
|
|
537
|
+
Common options:
|
|
538
|
+
|
|
539
|
+
* Redis queues
|
|
540
|
+
* RabbitMQ
|
|
541
|
+
* SQS
|
|
542
|
+
|
|
543
|
+
Laravel Horizon is excellent for queue visibility.
|
|
544
|
+
|
|
545
|
+
⸻
|
|
546
|
+
|
|
547
|
+
API Standards
|
|
548
|
+
|
|
549
|
+
Prefer JSON APIs
|
|
550
|
+
|
|
551
|
+
Typical modern stack:
|
|
552
|
+
|
|
553
|
+
* REST
|
|
554
|
+
* GraphQL
|
|
555
|
+
* Hybrid approaches
|
|
556
|
+
|
|
557
|
+
Use:
|
|
558
|
+
|
|
559
|
+
* OpenAPI/Swagger
|
|
560
|
+
* Typed DTOs
|
|
561
|
+
* Consistent error structures
|
|
562
|
+
|
|
563
|
+
⸻
|
|
564
|
+
|
|
565
|
+
API Response Standards
|
|
566
|
+
|
|
567
|
+
Good:
|
|
568
|
+
|
|
569
|
+
{
|
|
570
|
+
"data": {},
|
|
571
|
+
"meta": {},
|
|
572
|
+
"errors": []
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
Avoid inconsistent response shapes.
|
|
576
|
+
|
|
577
|
+
⸻
|
|
578
|
+
|
|
579
|
+
Authentication
|
|
580
|
+
|
|
581
|
+
Prefer:
|
|
582
|
+
|
|
583
|
+
* OAuth2
|
|
584
|
+
* OpenID Connect
|
|
585
|
+
* JWT carefully
|
|
586
|
+
* Session auth for web apps
|
|
587
|
+
|
|
588
|
+
Never roll your own crypto/authentication.
|
|
589
|
+
|
|
590
|
+
⸻
|
|
591
|
+
|
|
592
|
+
Security Standards
|
|
593
|
+
|
|
594
|
+
Non-Negotiables
|
|
595
|
+
|
|
596
|
+
Always:
|
|
597
|
+
|
|
598
|
+
* Hash passwords with Argon2id or bcrypt
|
|
599
|
+
* Escape output
|
|
600
|
+
* Use prepared statements
|
|
601
|
+
* Validate uploads
|
|
602
|
+
* Sanitize file paths
|
|
603
|
+
* Implement CSRF protection where relevant
|
|
604
|
+
* Rate limit APIs
|
|
605
|
+
* Store secrets in environment variables
|
|
606
|
+
|
|
607
|
+
Never:
|
|
608
|
+
|
|
609
|
+
* Commit secrets
|
|
610
|
+
* Trust user input
|
|
611
|
+
* Build SQL strings manually
|
|
612
|
+
|
|
613
|
+
⸻
|
|
614
|
+
|
|
615
|
+
Configuration Standards
|
|
616
|
+
|
|
617
|
+
Use environment-based configuration.
|
|
618
|
+
|
|
619
|
+
Example:
|
|
620
|
+
|
|
621
|
+
APP_ENV=production
|
|
622
|
+
DB_HOST=localhost
|
|
623
|
+
|
|
624
|
+
Never read env values directly throughout the app.
|
|
625
|
+
|
|
626
|
+
Centralize configuration access.
|
|
627
|
+
|
|
628
|
+
⸻
|
|
629
|
+
|
|
630
|
+
Testing Standards
|
|
631
|
+
|
|
632
|
+
Minimum Expectations
|
|
633
|
+
|
|
634
|
+
Every modern PHP project should have:
|
|
635
|
+
|
|
636
|
+
* Unit tests
|
|
637
|
+
* Integration tests
|
|
638
|
+
* Basic end-to-end coverage
|
|
639
|
+
|
|
640
|
+
Recommended:
|
|
641
|
+
|
|
642
|
+
* Pest
|
|
643
|
+
* PHPUnit
|
|
644
|
+
|
|
645
|
+
Pest is especially pleasant for modern teams.
|
|
646
|
+
|
|
647
|
+
⸻
|
|
648
|
+
|
|
649
|
+
Test Philosophy
|
|
650
|
+
|
|
651
|
+
Test behavior, not implementation.
|
|
652
|
+
|
|
653
|
+
Bad:
|
|
654
|
+
|
|
655
|
+
expects()->method('setValue')
|
|
656
|
+
|
|
657
|
+
Better:
|
|
658
|
+
|
|
659
|
+
assertEquals('active', $user->status())
|
|
660
|
+
|
|
661
|
+
Avoid over-mocking.
|
|
662
|
+
|
|
663
|
+
⸻
|
|
664
|
+
|
|
665
|
+
Framework Recommendations
|
|
666
|
+
|
|
667
|
+
Laravel
|
|
668
|
+
|
|
669
|
+
Best for:
|
|
670
|
+
|
|
671
|
+
* Product teams
|
|
672
|
+
* Rapid development
|
|
673
|
+
* Startups
|
|
674
|
+
* Internal systems
|
|
675
|
+
* APIs
|
|
676
|
+
|
|
677
|
+
Strengths:
|
|
678
|
+
|
|
679
|
+
* Developer experience
|
|
680
|
+
* Ecosystem
|
|
681
|
+
* Tooling
|
|
682
|
+
* Queues
|
|
683
|
+
* Authentication
|
|
684
|
+
* Testing support
|
|
685
|
+
|
|
686
|
+
Risks:
|
|
687
|
+
|
|
688
|
+
* Facade overuse
|
|
689
|
+
* Magic-heavy architecture
|
|
690
|
+
* Fat models/controllers
|
|
691
|
+
|
|
692
|
+
Use Laravel carefully and it scales well organizationally.
|
|
693
|
+
|
|
694
|
+
⸻
|
|
695
|
+
|
|
696
|
+
Symfony
|
|
697
|
+
|
|
698
|
+
Best for:
|
|
699
|
+
|
|
700
|
+
* Large enterprise systems
|
|
701
|
+
* Long-lived platforms
|
|
702
|
+
* Highly structured teams
|
|
703
|
+
|
|
704
|
+
Strengths:
|
|
705
|
+
|
|
706
|
+
* Explicit architecture
|
|
707
|
+
* Strong DI container
|
|
708
|
+
* Stability
|
|
709
|
+
* Mature components
|
|
710
|
+
|
|
711
|
+
Tradeoff:
|
|
712
|
+
|
|
713
|
+
* Slower onboarding
|
|
714
|
+
* More ceremony
|
|
715
|
+
|
|
716
|
+
⸻
|
|
717
|
+
|
|
718
|
+
Slim
|
|
719
|
+
|
|
720
|
+
Best for:
|
|
721
|
+
|
|
722
|
+
* Lightweight APIs
|
|
723
|
+
* Minimal systems
|
|
724
|
+
* Custom architectures
|
|
725
|
+
|
|
726
|
+
Good when you want maximum control.
|
|
727
|
+
|
|
728
|
+
⸻
|
|
729
|
+
|
|
730
|
+
Modern PHP Patterns
|
|
731
|
+
|
|
732
|
+
CQRS
|
|
733
|
+
|
|
734
|
+
Useful when:
|
|
735
|
+
|
|
736
|
+
* Read/write models differ heavily
|
|
737
|
+
* Complex workflows exist
|
|
738
|
+
* Scaling queries separately matters
|
|
739
|
+
|
|
740
|
+
Avoid introducing CQRS purely because it sounds advanced.
|
|
741
|
+
|
|
742
|
+
⸻
|
|
743
|
+
|
|
744
|
+
Event-Driven Design
|
|
745
|
+
|
|
746
|
+
Useful for:
|
|
747
|
+
|
|
748
|
+
* Decoupling workflows
|
|
749
|
+
* Notifications
|
|
750
|
+
* Auditing
|
|
751
|
+
* Integrations
|
|
752
|
+
|
|
753
|
+
Avoid event explosion.
|
|
754
|
+
|
|
755
|
+
Not everything should become an event.
|
|
756
|
+
|
|
757
|
+
⸻
|
|
758
|
+
|
|
759
|
+
Caching
|
|
760
|
+
|
|
761
|
+
Use caching intentionally.
|
|
762
|
+
|
|
763
|
+
Common layers:
|
|
764
|
+
|
|
765
|
+
* Query caching
|
|
766
|
+
* HTTP caching
|
|
767
|
+
* Redis caching
|
|
768
|
+
* Computed result caching
|
|
769
|
+
|
|
770
|
+
Never cache blindly.
|
|
771
|
+
|
|
772
|
+
Measure first.
|
|
773
|
+
|
|
774
|
+
⸻
|
|
775
|
+
|
|
776
|
+
Performance Reality
|
|
777
|
+
|
|
778
|
+
Most PHP performance issues are:
|
|
779
|
+
|
|
780
|
+
* N+1 queries
|
|
781
|
+
* Bad database indexes
|
|
782
|
+
* Excessive serialization
|
|
783
|
+
* Unbounded loops
|
|
784
|
+
* Blocking external APIs
|
|
785
|
+
* Memory-heavy collections
|
|
786
|
+
|
|
787
|
+
Not “PHP is slow.”
|
|
788
|
+
|
|
789
|
+
⸻
|
|
790
|
+
|
|
791
|
+
Observability
|
|
792
|
+
|
|
793
|
+
Minimum production standards:
|
|
794
|
+
|
|
795
|
+
* Structured logging
|
|
796
|
+
* Error tracking
|
|
797
|
+
* Metrics
|
|
798
|
+
* Health checks
|
|
799
|
+
* Request tracing where useful
|
|
800
|
+
|
|
801
|
+
Recommended tools:
|
|
802
|
+
|
|
803
|
+
* Sentry
|
|
804
|
+
* OpenTelemetry
|
|
805
|
+
* Prometheus
|
|
806
|
+
* Grafana
|
|
807
|
+
|
|
808
|
+
⸻
|
|
809
|
+
|
|
810
|
+
Docker Standards
|
|
811
|
+
|
|
812
|
+
Prefer containerized local development.
|
|
813
|
+
|
|
814
|
+
Typical stack:
|
|
815
|
+
|
|
816
|
+
* PHP-FPM
|
|
817
|
+
* Nginx/Caddy
|
|
818
|
+
* Redis
|
|
819
|
+
* PostgreSQL/MySQL
|
|
820
|
+
|
|
821
|
+
Avoid “works on my machine” setups.
|
|
822
|
+
|
|
823
|
+
⸻
|
|
824
|
+
|
|
825
|
+
Preferred Database Choices
|
|
826
|
+
|
|
827
|
+
PostgreSQL First
|
|
828
|
+
|
|
829
|
+
Prefer PostgreSQL unless there is a strong reason otherwise.
|
|
830
|
+
|
|
831
|
+
Advantages:
|
|
832
|
+
|
|
833
|
+
* Reliability
|
|
834
|
+
* Advanced indexing
|
|
835
|
+
* JSON support
|
|
836
|
+
* Better SQL features
|
|
837
|
+
* Strong concurrency
|
|
838
|
+
|
|
839
|
+
MySQL is still completely valid.
|
|
840
|
+
|
|
841
|
+
SQLite is excellent for:
|
|
842
|
+
|
|
843
|
+
* Local development
|
|
844
|
+
* Small apps
|
|
845
|
+
* Embedded systems
|
|
846
|
+
* Testing
|
|
847
|
+
|
|
848
|
+
⸻
|
|
849
|
+
|
|
850
|
+
Frontend Integration
|
|
851
|
+
|
|
852
|
+
Common modern approaches:
|
|
853
|
+
|
|
854
|
+
* PHP API + React/Vue frontend
|
|
855
|
+
* Laravel + Inertia
|
|
856
|
+
* Blade/Twig for server rendering
|
|
857
|
+
* HTMX for simpler systems
|
|
858
|
+
|
|
859
|
+
Avoid prematurely overengineering frontend architecture.
|
|
860
|
+
|
|
861
|
+
⸻
|
|
862
|
+
|
|
863
|
+
CI/CD Standards
|
|
864
|
+
|
|
865
|
+
Every repository should include:
|
|
866
|
+
|
|
867
|
+
* Linting
|
|
868
|
+
* Static analysis
|
|
869
|
+
* Tests
|
|
870
|
+
* Security scanning
|
|
871
|
+
* Build validation
|
|
872
|
+
|
|
873
|
+
CI should fail on:
|
|
874
|
+
|
|
875
|
+
* Formatting issues
|
|
876
|
+
* Static analysis violations
|
|
877
|
+
* Test failures
|
|
878
|
+
|
|
879
|
+
⸻
|
|
880
|
+
|
|
881
|
+
Git Standards
|
|
882
|
+
|
|
883
|
+
Branch Strategy
|
|
884
|
+
|
|
885
|
+
Simple is usually best:
|
|
886
|
+
|
|
887
|
+
* main
|
|
888
|
+
* feature/*
|
|
889
|
+
* fix/*
|
|
890
|
+
|
|
891
|
+
Avoid overly complicated GitFlow unless organizationally necessary.
|
|
892
|
+
|
|
893
|
+
⸻
|
|
894
|
+
|
|
895
|
+
Pull Request Standards
|
|
896
|
+
|
|
897
|
+
PRs should:
|
|
898
|
+
|
|
899
|
+
* Be small enough to review
|
|
900
|
+
* Include tests
|
|
901
|
+
* Explain architectural decisions
|
|
902
|
+
* Avoid mixing unrelated concerns
|
|
903
|
+
|
|
904
|
+
Large PRs reduce review quality dramatically.
|
|
905
|
+
|
|
906
|
+
⸻
|
|
907
|
+
|
|
908
|
+
Code Review Standards
|
|
909
|
+
|
|
910
|
+
Review for:
|
|
911
|
+
|
|
912
|
+
* Architecture
|
|
913
|
+
* Correctness
|
|
914
|
+
* Maintainability
|
|
915
|
+
* Simplicity
|
|
916
|
+
* Naming clarity
|
|
917
|
+
* Boundary violations
|
|
918
|
+
|
|
919
|
+
Avoid nitpicking formatting.
|
|
920
|
+
|
|
921
|
+
Automation should handle style.
|
|
922
|
+
|
|
923
|
+
⸻
|
|
924
|
+
|
|
925
|
+
Naming Standards
|
|
926
|
+
|
|
927
|
+
Good naming matters enormously in PHP.
|
|
928
|
+
|
|
929
|
+
Prefer:
|
|
930
|
+
|
|
931
|
+
CalculateInvoiceTotals
|
|
932
|
+
|
|
933
|
+
Over:
|
|
934
|
+
|
|
935
|
+
InvoiceManager
|
|
936
|
+
|
|
937
|
+
Avoid vague words:
|
|
938
|
+
|
|
939
|
+
* Manager
|
|
940
|
+
* Helper
|
|
941
|
+
* Util
|
|
942
|
+
* Common
|
|
943
|
+
* Base
|
|
944
|
+
* Handler (unless actually a handler)
|
|
945
|
+
|
|
946
|
+
Names should describe responsibility.
|
|
947
|
+
|
|
948
|
+
⸻
|
|
949
|
+
|
|
950
|
+
Traits Guidance
|
|
951
|
+
|
|
952
|
+
Traits are often overused.
|
|
953
|
+
|
|
954
|
+
Use traits for:
|
|
955
|
+
|
|
956
|
+
* Shared implementation details
|
|
957
|
+
* Truly cross-cutting behavior
|
|
958
|
+
|
|
959
|
+
Avoid trait pyramids and hidden coupling.
|
|
960
|
+
|
|
961
|
+
Prefer composition first.
|
|
962
|
+
|
|
963
|
+
⸻
|
|
964
|
+
|
|
965
|
+
Inheritance Guidance
|
|
966
|
+
|
|
967
|
+
Prefer composition over inheritance.
|
|
968
|
+
|
|
969
|
+
Avoid deep inheritance chains.
|
|
970
|
+
|
|
971
|
+
Usually:
|
|
972
|
+
|
|
973
|
+
BaseController
|
|
974
|
+
-> ApiController
|
|
975
|
+
-> VersionedController
|
|
976
|
+
-> UserController
|
|
977
|
+
|
|
978
|
+
is a design smell.
|
|
979
|
+
|
|
980
|
+
⸻
|
|
981
|
+
|
|
982
|
+
Laravel-Specific Best Practices
|
|
983
|
+
|
|
984
|
+
If using Laravel:
|
|
985
|
+
|
|
986
|
+
Prefer:
|
|
987
|
+
|
|
988
|
+
* Form requests
|
|
989
|
+
* Service classes
|
|
990
|
+
* Jobs/events/listeners
|
|
991
|
+
* Policies
|
|
992
|
+
* Resource transformers
|
|
993
|
+
* Scoped bindings
|
|
994
|
+
* Eager loading
|
|
995
|
+
|
|
996
|
+
Avoid:
|
|
997
|
+
|
|
998
|
+
* Fat controllers
|
|
999
|
+
* Fat Eloquent models
|
|
1000
|
+
* Business logic in routes
|
|
1001
|
+
* Massive service providers
|
|
1002
|
+
* Hidden magic macros everywhere
|
|
1003
|
+
* Global helpers for core business logic
|
|
1004
|
+
|
|
1005
|
+
⸻
|
|
1006
|
+
|
|
1007
|
+
AI Engineering + PHP
|
|
1008
|
+
|
|
1009
|
+
PHP works surprisingly well for:
|
|
1010
|
+
|
|
1011
|
+
* AI orchestration APIs
|
|
1012
|
+
* Internal tooling
|
|
1013
|
+
* Queue-based AI workflows
|
|
1014
|
+
* RAG dashboards
|
|
1015
|
+
* Embedding pipelines
|
|
1016
|
+
* CMS-integrated AI features
|
|
1017
|
+
|
|
1018
|
+
But Python still dominates:
|
|
1019
|
+
|
|
1020
|
+
* ML training
|
|
1021
|
+
* Data science
|
|
1022
|
+
* Experimental AI tooling
|
|
1023
|
+
|
|
1024
|
+
A practical architecture is often:
|
|
1025
|
+
|
|
1026
|
+
PHP -> orchestration/business system
|
|
1027
|
+
Python -> ML/data pipeline
|
|
1028
|
+
|
|
1029
|
+
Connected via:
|
|
1030
|
+
|
|
1031
|
+
* HTTP
|
|
1032
|
+
* Queues
|
|
1033
|
+
* gRPC
|
|
1034
|
+
* Kafka
|
|
1035
|
+
|
|
1036
|
+
⸻
|
|
1037
|
+
|
|
1038
|
+
Recommended Modern PHP Tooling
|
|
1039
|
+
|
|
1040
|
+
Core
|
|
1041
|
+
|
|
1042
|
+
* Composer
|
|
1043
|
+
* PHPStan
|
|
1044
|
+
* Pint or PHP-CS-Fixer
|
|
1045
|
+
* PHPUnit or Pest
|
|
1046
|
+
* Rector
|
|
1047
|
+
|
|
1048
|
+
⸻
|
|
1049
|
+
|
|
1050
|
+
Useful Additions
|
|
1051
|
+
|
|
1052
|
+
* Laravel Herd / Valet
|
|
1053
|
+
* Docker Compose
|
|
1054
|
+
* Xdebug
|
|
1055
|
+
* Telescope
|
|
1056
|
+
* Horizon
|
|
1057
|
+
* Symfony Profiler
|
|
1058
|
+
|
|
1059
|
+
⸻
|
|
1060
|
+
|
|
1061
|
+
Rector
|
|
1062
|
+
|
|
1063
|
+
Rector is extremely valuable for automated refactors and PHP upgrades.
|
|
1064
|
+
|
|
1065
|
+
Example:
|
|
1066
|
+
|
|
1067
|
+
composer require rector/rector --dev
|
|
1068
|
+
|
|
1069
|
+
Useful for:
|
|
1070
|
+
|
|
1071
|
+
* Framework upgrades
|
|
1072
|
+
* PHP version upgrades
|
|
1073
|
+
* Automated modernization
|
|
1074
|
+
|
|
1075
|
+
⸻
|
|
1076
|
+
|
|
1077
|
+
Suggested Default Standards for New PHP Repositories
|
|
1078
|
+
|
|
1079
|
+
Baseline
|
|
1080
|
+
|
|
1081
|
+
* PHP 8.3+
|
|
1082
|
+
* Strict types enabled everywhere
|
|
1083
|
+
* PHPStan max level
|
|
1084
|
+
* Pint or PHP-CS-Fixer
|
|
1085
|
+
* Pest or PHPUnit
|
|
1086
|
+
* Dockerized dev environment
|
|
1087
|
+
* PostgreSQL
|
|
1088
|
+
* Redis
|
|
1089
|
+
* Structured logging
|
|
1090
|
+
* CI/CD from day one
|
|
1091
|
+
|
|
1092
|
+
⸻
|
|
1093
|
+
|
|
1094
|
+
Suggested AI Coding Rules for PHP
|
|
1095
|
+
|
|
1096
|
+
Architectural Rules
|
|
1097
|
+
|
|
1098
|
+
* Domain logic must not depend on framework code
|
|
1099
|
+
* Controllers stay thin
|
|
1100
|
+
* No business logic in routes
|
|
1101
|
+
* Prefer immutable DTOs/value objects
|
|
1102
|
+
* Prefer constructor injection
|
|
1103
|
+
* Avoid static state
|
|
1104
|
+
* Avoid hidden magic
|
|
1105
|
+
* Prefer explicit return types
|
|
1106
|
+
* Keep services focused and composable
|
|
1107
|
+
|
|
1108
|
+
⸻
|
|
1109
|
+
|
|
1110
|
+
Code Quality Rules
|
|
1111
|
+
|
|
1112
|
+
* Strict types required
|
|
1113
|
+
* PHPStan must pass at max level
|
|
1114
|
+
* No unused public methods
|
|
1115
|
+
* Avoid giant arrays as data contracts
|
|
1116
|
+
* Avoid generic “Manager” classes
|
|
1117
|
+
* Prefer descriptive naming
|
|
1118
|
+
* Prefer composition over inheritance
|
|
1119
|
+
|
|
1120
|
+
⸻
|
|
1121
|
+
|
|
1122
|
+
Testing Rules
|
|
1123
|
+
|
|
1124
|
+
* New features require tests
|
|
1125
|
+
* Integration tests for critical workflows
|
|
1126
|
+
* Avoid excessive mocking
|
|
1127
|
+
* Test behavior over implementation
|
|
1128
|
+
|
|
1129
|
+
⸻
|
|
1130
|
+
|
|
1131
|
+
Things Old PHP Codebases Commonly Get Wrong
|
|
1132
|
+
|
|
1133
|
+
Warning Signs
|
|
1134
|
+
|
|
1135
|
+
* Global state everywhere
|
|
1136
|
+
* Massive helper files
|
|
1137
|
+
* Hidden framework magic
|
|
1138
|
+
* Business logic in controllers
|
|
1139
|
+
* ActiveRecord abuse
|
|
1140
|
+
* Mixed HTML/PHP spaghetti
|
|
1141
|
+
* No static analysis
|
|
1142
|
+
* No types
|
|
1143
|
+
* Array-driven architecture
|
|
1144
|
+
* Singleton-heavy code
|
|
1145
|
+
* God services
|
|
1146
|
+
* Fat inheritance trees
|
|
1147
|
+
|
|
1148
|
+
These systems become difficult to evolve safely.
|
|
1149
|
+
|
|
1150
|
+
⸻
|
|
1151
|
+
|
|
1152
|
+
Practical Modern PHP Mindset
|
|
1153
|
+
|
|
1154
|
+
Modern PHP is at its best when treated similarly to:
|
|
1155
|
+
|
|
1156
|
+
* C#
|
|
1157
|
+
* Kotlin
|
|
1158
|
+
* Java
|
|
1159
|
+
* TypeScript backend systems
|
|
1160
|
+
|
|
1161
|
+
Meaning:
|
|
1162
|
+
|
|
1163
|
+
* Typed
|
|
1164
|
+
* Structured
|
|
1165
|
+
* Explicit
|
|
1166
|
+
* Layered
|
|
1167
|
+
* Testable
|
|
1168
|
+
* Observable
|
|
1169
|
+
* Automated
|
|
1170
|
+
|
|
1171
|
+
Not:
|
|
1172
|
+
|
|
1173
|
+
Random PHP files executing hidden side effects.
|
|
1174
|
+
|
|
1175
|
+
⸻
|
|
1176
|
+
|
|
1177
|
+
Final Recommendation
|
|
1178
|
+
|
|
1179
|
+
If you return to PHP today:
|
|
1180
|
+
|
|
1181
|
+
Do NOT learn “old PHP.”
|
|
1182
|
+
|
|
1183
|
+
Learn:
|
|
1184
|
+
|
|
1185
|
+
* PHP 8.3+
|
|
1186
|
+
* Typed architecture
|
|
1187
|
+
* Static analysis
|
|
1188
|
+
* PSR standards
|
|
1189
|
+
* Modern framework practices
|
|
1190
|
+
* Modular architecture
|
|
1191
|
+
* Queue-driven workflows
|
|
1192
|
+
* Proper testing
|
|
1193
|
+
* Infrastructure automation
|
|
1194
|
+
|
|
1195
|
+
Modern PHP is genuinely productive when approached with strong engineering discipline.
|