mcaskill/composer-exclude-files 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mcaskill/composer-exclude-files

最新稳定版本:v4.0.1

Composer 安装命令:

composer require mcaskill/composer-exclude-files

包简介

Exclude files from autoload_files.php

README 文档

README

Build Status Latest Release License

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

As of Composer 2.2.0, for additional security, you should declare the allow-plugins config to allow Composer to run the plugin.

composer config allow-plugins.mcaskill/composer-exclude-files true

Usage

You can only ignore files from the root composer.json. File exclusions of dependencies' composer.json are ignored.

From the root composer.json, add the exclude-from-files property to the extra section. The list of paths must be relative to this Composer manifest's vendor directory: <vendor-name>/<project-name>/<file-path>.

This plugin supports a subset of special characters used by the glob() function to match exclude paths matching a pattern:

  • * — Matches zero or more characters.
  • ? — Matches exactly one character (any character).

This plugin is invoked before the autoloader is dumped, such as with the commands install, update, and dump-autoload.

Example 1: Excluding one file from illuminate/support
{
    "require": {
        "illuminate/support": "^9.6"
    },
    "extra": {
        "exclude-from-files": [
            "illuminate/support/helpers.php"
        ]
    },
    "config": {
        "allow-plugins": {
            "mcaskill/composer-exclude-files": true
        }
    }
}
Example 2: Excluding many files from laravel/framework
{
    "require": {
        "laravel/framework": "^9.6"
    },
    "extra": {
        "exclude-from-files": [
            "laravel/framework/src/*/helpers.php"
        ]
    },
    "config": {}
}
Example 3: Excluding all files
{
    "require": {},
    "extra": {
        "exclude-from-files": [
            "*"
        ]
    },
    "config": {}
}

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.

统计信息

  • 总下载量: 892.1k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 40
  • 点击次数: 2
  • 依赖项目数: 15
  • 推荐数: 0

GitHub 信息

  • Stars: 40
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固