PHPackages                             hongliang/alterload - 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. hongliang/alterload

ActiveLibrary

hongliang/alterload
===================

An alternative loader to autoload

v1.0.0(7y ago)113MITPHP

Since Jun 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/h-wang/alterload)[ Packagist](https://packagist.org/packages/hongliang/alterload)[ Docs](https://github.com/h-wang/alterload)[ RSS](/packages/hongliang-alterload/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Alterload for Composer
======================

[](#alterload-for-composer)

Why Alterload
-------------

[](#why-alterload)

Alterload is an alternative loader for autoload.

Alterload is great for library developers. When developing a PHP project/application we use composer to manage dependencies. Sometimes we need to work on a dependency of the project but still need to debug/test in the project. Think of a library that's part of the project.

Before Alterload there were 2 things we could do to debug/test the library in the project:

1. Commit new version of the library for all changes, wait for packagist to re-index, and update your composer.lock in the calling project and test.
2. Add a "repository" to your calling project's composer.json (which you shouldn't forget to remove during commit, and put back after)

\_\_ \* Symlinking or directly edit files in the vendor directory is not to discuss \_\_

Alterload is inspired by

How does it work
----------------

[](#how-does-it-work)

Making your application ready for Alterload takes 3 simple steps:

### 1. Include `hongliang/alterload` from Packagist in your composer.json file

[](#1-include-hongliangalterload-from-packagist-in-your-composerjson-file)

```
require-dev": {
   "hongliang/alterload": "~1.0"
}
```

### 2. Initialize Alterload in your app

[](#2-initialize-alterload-in-your-app)

Somewhere in your application, you're including `vendor/autoload.php`. Sometimes it's in `web/index.php` or `bin/console`. Find this location, and modify add these lines:

```
$loader = require_once __DIR__.'/../vendor/autoload.php';
if (class_exists('Alterload\Loader')) {
    \Alterload\Loader::alter($loader);
}
```

Wrapping the call to `alter` in the `class_exists` block ensures alterload is only used if Alterload is installed in your (development) environment (installed from the require-dev block in composer.json). In production environments it won't be called if you install your dependencies with `--no-dev`)

### 3. Add an `.alterload.ini` file to your project root.

[](#3-add-an-alterloadini-file-to-your-project-root)

```
psr-4:Monolog\Logger\ = /Users/me/git/monolog/monolog/src/Monolog
psr-0:Monolog\Logger\ = /Users/me/git/monolog/monolog/src/Monolog/Monolog/Monolog
;psr-4:Monolog\Logger\ = /this/is/commentted/out
```

Ideally you'd add the `.alterload.ini` to your `.gitignore` file.

### Done

[](#done)

Whenever your application is doing something like the following, it will load the "local" version of a library, instead of the one in your `vendor/` directory.

```
$logger = new \Monolog\Logger('example');
```

So from now on, no changes are required to your main application. Everything is managed by your local `.alterload.ini` file.

Symlink a dependency
--------------------

[](#symlink-a-dependency)

Sometimes we also want to use other assets (templates, js, images,...) in the depending library instead of only the PHP classes. In this case we can use the `vendor/bin/alterload link` command to symlink a library (in the `vendor` directory) to the local library.

Simply add `link:` in front of the `.alterload.ini` line:

```
link:psr-4:Monolog\Logger\ = /Users/me/git/monolog/monolog/src/Monolog

```

Then run the command from your application directory:

```
vendor/bin/alterload link

```

License
-------

[](#license)

MIT (see [LICENSE.md](LICENSE.md))

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2905d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1b784da6e9b890f576cd3cac29511978c10afc0e3b9572b498f2841952d953ef?d=identicon)[h-wang](/maintainers/h-wang)

---

Top Contributors

[![h-wang](https://avatars.githubusercontent.com/u/3410322?v=4)](https://github.com/h-wang "h-wang (1 commits)")

---

Tags

composerdependencyautoloadautoloaderpackagistHongliang

### Embed Badge

![Health badge](/badges/hongliang-alterload/health.svg)

```
[![Health](https://phpackages.com/badges/hongliang-alterload/health.svg)](https://phpackages.com/packages/hongliang-alterload)
```

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.4k187.2M2.6k](/packages/composer-composer)[maglnet/composer-require-checker

CLI tool to analyze composer dependencies and verify that no unknown symbols are used in the sources of a package

99810.9M671](/packages/maglnet-composer-require-checker)[automattic/jetpack-autoloader

Creates a custom autoloader for a plugin or theme.

525.5M69](/packages/automattic-jetpack-autoloader)[badges/poser

Poser, add badges on your readme..

14174.8k8](/packages/badges-poser)[linkorb/autotune

Tune your autoloader

177.0k17](/packages/linkorb-autotune)[cybercog/laravel-paket

Composer personal web interface. Manage Laravel dependencies without switching to command line!

1753.3k](/packages/cybercog-laravel-paket)

PHPackages © 2026

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