PHPackages                             ayesh/composer-min-autoload - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ayesh/composer-min-autoload

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

ayesh/composer-min-autoload
===========================

A Composer plugin to generate slightly minimal Autoloaders with a new `dump-min-autoload` command

v0.0.3(3y ago)131193[1 issues](https://github.com/Ayesh/Composer-Min-Autoload/issues)MITPHPPHP ^8.1CI failing

Since Apr 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Ayesh/Composer-Min-Autoload)[ Packagist](https://packagist.org/packages/ayesh/composer-min-autoload)[ RSS](/packages/ayesh-composer-min-autoload/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

Composer Min Autoload
=====================

[](#composer-min-autoload)

A Composer plugin to generate slightly minimal Autoloader with a new `dump-min-autoload` command

---

> Composer autoloader is too stable to my taste.

> Composer's autoloader files are so huuge, and they take a big portion of my 20KB hard disk.

> Composer autoloader needs to load FOUR files to load? Only THREE is ACCEPTABLE!

> A composer plugin a random bored guy put together during COVID-19 pandemic? Put it in prod!

Any of these sound like you? Say no more fam, **Composer Min Autoload** has got you covered.

**Composer Min Autoload is a Composer plugin that generates a slightly minimal Autoloader.**

### Wha? Composer Autoloader is bloated?

[](#wha-composer-autoloader-is-bloated)

Composer Autoloader is stable and well-thought. It even works on PHP 5.2 even though Composer itself requires PHP 5.2.

When you generate Composer Autoloader, these files are created:

```
 vendor
    |--- autoload.php: This is the file that you include
    |--- composer
           |--- autoload_real.php: Coordinates the autoloader class
           |--- ClassLoader.php: The `ClassLoader` class itself
           |--- autoload_static.php: Opcache-frendly `static` arrays of autoload directives. Requires PHP >= 5.6 && !hhvm
           |--- autoload_psr4.php: `PSR-4` mappings. Only used when `static` is not used.
           |--- autoload_classmap.php: Classmap. Only used when `static` is not used.
           |--- autoload_files.php: Always-include files. Only used when `static` is not used.
           |--- autoload_namespaces.php: Namespace mappings. Only used when `static` is not used.
           |--- platform_check.php A run-time check for platform requirements.

```

If you use PHP 5.6 or later, only the first 4 files are used, and the last 4 files become dead-code.

This plugin attempts to optimize the autoloader by reorganizing the code:

- Removes `autoload_psr4.php`, `autoload_classmap.php`, `autoload_files.php`, `autoload_namespaces.php`
- Moves the `autoload_real.php` logic to `autoload.php` file, and removes `autoload_real.php`
- Removes `platform_check.php` file if present ([generated by Composer v2](https://php.watch/articles/composer-platform-check))

With **Composer Min Autoload**, you will get a slightly optimized autoloader:

```
 vendor
    |--- autoload.php: This is the file that you include. Also coordinates ClassLoader class with static list.
    |--- composer
           |--- ClassLoader.php: The `ClassLoader` class itself
           |--- autoload_static.php: Opcache-frendly `static` arrays of autoload directives. Requires PHP >= 5.6 && !hhvm

```

### But, Why?

[](#but-why)

- COVID-19 boredom
- I commit `vendor` directory Git in CI/CF setup, and I'd like slightly smaller diffs.
- I know that I will never run this code in PHP &lt; 7.4, Zend encoder, or HHVM
- GitHub stars are cool

### Is it production-ready?

[](#is-it-production-ready)

¯\\*(ツ)*/¯

This plugin copies almost entirety of its autoload generator code from Composer itself. Take precautions and run your test suits. You have tests, right? RIGHT?

### How to use

[](#how-to-use)

Now we are talking!

1. Install plugin

*A: Install plugin per-project*

```
composer require ayesh/composer-min-autoload
```

*B: You can also install the plugin globally if you prefer*

```
composer global require ayesh/composer-min-autoload
```

2. Dump mini autoloader

```
composer dump-min-autoload
```

You can also use `dma` as a short alias for `dump-min-autoload`.

### Getting original autoloader

[](#getting-original-autoloader)

Every time you change packages (require/update/remove), Composer will generate the standard autoloader. You can run `composer dma` to overwrite with your fancy minimal autoloader.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~376 days

Total

3

Last Release

1458d ago

PHP version history (3 changes)v0.0.1PHP ^7.4

v0.0.2PHP ^7.4 || ^8.0

v0.0.3PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/1703f88c1f225e3fadff28458e81328f86668d9631a8c489f45ea1aaebe12df2?d=identicon)[Ayesh](/maintainers/Ayesh)

---

Top Contributors

[![Ayesh](https://avatars.githubusercontent.com/u/811553?v=4)](https://github.com/Ayesh "Ayesh (29 commits)")[![IndrekHaav](https://avatars.githubusercontent.com/u/4806952?v=4)](https://github.com/IndrekHaav "IndrekHaav (1 commits)")[![SvenRtbg](https://avatars.githubusercontent.com/u/416600?v=4)](https://github.com/SvenRtbg "SvenRtbg (1 commits)")

---

Tags

composerautoloadautoloaderbad-decisions

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ayesh-composer-min-autoload/health.svg)

```
[![Health](https://phpackages.com/badges/ayesh-composer-min-autoload/health.svg)](https://phpackages.com/packages/ayesh-composer-min-autoload)
```

###  Alternatives

[automattic/jetpack-autoloader

Creates a custom autoloader for a plugin or theme.

525.5M69](/packages/automattic-jetpack-autoloader)[funkjedi/composer-include-files

Include files at a higher priority than autoload files.

1263.2M19](/packages/funkjedi-composer-include-files)[typo3/class-alias-loader

Amends the composer class loader to support class aliases to provide backwards compatibility for packages

4313.7M21](/packages/typo3-class-alias-loader)[mouf/classname-mapper

Provides a way to find in which PHP files a class will be looked upon.

112.3M5](/packages/mouf-classname-mapper)[linkorb/autotune

Tune your autoloader

177.0k17](/packages/linkorb-autotune)[bnomei/autoloader-for-kirby

Helper to automatically load various Kirby extensions in a plugin

185.7k2](/packages/bnomei-autoloader-for-kirby)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
