Skip to content

📦 Composer plugin to exclude files required by packages using the 'files' autoloading mechanism.

License

Notifications You must be signed in to change notification settings

hallids/composer-plugin-exclude-files

 
 

Repository files navigation

Exclude PHP files from Composer

Build Status Coverage Status License GitHub tag

A Composer plugin for excluding files required by packages using the 'files' autoloading mechanism.

This is useful for ignoring files required for bootstrapping a package or that provide PHP functions, for example.

Resolves composer/composer#5029

Installation

The plugin can be installed locally or globally.

$ composer require mcaskill/composer-exclude-files

Usage

You can only ignore files from your main composer.json.
File exclusions of dependencies' composer.jsons are ignored.

From your main composer.json, add the exclude-from-files property to either the 'autoload' section or the 'extra' section. The list of paths must be absolute from the vendor directory.

This plugin is invoked before the autoloader is dumped, either during install/update, or via the dump-autoload command.

Example:

{
    "require": {
        "illuminate/support": "^5.5"
    },
    "autoload": {
        "exclude-from-files": [
            "illuminate/support/helpers.php"
        ]
    }
}

The plugin will traverse each package and remove all files in the paths configured above from the prepared autoload map. The vendor files themselves are not removed. The root package is ignored.

The resulting effect is the specified files are never included in vendor/composer/autoload_files.php.

License

This is licensed under MIT.

About

📦 Composer plugin to exclude files required by packages using the 'files' autoloading mechanism.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%