PHP Security Patterns
Reference guide of PHP security patterns covering validation, SQL injection, XSS, CSRF, and password handling.
- CCM score
- 48 of 100
- skills.sh installs
- 279
- GitHub stars
- 202
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers input validation, SQL injection prevention, XSS protection, CSRF defense, password hashing, session security, and file upload safety
- Includes PHP code examples for email, URL, and integer validation, output encoding with
htmlspecialchars, and PDO prepared statements - Enforces validation at the application boundary and output encoding before rendering to prevent injection attacks
- Designed for developers building PHP applications that handle authentication, personal data, or financial transactions
Install
$ npx -y skills add thebushidocollective/han --skill 'PHP Security Patterns' -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
PHP Security Patterns
Introduction
Security is paramount in PHP applications as they often handle sensitive user data, authentication, and financial transactions. PHP's flexibility and dynamic nature create opportunities for vulnerabilities if security best practices aren't followed.
Common PHP security vulnerabilities include SQL injection, cross-site scripting (XSS), cross-site request forgery (CSRF), insecure password storage, session hijacking, and file inclusion attacks. Each can lead to data breaches, unauthorized access, or complete system compromise.
This skill covers input validation and sanitization, SQL injection prevention, XSS protection, CSRF defense, secure password handling, session security, file upload security, and defense-in-depth strategies.
Input Validation and Sanitization
Input validation ensures data meets expected formats before processing, while sanitization removes or encodes potentially dangerous content.
<?php
declare(strict_types=1);
// Email validation
function validateEmail(string $email): bool {
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
}
Details
- Repository
- github.com/thebushidocollective/han
- Categories
- Security, PHP & Laravel
- First seen
- Jun 3, 2026
Questions
What does the PHP Security Patterns skill cover?
PHP Security Patterns covers input validation and sanitization, SQL injection prevention with prepared statements, XSS protection, CSRF defense, password hashing, secure session management, file upload security, and defense-in-depth strategies. It is aimed at building secure PHP applications that handle user data, authentication and transactions.
How do I install the PHP Security Patterns skill?
Run this command in a project: npx -y skills add thebushidocollective/han --skill 'PHP Security Patterns' -y. Once installed, PHP Security Patterns gives the agent guidance on writing PHP code that resists common attacks.
Which Security category skills does PHP Security Patterns sit alongside?
PHP Security Patterns is listed in the Security category on Claude Marketplaces, next to azure-compliance, entra-agent-id, firebase-security-rules-auditor, security-audit and cloudflare-one. Unlike those skills, it focuses specifically on PHP coding patterns such as PDO prepared statements and output encoding.
Does PHP Security Patterns need any tools, accounts or API keys?
The skill declares no allowed tools, and its SKILL.md is pure guidance with PHP code examples. It needs a PHP runtime with PDO to run the examples, and no account or API key is mentioned in its listing.
More from thebushidocollective/han
All 14- Django Rest Framework268
- Cpp Modern Features247
- Tailwind Responsive Design235
- Bdd Patterns213
- Storybook Component Documentation167
- Reactflow Fundamentals140
- Android Jetpack Compose2.3K
- Fastapi Async Patterns965
- Atomic Design Fundamentals794
- Storybook Story Writing682
- Solid Principles620
- Docker Compose Production489
- Angular Rxjs Patterns294
Similar to PHP Security Patterns
More Securitywordpress-security-validationSkillbobmatnyc/claude-mpm-skills661 installsSecurity-first WordPress guide covering nonces, sanitization, validation, and escaping against XSS, CSRF, and SQL injection.
input-validation-sanitization-auditorSkillpatricio0312rev/skills293 installsSafe input handling guide covering XSS escaping, parameterized SQL queries, and Zod validation schemas.
security-best-practicesSkillmindrally/skills1K installsChecklist-style security guidance covering input validation, authentication, secrets, and injection and XSS prevention for backend services.
xss-preventionSkillaj-geddes/useful-ai-prompts486 installsPractical XSS defense covering input sanitization, output encoding, and Content Security Policy for user-generated content.
jutsu-phpPluginTheBushidoCollective/han201 starsAdvanced PHP programming skills for modern PHP and security patterns