isaactopo/vcard-kirby3
Composer 安装命令:
composer require isaactopo/vcard-kirby3
包简介
VCard Plugin for Kirby 3
README 文档
README
Easily generate VCard for your contact profiles
Requirements
- Kirby V3
- PHP 7.1+
get_headers()configurated on the server byallow_url_fopen=1
How to Install
You have three different methods:
Download
Download and copy this repository to /site/plugins/vcard-kirby3
Git Submodule
git submodule add https://github.com/isaactopo/vcard-kirby3.git site/plugins/vcard-kirby3
Composer
composer require isaactopo/vcard-kirby3
Usage
After installing the VCard Plugin you need to create a controller for your page, for example a profile page: site/controllers/profile.php :
With this controller you can pass a variable to your controller like: yourdomain.com/profile/vcard:download it could be downloador whatever you like if the param vcard is present
<?php return function ($page, $pages, $site, $kirby) { if ($vcard = param('vcard')) { // Get the VCard Instance $vcard = $site->vcard(); // Define Variables $additional = ''; $prefix = ''; $suffix = ''; $lastname = ''; // Get Your data from your Fields $firstname = $page->firstName(); // add personal data $vcard->addName($lastname, $firstname, $additional, $prefix, $suffix); // add work data $vcard->addCompany('DaCompany'); $vcard->addJobtitle('Web Developer'); $vcard->addRole('Code reviewer'); $vcard->addEmail('info@topo.bz'); $vcard->addPhoneNumber(666666666, 'PREF;WORK'); $vcard->addPhoneNumber(93888666222, 'WORK'); $vcard->addAddress(null, null, 'street', 'worktown', null, 'workpostcode', 'Belgium'); $vcard->addLabel('street, worktown, workpostcode Belgium'); $vcard->addURL('http://topo.bz'); // Add a photo if($img = $page->profilePicture()->toFile()){ $img = $img->crop(400, 400, 85)->save()->root(); $vcard->addPhoto($img); } return $vcard->download(); } }
For Debugging you can echo the VCard as a String
// return vcard as a string echo $vcard->getOutput();
You can save the VCard on Disk too:
// save vcard on disk $vcard->setSavePath('/path/to/directory'); $vcard->save();
Troubleshooting
VCard Image
If you have problems attaching the profile image try to pass the image item as a parameter instead the image URL:
- $vcard->addPhoto($img->url()); + $vcard->addPhoto($img);
Charset Encoding
I found certain special characters problems on some servers and solved it specifying:
$vcard->setCharset('ISO-8859-1');
and UTF-Decoding fields:
$firstname = utf8_decode($page->firstName());
License
This plugin is free but Kirby needs a license
Credits
This is a Wrapper for the jeroendesloovere/vcard library.
isaactopo/vcard-kirby3 适用场景与选型建议
isaactopo/vcard-kirby3 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 85 次下载、GitHub Stars 达 4, 最近一次更新时间为 2020 年 05 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 isaactopo/vcard-kirby3 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 isaactopo/vcard-kirby3 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 85
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-05-30
