steady-ua/unicorn 问题修复 & 功能扩展

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

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

steady-ua/unicorn

Composer 安装命令:

composer require steady-ua/unicorn

包简介

Composer monorepo plugin

README 文档

README

The composer plugin organizes a mono-repository of php packages.
Ensures the consistency of all dependencies on the same package version.
Adds tools for working with shared dependencies.

  1. Concept
  2. Documentation

Concept

For example, we have two projects:

  • the web project serves http requests
  • the worker project for background processes

Both projects use common packages placed in the packages directory

 apps/
    web/
        index.php
        composer.json
    worker/
        console.php
        composer.json
 packages/
    foo/
        composer.json
    bar/
        composer.json
 composer.json  # monorepo definition root config

Raw composer - provides the ability to include local packages by specifying your own path repository.
But there are a number of limitations, such as:

  • in each composer.json file you must describe all local repositories.
  • each package has its own local file, and it is possible that packages of different versions are used.
  • difficult to analyze package usage.
  • difficult to update dependencies used in different packages.

The steady-ua/unicorn plugin removes these restrictions and provides tools for analyzing and updating dependencies.

Why Unicorn instead of other Monorepo tools? Unlike tools that merge all composer.json files into a single root file, unicorn works as a native Composer v2 plugin.

  • Native Dependency Resolution: All monorepo packages are registered in a local Composer registry. This delegates validation entirely to Composer's native SAT solver. To add a dependency, simply navigate to the needed package and run composer require my/foo. Composer will naturally prevent version conflicts (e.g., trying to install different versions of a third-party library across the monorepo) and will automatically detect and prevent circular dependencies during installation.
  • Semantic Versioning at the Core: The entire architecture revolves around semantic versioning. Each package must define its version in composer.json (e.g., "version": "1.0.0"). To simplify workflows, the uni:version command automates version bumping, updates the constraints in any dependent local packages, and runs configured tests or scripts. For external dependencies, the uni:update command simplifies third-party package migration by synchronizing updates and running tests across all dependent local packages.
  • Dependency Analysis & Visualization: Includes built-in commands like uni:why and uni:why-not to trace dependency paths across the monorepo, as well as an interactive browser-based dependency graph visualization using the uni:server command.
  • Isolated Contexts: For development, a shared vendor folder is created at the project root. However, packages remain self-sufficient. Each package retains its own composer.json and gets its own local vendor directory where only its explicitly required dependencies are installed via symlinks. This prevents accidental reliance on undeclared packages and allows you to run dependency analysis tools accurately at the individual package level.
  • Smart CI capabilities: Commands like uni:run allow you to execute scripts (e.g., tests or linters) recursively up the dependency tree, ensuring that changes in a base package don't break downstream dependents without having to run tests for the entire monorepo.
  • Distribution and Release: Solves common monorepo deployment issues.
    The uni:build command extracts an independent, ready-to-run application with only its strictly required dependencies, making it perfect for Docker builds or direct deployment without dragging the entire monorepo along.
    Additionally, the uni:split command automates the publishing of local packages to separate, read-only repositories. This allows external projects outside the monorepo to easily require your shared packages via standard Composer installations.

Documentation

For a detailed guide on how to work with Unicorn, check out the docs/ directory:

steady-ua/unicorn 适用场景与选型建议

steady-ua/unicorn 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 57 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 04 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 steady-ua/unicorn 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-29