home/productivity/plain-php

Plain Php

GPTClaudeDeepSeek··277 copies·updated 2026-07-14
plain-php.prompt
# Plain PHP Framework Guide

This file is automatically included by the motspilot pipeline when `FRAMEWORK="plain-php"` is set in config. It provides conventions for PHP projects **without a full-stack framework** — no Laravel, Symfony, CakePHP, CodeIgniter. Expect hand-rolled PDO, procedural or lightly-OO code, Composer-optional, PSR-4 autoloading if lucky.

<framework_tool_affinity>
Plain-PHP-specific tool routing:
- Use `php -l <file>` to syntax-check every modified file — no framework CLI to fall back on.
- Use `composer dump-autoload` after adding new classes if PSR-4 autoloading is present.
- For constant values: grep the project root for existing `define()` or `const` declarations before defining new ones.
- For database: prefer prepared statements via PDO. Never interpolate user input into SQL strings.
</framework_tool_affinity>

---

## Version Reference

**Target: PHP 8.1+ (8.2–8.5 are the actively supported branches as of 2026).** Do not use PHP 7.x-only patterns. Pick a minimum that matches hosting and test the minimum in CI.

| What | PHP 8.x (preferred) | PHP 7.x (avoid) |
|------|-------------------|------------------------------|
| Null safe chaining | `$user?->email` | `isset($user) ? $user->email : null` |
| Named args | `htmlspecialchars(string: $x, flags: ENT_QUOTES)` | Positional only |
| First-class callable | `htmlspecialchars(...)` | `'htmlspecialchars'` string |
| Constructor promotion | `public function __construct(public string $name)` | Manual assignment in body |
| Readonly properties | `public readonly int $id` | Private + getter |
| Match expression | `match($type) { 'a' => 1, 'b' => 2 }` | Switch + break |
| Enums | `enum Status: string { case Active = 'active'; }` | Class constants |
| Strict types | `declare(strict_types=1);` at top of every file | Optional |

**Every PHP file starts with:**

fill the variables

This prompt has 2 variables. Pro fills them into a ready-to-paste prompt for you — no manual find-and-replace.

{'a' => 1, 'b' => 2}{case Active = 'active';}
Unlock with Pro →

when to use it

Community prompt sourced from the open-source GitHub repo motsmanish/motspilot (MIT). A "Plain Php" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

productivitycommunitydeveloper

source

motsmanish/motspilot · MIT