thebushidocollective avatar

PHP Security Patterns

This covers the essential security patterns you need for PHP applications: input validation, SQL injection prevention, XSS protection, CSRF defense, secure password handling, session security, and file upload protection. It's from thebushidocollective's han repository, which has 165 stars and passes all three security audits. Use this when you're building PHP apps that handle user data, authentication, or payments. The defensive approach is solid, focusing on multiple layers rather than single solutions. Good fit if you want Claude to follow established security practices instead of reinventing protection mechanisms or making assumptions about what's safe in a PHP context.

GitHub stars
187
last updated
Aug 21, 2026

Install

$ npx -y skills add thebushidocollective/han --skill 'PHP Security Patterns' --agent claude-code

Installs into .claude/skills of the current project.

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;
}

Sponsors

Details

Repository
github.com/thebushidocollective/han
Categories
Security, PHP & Laravel, Databases
First seen
Jun 3, 2026

More from thebushidocollective/han

All 14

Recommended

More Security
1aradotso avatarpentest-ai-agentsaradotso/security-skillspentest ai agents1.1Kskills.sh installs
2bagelhole avatarlinux-hardeningbagelhole/devops-security-agent-skillsApply CIS benchmarks and secure Linux servers. Configure SSH, manage users, implement firewall rules, and enable security features. Use when hardening Linux sys832skills.sh installs
3aradotso avatarzen-ai-pentest-frameworkaradotso/security-skillszen ai pentest framework676skills.sh installs
4wshobson avatark8s-security-policieswshobson/agentsImplement Kubernetes security policies including NetworkPolicy, PodSecurityPolicy, and RBAC for production-grade security. Use when securing Kubernetes clusters15.1Kskills.sh installs
5affaan-m avatarsecurity-reviewaffaan-m/eccUse this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment/sensitive features. Provid7.6Kskills.sh installs
6affaan-m avatarspringboot-securityaffaan-m/eccSpring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.6Kskills.sh installs