如何使用composer将框架拆分为自己的组件?

问题描述 投票:2回答:2

如何从主框架包中创建子包? Laravel类似于laravel/laravel是骨架应用程序,laravel/framework是根框架包。 Symfony与symfony/framework-standard-edition做了类似的事情。

我只是想在我的主包下创建一些包。像这样的东西:

Xyx
Xyz\Service
Xyz\Service\Providers\

Xyz/Service/Providers/文件夹应替换为指定的包(例如:Abc/Service/StrProvider)内容。

git project-management git-subtree
2个回答
3
投票

这些是git子树分裂。 GitHub有一个关于它的doc article。简而言之:

# clone your main repo
$ git clone https://github.com/USERNAME/REPOSITORY-NAME
$ cd REPOSITORY-NAME

# do the actual subtree split
$ git filter-branch --prune-empty --subdirectory-filter FOLDER-NAME  BRANCH-NAME 

# push to the subtree split repo
$ git remote set-url origin https://github.com/USERNAME/NEW-REPOSITORY-NAME.git
$ git push -u origin BRANCH-NAME

Symfony背后的公司SensioLabs开放了Symfony使用的go脚本作为split.sh lite


2
投票

2019年更新!

在CLI中使用bash / git命令多年后,我制作了一个简单的PHP包装器MonorepoBuilder,非常简单地为所有开发人员使用。

1.准备配置

# monorepo-builder.yaml
parameters:
    directories_to_repositories:
        packages/CodingStandard: '[email protected]:Symplify/CodingStandard.git'
        packages/EasyCodingStandard: '[email protected]:Symplify/EasyCodingStandard.git'

2.运行命令

vendor/bin/monorepo-builder split

就这样!

你可以阅读更多关于这个Create, Merge and Split Monorepo with 1 Command的信息

© www.soinside.com 2019 - 2024. All rights reserved.