以一个创建的laravel应用程序,一种创建类似共享一个核心的2个应用程序的方式? [英] Take a created laravel app, a way to create something like 2 apps that share a core?

查看:107
本文介绍了以一个创建的laravel应用程序,一种创建类似共享一个核心的2个应用程序的方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个laravel 5.3慈善应用程序

现在客户告诉我:

我想再次拥有相同的应用程序,但只适用于某些特定的应用程序,例如同一个应用程序,但仅限于慈善机构为自然捐赠。所以新的标志,不同的电子邮件等

什么是一种好方法,可以在两个应用程序之间共享更新,而无需重做所有提交并手动合并提交每个子项目?



我想也许某种方式你有一个核心项目,并单独的git回购只包含你想覆盖的文件在上述应用程序..不完全确定使用什么工具等,或者是否有更聪明的东西。

编辑
我想过从应用程序创建一个包含应用程序A的所有内容的服务提供者,通过composer package 。现在,应用CLONE将使用此服务提供商/作曲家套餐。当我更新应用程序A的服务提供商时,我只需在我的克隆应用程序中运行Composer更新。问题:
如果更新需要数据库迁移,该怎么办? 这样做的方法是设置两个Laravel应用程序,然后构建一个包含所有核心组件的 Composer 软件包。



您可以轻松链接到Composer中的包装,这些包装在私人存储库中,完全绕过Packagist。



设置在 composer.json 文件中很容易。
app作曲文件会遵循这种模式:

  {
type:project ,
repositories:[
{
type:git,
url:git@github.com:your / package.git
}
],
require:{
your / package:dev-master,
...
}
}

虽然通用软件包会遵循这一点:

  {
name:your / package,
autoload:{
psr-4:{
YourPackage \\:src /
}
}
}

然后,只需将任何常用的类/帮助程序提交到 your / package.git 存储库中,并且可以在两者中轻松访问它们。


I have created a laravel 5.3 charity app

now the client tells me:

I want to have the same app again, but only for certain things, say, the same app but only for charity donations for nature. So new logo, different emails etc

what is a good way, to make it possible to share updates across the two apps without having to redo all commits and manually merge commits in each sub project?

I thought maybe some way where you have a core project, and separate git repo that only contains the files you want to overwrite in the said application... not exactly sure what tools to use etc or if there is something smarter.

EDIT I thought about creating from app A a service provider that includes everything of app A, make it available via composer package. Now app CLONE will use this service provider / composer package. When I make an update to the service provider of app A I just run a composer update in my cloned app. Problem: what if the update needs database migrations?

解决方案

A good way to do this would be to set up two Laravel apps and then build a Composer package that contains all of the core components.

You can easily link to packages in Composer that are hosted in private repositories, bypassing Packagist entirely.

Setting it up in the composer.json file is quite easy. The app composer files would follow this sort of pattern:

{
    "type": "project",
    "repositories": [
        {
            "type": "git",
            "url": "git@github.com:your/package.git"
        }
    ],
    "require": {
        "your/package": "dev-master",
        ...
    }
}

While the common package would follow this:

{
    "name": "your/package",
    "autoload": {
        "psr-4": {
            "YourPackage\\": "src/"
        }
    }
}

Then just commit any common classes/helpers into the your/package.git repository, and you can easily access them in both.

这篇关于以一个创建的laravel应用程序,一种创建类似共享一个核心的2个应用程序的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆