PHP code example of khalilleo-webagentur / vcard-parser

1. Go to this page and download the library: Download khalilleo-webagentur/vcard-parser 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/ */

    

khalilleo-webagentur / vcard-parser example snippets




halilleo\VCardParser\VCardWrapper;

$vcfFileExample1 = 'Example-01.vcf';
$vcfFileExample2 = 'Example-02.vcf';
$vcfFileExample3 = 'Example-03.vcf';

$vCardWrapper = new VCardWrapper($vcfFileExample1);

echo $vCardWrapper->asJson();

var_export($vCardWrapper->asArray());

// output:

array ( 
    'firstName' => 'John',
    'lastName' => 'Doe',
    'fullName' => 'John Doe',
    'photo' => 'https://k24.ing/assets/img/logo.png',
    'organization' => NULL,
    'phones' => array ( 
        0 => array ( 
            'phoneNumber' => '(111) 555-1212', 
            'type' => 'work, voice', ),
        1 => array ( 
            'phoneNumber' => '(404) 555-1212', 
            'type' => 'home, voice', ),
        2 => array (
            'phoneNumber' => '(404) 555-1213', 
            'type' => 'home, voice', ),
    ),
    'emails' => array ( 
        0 => array ( 
            'email' => '[email protected]',
             'type' => 'pref, internet', ),
        1 => array (
            'email' => '[email protected]',
             'type' => 'internet', ),
    ),
    'urls' => array (
        0 => array ( 'url' => 'https://www.google.com/', ), 
    ), 
    'addresses' => array ( 
          0 => array ( 
                'type' => 'home',
                 'StreetAddress' => '42 Plantation St.', 
                 'PoBox' => '', 
                 'ExtendedAddress' => '', 
                 'Locality' => 'Baytown',
                 'Region' => 'LA',
                 'PostCode' => '', 
                 'Country' => 'United States of America', 
    ),
   ),
 )