j13k/yaml-lint
Laravel-friendly YAML linter powered by yamllint. Validate YAML files in your project or CI, catch syntax and style issues early, and fail builds on invalid configuration. Simple command integration for consistent YAML across environments.
.env, config/*.php, or third-party YAML-based configs like Ansible, Kubernetes, or custom schemas).php artisan and config:cache handle PHP config validation.composer.json.forge.yml or deployer.yml). May require custom rules or post-processing.config/, deploy/, or third-party files?)composer require-dev) or version-pinned?Validator facade or a custom YamlValidator service handle this with less tooling?spatie/laravel-yaml-config) that offer tighter integration?php artisan yaml:lint).Process facade for programmatic use.composer require-dev --dev j13k/yaml-lint
// app/Console/Commands/LintYaml.php
public function handle()
{
$exitCode = Artisan::call('vendor/bin/yaml-lint', [
'path' => storage_path('config/*.yml'),
]);
if ($exitCode !== 0) exit($exitCode);
}
.github/workflows/lint.yml:
- name: Lint YAML
run: php artisan yaml:lint
symfony/yaml for parsing).realpath()).composer test or make lint.ExceptionHandler if using programmatic validation.forge.yml), then expand.composer.json to avoid surprises.YAML_LINT_RULES.md.CONTRIBUTING.md section on YAML linting rules.composer test runs linting automatically.php artisan yaml:lint --help reference.xargs -P 4).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Malformed YAML in config | Runtime errors (e.g., config('invalid.key')) |
Block in CI with strict linting. |
| False positives in CI | Flaky builds | Whitelist known-good files or adjust rules. |
| Tool version incompatibility | Broken linting | Pin versions in composer.json. |
| Large YAML files | Slow CI pipelines | Parallelize or exclude non-critical files. |
| Schema drift | Valid but non-compliant YAML | Combine with JSON Schema validation. |
How can I help you explore Laravel packages today?