承接 rumenx/drupal_vcard 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

rumenx/drupal_vcard

最新稳定版本:v1.0.0-beta

Composer 安装命令:

composer require rumenx/drupal_vcard

包简介

Drupal 11+ module to generate vCards.

README 文档

README

CI codecov

Features

  • Provides a service for generating vCards in Drupal.
  • 100% PHPUnit unit test coverage.
  • Composer-managed dependencies.

Installation

Composer (Packagist)

composer require rumenx/drupal_vcard_generator

Enable the module in Drupal admin or via Drush:

drush en drupal_vcard_generator

Manual Installation (GitHub/Packagist)

  1. Download or clone this repository:

    • Download the ZIP from GitHub and extract it, or run:

      git clone https://github.com/RumenDamyanov/drupal_vcard_generator.git
  2. Copy the drupal_vcard_generator folder into your Drupal site's modules/custom/ directory.

  3. Enable the module in Drupal admin or via Drush:

    drush en drupal_vcard_generator

Drupal.org Installation (Recommended)

You can install the module from Drupal.org either manually or using Composer:

Option 1: Composer (Recommended)

composer require drupal/vcard_generator

Enable the module in Drupal admin or via Drush:

drush en vcard_generator

Option 2: Manual Installation

  1. Download from Drupal.org:
  2. Copy the vcard_generator folder into your Drupal site's modules/custom/ directory.
  3. Enable the module:
    drush en vcard_generator

Usage Example

/** @var \Drupal\drupal_vcard_generator\VCardGenerator $generator */
$generator = \Drupal::service('drupal_vcard_generator.generator');
$vcard = $generator->createVCard([
  'first_name' => 'Jon',
  'last_name' => 'Snow',
  'email' => 'jon.snow@winterfell.localhost',
]);
echo $vcard;

Advanced Usage Example

/** @var \Drupal\drupal_vcard_generator\VCardGenerator $generator */
$generator = \Drupal::service('drupal_vcard_generator.generator');
$vcard = $generator->createVCard([
  'first_name' => 'Thomas A.',
  'last_name' => 'Anderson',
  'email' => 'neo@thematrix.localhost',
  'phone' => '+1-800-NEO-0001',
  'address' => [
    'street' => '303 Matrix Lane',
    'city' => 'Mega City',
    'state' => 'Zion',
    'zip' => '10101',
    'country' => 'Simulated Reality',
  ],
  'organization' => 'Resistance',
  'department' => 'The One',
  'title' => 'The One',
  'url' => 'https://thematrix.localhost/neo',
]);
file_put_contents('neo.vcf', $vcard);

Supported Fields

  • first_name, last_name: Person's name
  • email: Email address
  • phone: Phone number
  • address: Array with street, city, state, zip, country
  • organization: Organization name
  • department: Department/unit (optional)
  • title: Job title
  • url: Website

Example Output

BEGIN:VCARD
VERSION:3.0
N:Anderson;Thomas A.
FN:Thomas A. Anderson
EMAIL:neo@thematrix.localhost
TEL:+1-800-NEO-0001
ADR:;;303 Matrix Lane;Mega City;Zion;10101;Simulated Reality
ORG:Resistance;The One
TITLE:The One
URL:https://thematrix.localhost/neo
END:VCARD

Testing

Run lint and unit tests with:

composer lint
composer test

License

MIT. See LICENSE.md.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-10