PHP code example of rumenx / drupal_vcard

1. Go to this page and download the library: Download rumenx/drupal_vcard library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rumenx / drupal_vcard example snippets


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

/** @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' => '[email protected]',
  '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);
bash
drush en vcard_generator
bash
   drush en vcard_generator
   
bash
drush en drupal_vcard_generator
bash
     drush en drupal_vcard_generator