返回介绍

Local Extenders

发布于 2021-11-04 22:44:45 字数 1314 浏览 884 评论 0 收藏 0

If there are customizations you want to make to your site without distributing an entire extension, you can do so by using local extenders. Each Flarum installation comes with an extend.php file where you can add extender instances, just like in a full extension.

See our extension documentation for more information about extenders (and even an example of a local extender).

If you need to create new files (when adding a custom class to be imported for extenders), you'll need to adjust your composer.json a bit. Add the following:


"autoload": {
    "psr-4": {
        "App\\": "app/"
    }
},

Now you can create new PHP files in an app subdirectory using the App\... namespace.

Local Extenders vs Extensions

Local extenders can be good for small tweaks, but if you need large customizations, an extension might be a better choice: a separate codebase, cleaner handling of many files, developer tooling, and the ability to easily open source are big benefits.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文