chteuchteu / corporate-vcards-bundle
轻松创建专业外观的vcard
Requires
- php: >=5.3.0
- endroid/qrcode-bundle: ^2.0
- jeroendesloovere/vcard-bundle: ^1.2
- symfony/symfony: >=2.1.0
This package is auto-updated.
Last update: 2024-09-08 07:08:19 UTC
README
此Bundle允许您轻松创建简单且专业的vcard
特性
- 为每个定义的配置文件生成一组网页:(带有可定制的前缀)
- /vcard/jppernaut
- /vcard/cchazal
- /vcard/pparvor
- 点击时,显示包含所有配置文件信息的vcard vcf格式的二维码
- 轻松下载.vcf文件,在任何联系人管理工具中打开
- 轻松通过发送电子邮件给客户、朋友、亲戚等来共享页面
让我们开始吧
要在现有的symfony2项目中安装此bundle,请按照以下说明操作
-
需要此项目
composer require chteuchteu/corporate-vcards-bundle
-
在symfony的内核中注册此bundle
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Chteuchteu\CorporateVCardsBundle\CorporateVCardsBundle(), ); }
-
配置路由
# app/config/routing.yml CorporateVCardsBundle: resource: "@CorporateVCardsBundle/Resources/config/routing.yml" prefix: /vcard/
-
配置此bundle(请参阅定义配置文件)
-
安装资源
php bin/console asset:install
定义配置文件
现在我们已经准备好配置此bundle。config节点设置了一般配置,而default和profiles节点定义了配置文件相关信息。
首先,使用default节点定义一些或没有默认值。然后,在profiles节点内部创建一个或多个配置文件。有效的配置文件树将如下所示
bdumaurier: firstName: Bedelia lastName: Du Maurier company: Hannibal & Associates jobTitle: CEO email: bdumaurier@hannibal.com phone: mobile: +33 6 12 34 56 78 work: +33 3 12 34 56 78 address: street: 3706 Merry Cider Round city: Silverado region: California zip: 92676 country: US photo: bundles/app/img/vcards-people/bdumaurier.jpg url: http://www.my-website.com
这三个节点生成以下配置树视图
# app/config/config.yml corporate_v_cards: config: # BUNDLE CONFIGURATION mails_service: @app.mails # Set to null to disable mails favicons: enabled: true real_favicon_generator_api_key: null dir: "@AppBundle/Resources/public/img/vcards-favicons/" backgrounds: - bundles/app/img/vcards-backgrounds/1.jpg - bundles/app/img/vcards-backgrounds/2.jpg - bundles/app/img/vcards-backgrounds/3.jpg - bundles/app/img/vcards-backgrounds/4.jpg - bundles/app/img/vcards-backgrounds/5.jpg default: # DEFAULT PROFILE INFORMATION company: My Company phone: work: +33 3 45 67 89 10 url: http://my_website.com profiles: # PROFILES jdoe: firstName: John lastName: Doe photo: bundles/app/img/vcards-people/jdoe.jpg
警告:所有URI必须以上述格式格式化(@AppBundle/Resources/public/file.ext与bundles/app/file.ext格式,尾随和前导斜杠)
邮件
如果启用,则在每个vcard页面上显示一个表单,允许用户将当前vcard发送到电子邮件地址。您必须通过实现MailsServiceInterface的sendVcard函数来自行处理发送邮件。它接收三个参数
$toMail
:表单提交的电子邮件地址$profile
:个人信息:[ 'firstName' => 'John', 'lastName' => 'Doe', /* ... */ ]
$person
:在您的config.yml文件中定义的人名:jdoe
favicon图标
每个配置文件都可以使用其配置图片生成自定义favicon,使用RealFaviconGenerator的API。为了使用此功能,您必须在此处生成自己的非交互式API密钥。
建议配置config.favicons.dir为您的bundle中的目录,以便您可以将生成的资源添加到源代码管理中。
运行后,cvc:generate-favicons命令将循环遍历每个配置的配置文件,并在当前配置文件有照片且尚未生成任何favicon时调用RealFaviconGenerator的API。
注意1:您可以通过删除其目录内容来强制重新生成配置文件的favicon
注意2:如果您添加了新配置文件、更改了照片或重命名了配置文件密钥,则必须执行此命令。
电子邮件保护
为了保护配置文件的电子邮件地址免受垃圾邮件机器人的侵害,我们使用ROT13替换密码“加密”它们。然后,客户端使用简单的javascript脚本来解码它们。这种技术并不完美也不安全,但为了避免在vcard HTML源中显示清晰的电子邮件地址。
贡献
所有贡献都受欢迎!请创建您的pull请求针对master
分支。