funkjedi/composer-include-files

Include files at a higher priority than autoload files.

Maintainers

👁 funkjedi

Package info

github.com/funkjedi/composer-include-files

Type:composer-plugin

pkg:composer/funkjedi/composer-include-files

Statistics

Installs: 3 358 837

Dependents: 16

Suggesters: 0

Stars: 126

Open Issues: 6

1.1.0 2020-06-25 19:56 UTC

Requires

  • composer-plugin-api: ^1.0 || ^2.0

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 7e4f8ec0f83d57434aaa3cd6f736378c68e19d4b

  • Tim Robertson <funkjedi.woop@gmail.com>

autoloadcomposer

This package is auto-updated.

Last update: 2026-06-27 02:49:40 UTC


README

When using the Composer Autoloader if you need project files included prior to files autoloaded by any of your dependencies your out of luck. No longer!

Installation

composer require funkjedi/composer-include-files

Usage

Just add the files you need included using "include_files" and they will be include prior to any files included by your dependencies.

// composer.json (project)
{
 "extra": {
 "include_files": [
 "/path/to/file/you/want/to/include",
 "/path/to/another/file/you/want/to/include"
 ]
 },
}

Specific Use Case

A good example of where this is required is when overriding helpers provided by Laravel.

In the past simply modifying bootstrap/autoload.php to include helpers was sufficient. However new versions of PHPUnit include the Composer Autoloader prior to executing the PHPUnit bootstrap file. Consequently this method of overriding helpers is no longer viable as it will trigger a fatal error when your bootstrap file is included.

But now we can use Composer - Include Files Plugin to have Composer include the files in the necessary order.

// composer.json (project)
{
 "require": {
 "laravel/framework": "^5.2",
 "funkjedi/composer-include-files": "^1.0",
 },
 "extra": {
 "include_files": [
 "app/helpers.php"
 ]
 },
}