Download the PHP package savinmikhail/dist-size-optimizer without Composer
On this page you can find all versions of the php package savinmikhail/dist-size-optimizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download savinmikhail/dist-size-optimizer
More information about savinmikhail/dist-size-optimizer
Files in savinmikhail/dist-size-optimizer
Package dist-size-optimizer
Short Description Optimizes your package distribution size by automatically managing .gitattributes export-ignore rules
License MIT
Informations about the package dist-size-optimizer
Dist Size Optimizer
A command-line tool that helps you optimize your package distribution size by automatically managing .gitattributes export-ignore rules.
Note: This package was previously known as
export-ignore-check. The functionality remains the same, but the name better reflects its purpose of optimizing distribution size.
Why?
When you publish a package to Packagist, Composer creates a distribution archive using git archive. Files and directories that are not needed in production (like tests, documentation, CI configs) should be excluded using .gitattributes export-ignore to:
- Reduce package size
- Speed up installation
- Improve CI/CD pipeline performance
- Keep production packages clean
This tool helps you identify what should be excluded and can automatically fix your .gitattributes file.
Installation
-
As composer dependency:
- Or as standalone phar package:
Dist Size Badge
Show the status of your distribution size with a badge. The badge is green when the package is optimized and red when it needs optimization:
Add badge to your project
- Copy the dist-size workflow into your repository.
- Add the following snippet to your
README.md, replacing<USER>and<REPO>with your repository details:
The workflow updates dist-size-status.json, and the badge reflects your repository's current status.
Usage
Analyze Popular Packages
The repository includes a conservative discovery script for finding potential optimizations in popular Packagist packages:
The script analyzes a fresh package set by default, uses four parallel Composer
workers, ranks observations by the uncompressed size of development-only paths,
and writes the full report to var/results.json. The default discovery profile
classifies test, CI, Docker, Compose, and development-tool files as safe, while
documentation, examples, demos, benchmarks, and tools require manual review.
Observations below 1 KiB remain in the report but are not treated as actionable
candidates. Use POPULAR_LIMIT, POPULAR_MIN_BYTES, or POPULAR_CONCURRENCY
to override the Make defaults of 100 packages, 1 KiB, and four workers. Pass
--resume directly to the PHP script to skip packages checkpointed with the
same config fingerprint.
Discovery results are leads, not ready-made pull requests. Before proposing a
change, verify the exact source revision and compare real git archive output
before and after applying the suggested .gitattributes rules.
Check Current Project
To check your current project (recommended during development):
This will:
- Create a git archive of your project (simulating Packagist's distribution)
- Scan for files that should be excluded
- Show you what to add to your
.gitattributesfile - Automatically append the suggested patterns to your
.gitattributesfile
Note: When checking your current project, the tool uses
git archive HEAD, which means it only includes committed changes. Make sure to commit your changes before running the check to get accurate results.
Check Any Package
To check any package from Packagist:
For example:
Clean .gitattributes
If your .gitattributes file contains stale export-ignore entries copied from other projects, you can remove all non-existent paths with:
This command will:
- Read your existing
.gitattributesfile - Remove all lines with
export-ignorepatterns that no longer match any file or directory in the project - Overwrite
.gitattributeswith the cleaned content
Output Options
Dry Run
By default, the tool will automatically append suggested patterns to your .gitattributes file. Use --dry-run to only see what would be added without making any changes:
JSON Output
Add --json flag to get machine-readable output:
Custom Config
By default, the tool uses a predefined set of patterns to check. You can provide your own config file:
The config file should be a PHP file that returns an array of patterns to check:
Custom Working Directory
By default, the tool uses a system temporary directory for working directory. You can provide your own working directory path:
Example Output
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
All versions of dist-size-optimizer with dependencies
composer/xdebug-handler Version ^3.0
symfony/console Version ^7.2
symfony/finder Version ^7.2

