Laravel SOP

Introduction & Overview

Laravel Version Compatibility

  • Project uses Laravel 12.x or later (latest stable version) - Check: composer.json (require.laravel/framework)
  • PHP version meets Laravel requirements (PHP 8.3+) - Check: composer.json (require.php) or runtime.txt

Required Project Integrations

Essential Tools and Packages

  • Laravel Pint is installed and configured (code formatting) - Check: composer.json (require-dev.laravel/pint), pint.json (root)
  • PHPStan is installed and configured (static analysis) - Check: composer.json (require-dev.phpstan/phpstan), phpstan.neon (root)
  • Environment configuration files (.env.example) are present and up to date - Check: .env.example (root)
  • README.md file exists with project setup instructions - Check: README.md (root)
  • .gitignore file is properly configured for Laravel - Check: .gitignore (root)

Here are the installation instruction:

  1. Pint Installation
  2. PHPStan/Larastan

Configuration Requirements

  • Application key is generated (APP_KEY in .env) - Check: .env (APP_KEY should be set, not empty)
  • Database configuration is properly set up - Check: config/database.php, .env (DB_* variables)
  • Cache driver is configured (Redis/Memcached for production) - Check: config/cache.php, .env (CACHE_DRIVER)
  • Queue driver is configured (database/Redis for production) - Check: config/queue.php, .env (QUEUE_CONNECTION)
  • Logging configuration is set up (daily rotation, proper channels) - Check: config/logging.php
  • CORS configuration is set up for API projects - Check: config/cors.php, bootstrap/app.php (API middleware)
  • Rate limiting is configured for API routes - Check: routes/api.php, app/Http/Kernel.php or bootstrap/app.php

PSR Standards Compliance Checklist

Code Formatting

  • All code is formatted using Laravel Pint - Check: Run ./vendor/bin/pint --test, verify pint.json exists
  • Code follows PSR-12 standards (enforced by Pint) - Check: All PHP files in app/, config/, routes/, tests/

README Requirements

  • README.md file exists in project root - Check: README.md (root directory)
  • README includes installation instructions - Check: README.md (should have composer install, npm install steps)
  • README includes environment setup instructions - Check: README.md (should mention .env setup, APP_KEY generation)
  • README includes how to run tests - Check: README.md (should mention php artisan test or composer test)
  • README includes how to run code quality tools - Check: README.md (should mention Pint, PHPStan commands)

Did you find this article useful?