用户优化助手功能的最佳实践 [英] Userfrosting best practice for helper functions

查看:88
本文介绍了用户优化助手功能的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用用户冻结功能的项目中具有自定义代码(函数库)的最佳实践是什么?

What would be the best practice to have custom code (library of functions) in a project using userfrosting?

到目前为止,我修改了现有的userfrosting控制器,这使漂亮的简洁代码code肿了.

As of now, I modify existing userfrosting controllers, which bloats the nice concise code.

我猜想有一个很好的方法可以将自定义功能保留在一个地方,这不会干扰Userfrosting的代码,因此在用户frosting升级期间不会受到太大影响.

I guess there is a nice way to keep custom functions in a place, which will not interfere with Userfrosting's code and thereby not be affected much during userfrosting upgrades.

目前,我想为通知,条形码等添加一些自定义功能.

At the moment, i'd like to have some custom functions for notifications, barcode etc.

猜猜在composer下使用供应商文件夹会是理想选择吗?如果是这样,该怎么办?

Guess using a vendor folder under composer would be ideal? If so, how to go about it?

userfrosting是否具有类似于symfony的可扩展性?

Does userfrosting have any extensibility like symfony?

任何帮助/指针都值得赞赏!

Any help / pointer is appreciated!

谢谢!

推荐答案

从0.3.1版本开始,没有一种干净的方法可以将核心交付的代码与开发人员实现的代码分开.对于版本中的次要更新(因此,为0.3.1的修补程序),保持最新状态的最佳方法是使用git将项目设为

As of version 0.3.1, there is no clean way to separate the core shipped code from developer-implemented code. For minor updates within a version (so, hotfixes to 0.3.1), the best way to keep up-to-date is by using git to make your project a fork of the UserFrosting repository.

例如,您可能将spurgeon/brood-crm(您的项目存储库)作为userfrosting/UserFrosting的分支.然后,您可以将userfrosting/UserFrosting设置为上游遥控器为您的回购.每当发布针对userfrosting/UserFrosting的修补程序时,您就可以与上游同步您的叉子.这样会将对主存储库所做的更改拉入您的项目,并为您提供解决任何合并冲突的机会(希望不会有任何合并冲突).

So for example, you might have spurgeon/brood-crm (your project repo) as a fork of userfrosting/UserFrosting. You can then set userfrosting/UserFrosting as an upstream remote for your repo. Whenever a hotfix is released for userfrosting/UserFrosting, you can sync your fork with the upstream. This will pull changes to the main repo into your project, and give you a chance to resolve any merge conflicts (hopefully, there won't be any).

对于不熟悉git和GitHub之间区别的人,我应该指出,您可以在本地完成所有这些操作,而无需在GitHub上发布fork.

For people who are not familiar with the distinction between git and GitHub, I should point out that you can do all of this locally, without publishing your fork on GitHub.

UserFrosting 4(最终)将具有一个模块化,完全可扩展的设计.不必直接修改附带的代码,您将可以在单独的目录中覆盖核心路由,模板,架构,资产等.但是,从版本0.3.x升级到版本4可能需要手动完成.

UserFrosting 4 will (finally) have a modular, fully extendable design. Rather than having to directly modify the shipped code, you will be able to override the core routes, templates, schema, assets, etc in a separate directory. Upgrading from version 0.3.x to version 4, however, will probably need to be done manually.

这篇关于用户优化助手功能的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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