Skip to content
Back to skills

Php Antipatterns

ASecurity

Forbidden PHP/Laravel/Symfony patterns — SQL injection, shell injection, weak crypto, N+1, and maintainability anti-patterns. Applies when editing PHP or Blade files.

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 21, 2026
ai-agentsphpshellsqlapi

Works with

  • cursor
  • api

Security analysis

A100/100

Pro scans all 19 files and shows the line behind each finding

Scanned October 21, 2026

npx -y skills add emgiezet/aisdlc --skill php-antipatterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Php Antipatterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Php Antipatterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/emgiezet-php-antipatterns/badge)](https://www.skillsdirectory.com/skills/emgiezet-php-antipatterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: php-antipatterns
description: Forbidden PHP/Laravel/Symfony patterns — SQL injection, shell injection, weak crypto, N+1, and maintainability anti-patterns. Applies when editing PHP or Blade files.
paths: ["**/*.blade.php","**/*.php","**/*.twig"]
user-invocable: false
---

# PHP anti-patterns — do not write these

Checks run automatically after each edit. Findings reference the IDs below.

## Blockers
- AP-PHP-SEC-001 — No SQL string interpolation. Use `DB::select('… where id = ?', [$id])` or the query builder.
- AP-PHP-SEC-002 — No `unserialize()` on external data. Use `json_decode` or `allowed_classes: false`.
- AP-PHP-SEC-003 — No `exec`/`shell_exec`/backticks with user input. Use Symfony Process with an argv array.
- AP-PHP-SEC-004 — Use `{{ $var }}` for user data; `{!! !!}` only for pre-sanitized rich text.
- AP-PHP-SEC-006 — Use `Hash::make`/`password_hash` for passwords; `random_bytes`/`Str::random` for tokens.

## Errors
- AP-PHP-SEC-005 — Never `create($request->all())`; use `$request->validated()` and declare `$fillable`.
- AP-PHP-SEC-007 — Compare secrets and hashes with `hash_equals()`, never `==` or `===`.
- AP-PHP-PERF-001 — Eager-load relations with `->with()`; keep `Model::shouldBeStrict()` enabled in dev.
- AP-PHP-PERF-003 — Replace queries-in-loop with `whereIn` + in-memory lookup by key.
- AP-PHP-MAINT-002 — Never call `env()` outside `config/`; use `config('app.key')` everywhere else.
- AP-PHP-MAINT-004 — Never catch silently; log with context and rethrow or handle specifically.

## Warnings
- AP-PHP-PERF-002 — Never `Model::all()` on large tables; use `paginate()`, `chunkById()`, or `cursor()`.
- AP-PHP-PERF-005 — Dispatch slow operations (emails, external APIs, file processing) to a queue job.
- AP-PHP-MAINT-001 — Keep controllers thin; move validation to FormRequest and logic to service/action classes.
- AP-PHP-MAINT-003 — Add `declare(strict_types=1)` to every new file; type all parameters and return values.

Details for any ID: `reference/<ID>.md`

Files in this skill

  • SKILL.md2 KB
  • reference/AP-PHP-MAINT-001.md729 B
  • reference/AP-PHP-MAINT-002.md481 B
  • reference/AP-PHP-MAINT-003.md640 B
  • reference/AP-PHP-MAINT-004.md723 B
  • reference/AP-PHP-PERF-001.md626 B
  • reference/AP-PHP-PERF-002.md650 B
  • reference/AP-PHP-PERF-003.md534 B
  • reference/AP-PHP-PERF-004.md539 B
  • reference/AP-PHP-PERF-005.md552 B
  • reference/AP-PHP-SEC-001.md816 B
  • reference/AP-PHP-SEC-002.md653 B
  • reference/AP-PHP-SEC-003.md657 B
  • reference/AP-PHP-SEC-004.md609 B
  • reference/AP-PHP-SEC-005.md638 B
  • reference/AP-PHP-SEC-006.md882 B
  • reference/AP-PHP-SEC-007.md585 B
  • reference/AP-PHP-SEC-008.md678 B
  • reference/AP-PHP-SEC-009.md624 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.