Userfrosting best practice for helper functions

一个人想着一个人 提交于 2019-12-10 11:32:40

问题


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

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

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.

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

Does userfrosting have any extensibility like symfony?

Any help / pointer is appreciated!

Thanks!


回答1:


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.

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).

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 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.



来源:https://stackoverflow.com/questions/38701760/userfrosting-best-practice-for-helper-functions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!