rumenx/drupal_vcard
最新稳定版本:v1.0.0-beta
Composer 安装命令:
composer require rumenx/drupal_vcard
包简介
Drupal 11+ module to generate vCards.
README 文档
README
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)
-
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
-
-
Copy the
drupal_vcard_generatorfolder into your Drupal site'smodules/custom/directory. -
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
- Download from Drupal.org:
- https://www.drupal.org/project/vcard_generator
- Git:
git clone https://git.drupalcode.org/project/vcard_generator.git
- Copy the
vcard_generatorfolder into your Drupal site'smodules/custom/directory. - 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 nameemail: Email addressphone: Phone numberaddress: Array withstreet,city,state,zip,countryorganization: Organization namedepartment: Department/unit (optional)title: Job titleurl: 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
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-10