定制 masgeek/windows-ext-ignorer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

masgeek/windows-ext-ignorer

Composer 安装命令:

composer require masgeek/windows-ext-ignorer

包简介

Composer plugin to ignore pcntl/posix platform reqs on Windows

README 文档

README

A Composer plugin that automatically ignores platform requirements like ext-pcntl and ext-posix on Windows systems.

🚧 The Problem

Many PHP packages require extensions such as ext-pcntl and ext-posix—extensions that are not available on Windows. As a Windows developer, you're often forced to:

  1. Add the --ignore-platform-reqs flag to every Composer command
  2. Set up custom command aliases
  3. Modify composer.json manually to workaround the missing extensions

✅ The Solution

This plugin automatically detects when you're on a Windows system and spoofs the required extensions for you—no flags, no aliases, no extra steps.

It works out of the box with sensible defaults (ignoring ext-pcntl and ext-posix), and you can also customize which extensions you want to ignore via composer.json!

⚠️ Production Environment Disclaimer

Important:
This plugin is designed for development environments on Windows only.
It should not be used in production environments, staging servers, or CI pipelines that require accurate platform checks.

Ignoring required PHP extensions may cause runtime errors or unexpected behavior in your application. Always ensure your production environment meets the actual extension requirements of your packages.

⚙️ Installation

It’s recommended to install the plugin as a development dependency, since it’s only useful in development environments:

composer require --dev masgeek/windows-ext-ignorer

🚀 Usage

Once installed, the plugin just works on Windows.

When running any Composer command:

  1. The plugin detects that you're on Windows
  2. It automatically injects the specified extensions into Composer’s platform config
  3. Composer proceeds without showing errors about missing extensions

🔧 Customizing Ignored Extensions

By default, the plugin injects these extensions into Composer’s platform config:

  • ext-pcntl: 1.0.0
  • ext-posix: 1.0.0

If you want to ignore additional (or different) extensions, you can specify them in your composer.json file under the extra section.

Example composer.json Configuration:

{
  "extra": {
    "ignored-extensions": {
      "ext-pcntl": "1.0.0",
      "ext-posix": "1.0.0",
      "ext-sockets": "1.0.0"
    }
  }
}

You can specify any extensions that are not supported or available in your Windows environment.

🖥️ Verbose Output

To see the plugin in action, run Composer with the -v or -vvv flag:

composer require some/package -vvv

Example output:

➡️  Running Composer Command: require
🔧 Found ignored-extensions in composer.json: {"ext-pcntl":"1.0.0","ext-posix":"1.0.0","ext-sockets":"1.0.0"}
🛠️  Ignoring missing platform requirement: ext-pcntl=1.0.0
🛠️  Ignoring missing platform requirement: ext-posix=1.0.0
🛠️  Ignoring missing platform requirement: ext-sockets=1.0.0
✅ Platform config updated to spoof missing extensions.

⚙️ How It Works

  1. Subscribes to Composer’s pre-command-run event
  2. Detects if the OS is Windows
  3. If true, it merges default and composer.json configured ignored extensions
  4. It updates Composer’s platform config at runtime
  5. After Composer runs, the overrides are cleared (no changes are persisted to your files)

❓ FAQ

Q: Will this modify my composer.json?
A: No. It temporarily adjusts Composer’s internal configuration and does not write to your composer.json file.

Q: Can I use this on Linux or Mac?
A: No. The plugin only activates on Windows (PHP_OS_FAMILY === 'Windows'). On other operating systems, it does nothing.

📝 License

MIT License
Author: Sammy Barasa

masgeek/windows-ext-ignorer 适用场景与选型建议

masgeek/windows-ext-ignorer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 834 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 masgeek/windows-ext-ignorer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 masgeek/windows-ext-ignorer 我们能提供哪些服务?
定制开发 / 二次开发

基于 masgeek/windows-ext-ignorer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 834
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 24
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-24