
Laravel Security
This is a comprehensive reference for locking down Laravel apps, covering everything from production config gotchas to authentication patterns. It walks through Sanctum token abilities, password hashing with argon2id, session regeneration to prevent fixation attacks, and proper policy/gate setup with real code examples. The production checklist alone is worth having open: APP_KEY validation, trusted proxy configuration for load balancers, HTTPS enforcement middleware. Especially useful when you're moving from local dev to production and need to catch security misconfigurations before they bite you. The Eloquent safety and XSS prevention sections would make this complete, but what's here covers the authentication and authorization stack thoroughly.
- skills.sh installs
- 6.6K
- GitHub stars
- 300.3K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add affaan-m/ecc --skill laravel-security --agent claude-codeInstalls into .claude/skills of the current project.
Files
Laravel Security Best Practices
Comprehensive security guidelines for Laravel applications to protect against common vulnerabilities.
When to Activate
- Setting up Laravel authentication and authorization (Sanctum, Passport, Jetstream, Breeze)
- Implementing user roles, permissions, and policies
- Configuring production security settings and environment variables
- Reviewing Laravel applications for security vulnerabilities
- Deploying Laravel applications to production
- Writing secure Eloquent queries and migrations
Production Configuration
Essential Production Settings
// config/app.php
'env' => env('APP_ENV', 'production'),
'debug' => (bool) env('APP_DEBUG', false), // CRITICAL: Never true in production
'key' => env('APP_KEY'), // Must be set: php artisan key:generate
// config/session.php
'secure' => env('SESSION_SECURE_COOKIE', true),
'http_only' => true,
'same_site' => 'lax',
// Verify APP_KEY is set at boot
// bootstrap/app.php or a service provider
if (empty(config('app.key'))) {
throw new RuntimeException('APP_KEY is not set. Run: php artisan key:generate');
}
Environment File Security
Sponsors
Details
- Repository
- github.com/affaan-m/ecc
- Categories
- Backend & APIs, Security, PHP & Laravel
- First seen
- Jul 14, 2026
More from affaan-m/ecc
All 263- Frontend Slides6.5K
- Codebase Onboarding6.4K
- Frontend Design Direction6.4K
- E2e Testing6.4K
- Liquid Glass Design6.4K
- Tdd Workflow6.4K
- Database Migrations6.4K
- Android Clean Architecture6.4K
- Prompt Optimizer6.3K
- Golang Patterns6.3K
- Postgres Patterns6.3K
- Verification Loop6.3K
- Article Writing6.3K
- Django Patterns6.2K
- Cpp Coding Standards6.2K
- Golang Testing6.2K
- Deep Research6.2K
- Java Coding Standards6.2K
- Blender Motion State Inspection6.1K
- Laravel Patterns6.1K
- Rust Patterns6.1K
- Springboot Patterns6.1K
- Context Budget6.1K
- Accessibility6.1K