PHPackages                             codezero/composer-preload-files - 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. codezero/composer-preload-files

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

codezero/composer-preload-files
===============================

Composer plugin to autoload files before vendor files.

1.0.2(2y ago)3460.0k↓21.3%15MITPHPPHP &gt;= 7.0

Since Apr 2Pushed 2y ago2 watchersCompare

[ Source](https://github.com/codezero-be/composer-preload-files)[ Packagist](https://packagist.org/packages/codezero/composer-preload-files)[ RSS](/packages/codezero-composer-preload-files/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (5)

Composer Preload Files Plugin
=============================

[](#composer-preload-files-plugin)

[![GitHub release](https://camo.githubusercontent.com/4ef362fdbe1fac0a4f9cc7f543b3ce479a344f3fa7f9cbf219096d5331e9a5ef/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f636f64657a65726f2d62652f636f6d706f7365722d7072656c6f61642d66696c65732e7376673f7374796c653d666c61742d737175617265)](https://github.com/codezero-be/composer-preload-files/releases)[![License](https://camo.githubusercontent.com/d3f1769805adb2bbec57c4ac9f0e2fab7b8b5867ffb84cb7d4a69eb1a6bd9c38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f64657a65726f2f636f6d706f7365722d7072656c6f61642d66696c65732e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/53ffb42ce922c40db939dc7770079b566948830bfa5cfbe485af665fd305d4b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f64657a65726f2f636f6d706f7365722d7072656c6f61642d66696c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codezero/composer-preload-files)

Autoload Your Files Before Vendor Files
---------------------------------------

[](#autoload-your-files-before-vendor-files)

This Composer plugin enables you to autoload files that you specify before any vendor files.

This package is based on the original [funkjedi/composer-include-files](https://github.com/funkjedi/composer-include-files) by [@funkjedi](https://github.com/funkjedi) and its fork [hopeseekr-contribs/composer-include-files](https://github.com/hopeseekr-contribs/composer-include-files) by [@hopeseekr](https://github.com/hopeseekr). Because maintenance of these packages appears to be stalled, I decided to attempt and remake the package from scratch and fix any reported bugs in the process.

✅ Requirements
--------------

[](#-requirements)

- PHP &gt;= 7.0
- Composer ^2.3

📦 Install
---------

[](#-install)

Install this package with Composer:

```
composer require codezero/composer-preload-files
```

📘 Usage
-------

[](#-usage)

Add the `preload-files` to your project's `composer.json` under the `extra` section:

```
"extra": {
    "preload-files": [
        "app/helpers.php"
    ]
},
```

The `preload-files` in the `extra` section will be loaded before the `files` in a standard `autoload` or `autoload-dev` section. This is true for your project, but also for any vendor package. Your project's preload files will always be loaded first.

🔌 Example Use Case
------------------

[](#-example-use-case)

The best example use case is when you need to override a global helper function in a [Laravel](https://laravel.com) project. Those helper functions are declared in helper files that are loaded in the `files` array in the `autoload` section of `composer.json`:

```
"autoload": {
    "files": [
        "src/Illuminate/Collections/helpers.php",
        "src/Illuminate/Events/functions.php",
        "src/Illuminate/Foundation/helpers.php",
        "src/Illuminate/Support/helpers.php"
    ]
},
```

These functions are declared like this:

```
// helpers.php
if ( ! function_exists('route')) {
    function route($name, $parameters = [], $absolute = true)
    {
        return app('url')->route($name, $parameters, $absolute);
    }
}
```

If you add your own helper file to your project's `autoload` section to override such function, you will notice that Laravel's function is already loaded, and you can not redeclare it.

One way to solve this, is to manually `require` the helper file before Composer's `autoload.php` file. For Laravel, this means you need to `require` the file in your project's `public/index.php` file:

```
require __DIR__.'/../app/helpers.php';
require __DIR__.'/../vendor/autoload.php';
```

This works, but it is difficult, if not impossible to test (I did not find a way yet). If you are developing a package, it's also an extra step that users need take to install it.

Another solution is a package like this.

☕ Credits
---------

[](#-credits)

- [@ivanvermeyen](https://github.com/ivanvermeyen)
- [@hopeseekr](https://github.com/hopeseekr) - original fork: [hopeseekr-contribs/composer-include-files](https://github.com/hopeseekr-contribs/composer-include-files)
- [@funkjedi](https://github.com/funkjedi) - original: [funkjedi/composer-include-files](https://github.com/funkjedi/composer-include-files)
- [All contributors](https://github.com/codezero-be/composer-preload-files/contributors)

🔒 Security
----------

[](#-security)

If you discover any security related issues, please [e-mail me](mailto:ivan@codezero.be) instead of using the issue tracker.

📑 Changelog
-----------

[](#-changelog)

A complete list of all notable changes to this package can be found on the [releases page](https://github.com/codezero-be/composer-preload-files/releases).

📜 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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

Every ~26 days

Total

3

Last Release

1090d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e17b7a892452367dfb0e5c55bf04844a16bb781f356f50019332d4b9a476ec6?d=identicon)[codezero](/maintainers/codezero)

---

Top Contributors

[![ivanvermeyen](https://avatars.githubusercontent.com/u/3598622?v=4)](https://github.com/ivanvermeyen "ivanvermeyen (6 commits)")

---

Tags

plugincomposerhelpersautoloadfilesincluderequireload

### Embed Badge

![Health badge](/badges/codezero-composer-preload-files/health.svg)

```
[![Health](https://phpackages.com/badges/codezero-composer-preload-files/health.svg)](https://phpackages.com/packages/codezero-composer-preload-files)
```

###  Alternatives

[ergebnis/composer-normalize

Provides a composer plugin for normalizing composer.json.

1.1k37.3M2.1k](/packages/ergebnis-composer-normalize)[pyrech/composer-changelogs

Display changelogs after each composer update

5904.0M25](/packages/pyrech-composer-changelogs)[automattic/jetpack-autoloader

Creates a custom autoloader for a plugin or theme.

525.5M69](/packages/automattic-jetpack-autoloader)[sllh/composer-versions-check

Checks if packages are up to date to last major versions after update

2352.4M16](/packages/sllh-composer-versions-check)[ffraenz/private-composer-installer

A composer install helper for private packages

2331.7M5](/packages/ffraenz-private-composer-installer)[funkjedi/composer-include-files

Include files at a higher priority than autoload files.

1263.2M19](/packages/funkjedi-composer-include-files)

PHPackages © 2026

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