- How do I install lean-package-validator for Laravel projects?
- Run `composer global require stolt/lean-package-validator` to install it globally. Ensure the global vendor bin directory is in your `$PATH`—check its location with `composer global config bin-dir --absolute`. For convenience, add an alias (e.g., `lpv`) to your shell config file.
- Does this package support Laravel 13 and PHP 8.2+?
- Yes, the package is explicitly compatible with Laravel 13 and PHP 8.2+. The latest version (v5.8.6) includes no breaking changes and aligns with modern Laravel and PHP standards. Check the [README](https://github.com/raphaelstolt/lean-package-validator) for version-specific details.
- What does 'lean releases' mean in Laravel packages?
- 'Lean releases' ensure your package’s Composer distribution excludes unnecessary files like logs, caches, or IDE configs. This package validates `.gitattributes` export-ignore rules to guarantee only essential files (e.g., `src/`, `composer.json`) are included in releases, reducing bundle size and avoiding bloated distributions.
- Can I use this to validate Laravel AI-generated files (e.g., storage/ai-cache/)?
- Yes, the `--agentic-run` flag auto-detects and excludes AI-generated files (e.g., `storage/ai-cache/`) by parsing `.gitattributes`. It also reformats entries to avoid stale export-ignores, which is critical for Laravel projects using AI tooling like Horizon or custom AI pipelines.
- Will this break existing Laravel Git workflows (e.g., symbolic links, sail exports)?
- No, the package is designed to complement Laravel’s Git workflows. It fixes issues with stale export-ignores (e.g., for `storage/app/public`) and dynamically handles symlinks. Test with `composer validate-gitattributes --agentic-run` to confirm compatibility with your setup.
- How do I integrate this into Laravel’s CI/CD pipeline?
- Add a step like `composer validate-gitattributes -- --agentic-run --validate-git-archive` to your CI workflow. This ensures lean releases before deployment. The package is CI/CD-friendly and won’t disrupt Laravel’s AI/ML pipelines (e.g., GitHub Copilot reviews).
- Does this replace Laravel’s built-in Git utilities for managing .gitattributes?
- No, this package specializes in lean release validation and `.gitattributes` management for Composer distributions. While Laravel doesn’t have native tools for this, alternatives like custom Git hooks exist but lack the agentic autodetection and AI workflow support provided here.
- How do I fix stale export-ignores in a Laravel project?
- Use the `update` or `reformat` commands (e.g., `lpv update .gitattributes`). The package now includes a fix for stale entries, which is especially useful for Laravel projects using Git export/import (e.g., `storage/links`). Run `lpv validate` to check for issues.
- Can I use this for monorepos with Laravel and non-Laravel packages?
- Yes, the package works for mixed monorepos. Use the `--preset=PHP` flag for PHP projects or `--preset=Laravel` for Laravel-specific exclusions (e.g., `bootstrap/cache/`, `storage/logs/`). The agentic mode adapts to Laravel’s directory structure while ignoring non-Laravel files.
- What’s the performance impact of running this in CI?
- The package is lightweight and optimized for CI. Validation typically completes in under 5 seconds for most Laravel projects. The `--agentic-run` flag adds minimal overhead (~1–2 seconds) for AI workflows. Monitor with `composer validate-gitattributes -- --dry-run` to test performance.