Docs/Presets/Laravel

Laravel

Security and convention rules for Laravel PHP projects.

Enabled Rules

RuleSeverityDescription
security/secret-detectionblockDetects APP_KEY, database passwords, and API tokens in code
security/env-exposureblockPrevents secrets in blade templates and JavaScript bundles
workflow/migration-safetywarnFlags destructive operations in Laravel migrations
quality/naming-conventionsblockPascalCase models, snake_case table names, camelCase methods
quality/file-structurewarnControllers, models, and services in correct directories

Usage

import { defineConfig } from '@solanticai/vguard';

export default defineConfig({
  presets: ['laravel'],
});

What it enforces

  • No hardcoded secrets — Blocks APP_KEY, DB_PASSWORD, and API tokens written directly in code. Use .env and config() helper.
  • Migration safety — Warns on Schema::drop, DB::statement('DROP'), and column removal without backup considerations.
  • Naming conventions — Models are PascalCase singular (UserProfile). Controllers are PascalCase with Controller suffix. Database columns are snake_case.
  • File structure — Controllers in app/Http/Controllers/, models in app/Models/, services in app/Services/.