In brief
A comprehensive security hardening checklist for Laravel applications in production, from environment config to deployment, monitoring and incident response.

Laravel is one of the most secure PHP frameworks out of the box. But security is a practice, not a feature. Every production Laravel application should pass this 20-point checklist.
Environment & configuration
-
APP_DEBUG=false in production. Non-negotiable. Debug mode exposes stack traces, queries, environment variables and sometimes credentials to anyone who triggers an error.
-
APP_ENV=production. This controls logging behaviour, cache drivers and error handling. Never run production on
localorstagingenvironment settings. -
Generate a unique APP_KEY. Run
php artisan key:generate. This key encrypts sessions, cookies and encrypted data. Never use the default key and never commit it to version control. -
Use secure session config.
SESSION_SECURE_COOKIE=true,SESSION_HTTP_ONLY=true,SESSION_SAME_SITE=lax,SESSION_DRIVER=redis(or database, never file in production).
HTTPS & headers
-
Force HTTPS. Set
APP_URL=https://yoursite.com. Use middleware or.htaccessto redirect HTTP → HTTPS. Implement HSTS headers. -
Set security headers. Content-Security-Policy, X-Frame-Options (DENY), X-Content-Type-Options (nosniff), Referrer-Policy. Laravel's
TrustProxiesmiddleware must be configured if behind a load balancer.
Authentication & authorisation
-
Rate limit login. Use Laravel's built-in
RateLimiteron login routes. After 5 failed attempts, lock for 15 minutes. -
Implement 2FA for admin accounts. Laravel Fortify makes this straightforward. Require it for any account with elevated privileges.
-
Use Policies and Gates. Every controller action that modifies data should check authorisation. Never rely on hiding UI elements.
Database & queries
-
Never use raw SQL with user input. Always use Eloquent, query builder bindings or prepared statements. SQL injection through raw queries is still the #1 Laravel vulnerability.
-
Encrypt sensitive columns. Use Laravel's
Cryptfacade or theEncryptedcast for data like API keys, ID numbers and financial details stored in the database. -
Run migrations with
--forcein production only in maintenance mode.
File uploads
-
Validate uploaded files aggressively. Check MIME type (not just extension), limit file size and scan for malware if possible.
-
Store uploads outside the web root. Use Laravel's filesystem with
publicdisk for public assets andlocalors3for anything sensitive. Never let users directly access uploaded PHP files.
Dependencies & updates
-
Run
composer auditweekly. Check for known vulnerabilities in your dependencies. Subscribe to Laravel security announcements. -
Keep Laravel and packages updated. Security fixes are released regularly. A 6-month-old Laravel installation has known vulnerabilities.
Monitoring & response
-
Log authentication events. Track logins, failures, password changes and permission escalations.
-
Monitor for anomalies. Unusual patterns (50 failed logins, admin actions at 3am, unexpected data exports) should trigger alerts.
-
Have a backup and recovery plan. Automated daily database backups stored off-site. Test restoration monthly. A backup you have never tested is just hope.
-
Have an incident response plan. Who gets called? How do you take the site offline? How do you notify affected users? Write it down before you need it.
TFast Digital Agency builds Laravel applications that pass every item on this checklist, security is how we engineer from day one, not something we add before launch.
<!-- SEO keyword optimization: secure laravel application checklist -->Focusing on secure laravel application checklist is essential for modern business success.



