Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Lean Package Validator

Lean Package Validator Laravel Package

stolt/lean-package-validator

CLI tool to validate a project or micro-package for “leanness” by ensuring common repo artifacts are excluded from release archives. Also creates, updates, and reformats .gitattributes export-ignore entries for lean distribution packages.

View on GitHub
Deep Wiki
Context7

Library and CLI for validating if a project or package has and will have lean releases.

Frequently asked questions about Lean Package Validator
How do I install lean-package-validator in a Laravel project?
Run `composer require --dev stolt/lean-package-validator` to add it as a dev dependency. The CLI tool will be available via `vendor/bin/lean-package-validator` or globally if installed via `composer global require`. Add it to your `composer.json` scripts for automated validation, like `"validate-lean": "lean-package-validator validate"`.
Does this tool work with Laravel 10+ and PHP 8.2+?
Yes, the package is fully compatible with Laravel 10+ and PHP 8.2+. It has no framework-specific dependencies and integrates seamlessly with modern Composer workflows. Check the [README](https://github.com/raphaelstolt/lean-package-validator) for version-specific details.
Can I enforce lean releases in GitHub Actions for my Laravel package?
Absolutely. Add a step like `- name: Validate Lean Package run: composer validate-lean` to your GitHub Actions workflow. This ensures `.gitattributes` and excluded files are validated before every release, blocking non-lean artifacts from being distributed.
What if my Laravel project has custom vendor paths or monorepo setups?
The tool supports monorepos by targeting specific directories. For custom vendor paths (e.g., in monorepos), explicitly define them in your `.gitattributes` or use a custom `.lpv` preset. Laravel’s default `vendor/` is auto-handled, but edge cases may require manual glob pattern adjustments.
Will this tool conflict with Laravel’s default ignored files (e.g., node_modules, storage)?
No, but you may need to tune glob patterns in `.gitattributes` to avoid false positives. Laravel’s default ignored files (like `node_modules/`) are typically excluded by default. Test locally with `composer validate-lean` and adjust rules as needed.
How do I create or update .gitattributes for lean releases?
Use the `create` or `update` commands: `lean-package-validator create` generates a `.gitattributes` file with lean defaults, while `update` modifies existing entries. For Laravel, you can extend presets via a custom `.lpv` file to include/exclude specific paths like `bootstrap/cache/` or `routes/`.
Should I run validation on every commit or only on release branches?
For CI/CD efficiency, gate validation to release branches (e.g., `main` or `release/*`). Running it on every commit can be noisy, but pre-commit hooks (via `composer.json` scripts) are useful for local enforcement. Configure CI to block failures or warn based on your team’s workflow.
Can I integrate this into Laravel’s Artisan commands?
Yes, wrap the validator in a custom Artisan command (e.g., `php artisan lpv:validate`) by extending Laravel’s `Command` class. This provides tighter integration with Laravel’s ecosystem, especially for teams using Artisan for package management.
What are the performance implications of running this in CI?
The `--validate-git-archive` command creates temporary archives, which may slow down CI for large repos. Mitigate this by running it only on critical paths (e.g., release branches) or caching `.gitattributes` between runs. For small-to-medium Laravel packages, overhead is minimal.
Are there alternatives to this tool for Laravel packages?
Alternatives include manual `.gitattributes` configuration or tools like `git-archive-all` with custom filters. However, `lean-package-validator` offers preset-based validation (PHP, Python, etc.), Laravel-specific tuning, and CLI/CI integration out of the box. For Laravel, consider extending its presets via `.lpv` files for framework-specific rules.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata