定制 nfourtythree/vcard 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nfourtythree/vcard

Composer 安装命令:

composer require nfourtythree/vcard

包简介

vCard generator plugin for Craft CMS 5

README 文档

README

Plugin Icon

vCard plugin for Craft CMS 5.x

vCard generator plugin for Craft CMS 5

Requirements

This plugin requires Craft CMS 5.0.0 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require nfourtythree/vcard
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for vCard.

vCard Overview

This plugin generates a link to download a vCard from data you specify

Configuring vCard

There is only one setting for this plugin which is salt this is a string used for salting the encoded data when generating the vCard link.

This can be set by creating a vcard.php config file in the config/ directory. Below is an example of the config file:

<?php

return [
    'salt' => 'your-salt-here'
];

Using vCard

The only thing that is really required is first name. Everything else is optional

Usage

There is a link variable available for usage in templates craft.vCard.link(options)

{% set options = {
  firstName: "Johnny",
  lastName: "Appleseed",
  additional: "Jim",
  prefix: "Mr",
  suffix: "Esq",
  company: "Apple Inc.",
  jobTitle: "Data Demo",
  email: [{ address: "johnny@apple.com", type: "WORK" }, "johnny@gmail.com"],
  url: "http://apple.com",
  phoneNumber: ["+1 234 567 89", { number: "+9 876 543 21"}],
  photo: "http://exmaple.com/images/avatar.jpg",
  address: [{
      name: "Apple",
      extended: "Suite 1",
      street: "1 Infinte Loop",
      city: "Cupertino",
      region: "CA",
      zip: "95014",
      country: "USA",
      type: "WORK;PARCEL;POSTAL"
    },
    {
      street: "1 Yemen Road",
      zip: "1234",
      country: "Yemen",
      type: "HOME;POSTAL"
    }],
  note: "Hi there",
  role: "Web Developer",
} %}

<a href="{{ craft.vCard.link(options) }}">Download my vCard</a>

Options

Name Type Example
firstName String Johnny
lastName String Appleseed
additional String Jim (commonly a middle name)
prefix String Mr
suffix String Esq
company String Apple Inc
jobTitle String Demo Data Guru
email String/Array See email docs
url String/Array See url docs
address String/Array See address docs
phoneNumber String/Array See phoneNumber docs
birthday String 1985-10-26 (YYYY-MM-DD format)
note String Johnny is amazing
photo String http://example.com/images/avatar.jpg (Url to image)
email

This can be specified as either a string johnny@apple.com or an array (or even a mix!)

Name Type Example
address String johnny@apple.com
type String type may be PREF, WORK, HOME or any combination of these: e.g. "PREF;WORK". This is not required
  email: {
    address: "johnny@apple.com",
    type: "WORK"
  }

  // For multiple email addresses
  email: [{
      address: "johnny@apple.com",
      type: "WORK"
    },
    {
      address: "johnny@gmail.com",
      type: "PREF;HOME"
    }]

  // Mix and match example
  email: ["johnny@apple.com", {
      address: "johnny@gmail.com",
      type: "PREF;HOME"
    }]

url

This can be specified as either a string http://apple.com or an array (or even a mix!)

Name Type Example
address String http://apple.com
type String type may be WORK, HOME This is not required
  url: {
    address: "http://apple.com",
    type: "WORK"
  }

  // For multiple urls
  url: [{
      address: "http://apple.com",
      type: "WORK"
    },
    {
      address: "http://google.com",
      type: "HOME"
    }]

  // Mix and match example
  url: ["http://apple.com", {
      address: "http://google.com",
      type: "HOME"
    }]


phoneNumber

This can be specified as either a string +1 234 567 89 or an array (or even a mix!)

Name Type Example
number String +1 234 567 89
type String Type may be PREF, WORK, HOME, VOICE, FAX, MSG, CELL, PAGER, BBS, CAR, MODEM, ISDN, VIDEO or any sensible combination, e.g. "PREF;WORK;VOICE"
  phoneNumber: {
    number: "+1 234 567 89",
    type: "PREF;WORK;VOICE"
  }

  // For multiple phoneNumbers
  phoneNumber: [{
      number: "+1 234 567 89",
      type: "WORK"
    },
    {
      number: "+9 876 543 21",
      type: "PREF;HOME"
    }]

  // Mix and match example
  phoneNumber: ["+1 234 567 89", {
      number: "+9 876 543 21",
      type: "HOME"
    }]


address

This can be either a single or multi array

Name Type Example
name String Apple
extended String Suite 1
street String 1 Infinite Loop
city String Cupertino
region String CA
zip String 95014
country String USA
type String type may be DOM, INTL, POSTAL, PARCEL, HOME, WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
  address: {
    name: "Apple",
    extended: "Suite 1",
    street: "1 Infinte Loop",
    city: "Cupertino",
    region: "CA",
    zip: "95014",
    country: "USA",
    type: "WORK;PARCEL;POSTAL"
  }

  // For multiple addresses
  address: [{
      name: "Apple",
      extended: "Suite 1",
      street: "1 Infinte Loop",
      city: "Cupertino",
      region: "CA",
      zip: "95014",
      country: "USA",
      type: "WORK;PARCEL;POSTAL"
    },
    {
      street: "1 Yemen Road",
      zip: "1234",
      country: "Yemen",
      type: "HOME;POSTAL"
    }]

ToDo

  • Clean up / refactor code to tidy code that was done quickly

Brought to you by Nathaniel Hammond (nfourtythree)

Thanks to

nfourtythree/vcard 适用场景与选型建议

nfourtythree/vcard 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.82k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2019 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cms」 「vCard」 「Craft」 「craftcms」 「craft-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 nfourtythree/vcard 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nfourtythree/vcard 我们能提供哪些服务?
定制开发 / 二次开发

基于 nfourtythree/vcard 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10.82k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-26