leafs / viewi
Leaf PHP的Viewi集成
v0.2.0
2024-08-19 19:02 UTC
Requires
- leafs/leaf: *
- viewi/viewi: *
README
Leaf Viewi模块
本模块允许您快速轻松地将Viewi集成到Leaf应用中,毫无痛苦。
安装
您可以使用Leaf CLI轻松安装Leaf Viewi。
leaf install viewi
或者使用Composer。
composer require leafs/viewi
基本用法
安装模块后,您可以根据Viewi文档创建一个viewi-app/components文件夹。在那里您可以创建您的Viewi组件。回到您的Leaf入口点,您只需初始化Leaf Viewi模块并添加您的viewi路由。
<?php require __DIR__ . '/vendor/autoload.php'; require __DIR__ . '/viewi-app/components/HomePage.php'; viewi()->init(); // This is a viewi route. viewi()->get('/', HomePage::class); app()->get('/something', function () { echo 'This is a Leaf route'; }); app()->run();
默认情况下,Leaf Viewi模块将处理Viewi的配置,因此除非您想使用自己的设置,否则您不需要做任何事情。在这种情况下,您可以将Viewi配置传递到viewi()->init();
<?php use Viewi\PageEngine; require __DIR__ . '/vendor/autoload.php'; require __DIR__ . '/viewi-app/components/HomePage.php'; viewi()->init([ PageEngine::SOURCE_DIR => __DIR__ . '/ViewiApp/Components', PageEngine::SERVER_BUILD_DIR => __DIR__ . '/ViewiApp/build', PageEngine::PUBLIC_ROOT_DIR => __DIR__, PageEngine::DEV_MODE => true, PageEngine::RETURN_OUTPUT => true, PageEngine::COMBINE_JS => true ]); viewi()->get('/', HomePage::class); app()->get('/something', function () { echo 'This is a Leaf route'; }); app()->run();
贡献
我们很高兴有您。所有贡献都受欢迎!要开始,请熟悉我们的贡献指南,然后您就可以准备好发出您的第一个pull request 🚀。
要报告安全漏洞,您可以联系twitter上的@mychidarko或@leafphp。我们将协调修复并最终在此项目中提交解决方案。
代码贡献者
🤩 赞助Leaf
您的现金贡献对我们帮助Leaf变得更好大有裨益。您可以在open collective上赞助Leaf和我们的任何包,或者查看贡献页面以获取贡献方式的列表。
并且,对所有现有的现金/代码贡献者,我们都爱你们❤️