PHP code example of beastbytes / vcard
1. Go to this page and download the library: Download beastbytes/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/ */
beastbytes / vcard example snippets
->addProperty(
Vcard::PROPERTY_N,
'Perreault;Simon;;;ing. jr,M.Sc.'
)
->addProperty(
Vcard::PROPERTY_N,
[
'Perreault',
'Simon',
'',
'',
'ing. jr,M.Sc.'
]
)
[
Vcard::PARAMETER_VALUE => Vcard::VALUE_DATA_TYPE_URI,
Vcard::PARAMETER_TYPE => '"' . Vcard::TYPE_WORK . ',' . Vcard::TYPE_VOICE . '"',
Vcard::PARAMETER_PREF => 1
]
[
Vcard::PARAMETER_VALUE => Vcard::VALUE_DATA_TYPE_URI,
Vcard::PARAMETER_TYPE => [
Vcard::TYPE_WORK,
Vcard::TYPE_VOICE
],
Vcard::PARAMETER_PREF => 1
]
$vCard = (new Vcard())
->addProperty(
Vcard::PROPERTY_FN,
'Simon Perreault'
)
->addProperty(
Vcard::PROPERTY_N,
[
'Perreault',
'Simon',
'',
'',
'ing. jr,M.Sc.'
]
)
->addProperty(
Vcard::PROPERTY_BDAY,
'--0203'
)
->addProperty(
Vcard::PROPERTY_ANNIVERSARY,
'20090808T1430-0500'
)
->addProperty(
Vcard::PROPERTY_GENDER,
Vcard::GENDER_MALE
)
->addProperty(
Vcard::PROPERTY_LANG,
'fr',
[
Vcard::PARAMETER_PREF => 1
]
)
->addProperty(
Vcard::PROPERTY_LANG,
'en',
[
Vcard::PARAMETER_PREF => 2
]
)
->addProperty(
Vcard::PROPERTY_ORG,
'Viagenie',
[
Vcard::PARAMETER_TYPE => Vcard::TYPE_WORK
]
)
->addProperty(
Vcard::PROPERTY_ADR,
[
'',
'Suite D2-630',
'2875 Laurier',
'Quebec',
'QC',
'G1V 2M2',
'Canada'
],
[
Vcard::PARAMETER_TYPE => Vcard::TYPE_WORK
]
)
->addProperty(
Vcard::PROPERTY_TEL,
'tel:+1-418-656-9254;ext=102',
[
Vcard::PARAMETER_VALUE => Vcard::VALUE_DATA_TYPE_URI,
Vcard::PARAMETER_TYPE => [
Vcard::TYPE_WORK,
Vcard::TYPE_VOICE
],
Vcard::PARAMETER_PREF => 1
]
)
->addProperty(
Vcard::PROPERTY_TEL,
'tel:+1-418-262-6501',
[
Vcard::PARAMETER_VALUE => Vcard::VALUE_DATA_TYPE_URI,
Vcard::PARAMETER_TYPE => [
Vcard::TYPE_WORK,
Vcard::TYPE_CELL,
Vcard::TYPE_VOICE,
Vcard::TYPE_VIDEO,
Vcard::TYPE_TEXT
],
]
)
->addProperty(
Vcard::PROPERTY_EMAIL,
'[email protected] ',
[Vcard::PARAMETER_TYPE => Vcard::TYPE_WORK]
)
->addProperty(
Vcard::PROPERTY_GEO,
'geo:46.772673,-71.282945',
[
Vcard::PARAMETER_TYPE => Vcard::TYPE_WORK
]
)
->addProperty(
Vcard::PROPERTY_KEY,
'http://www.viagenie.ca/simon.perreault/simon.asc',
[
Vcard::PARAMETER_TYPE => Vcard::TYPE_WORK,
Vcard::PARAMETER_VALUE => Vcard::VALUE_DATA_TYPE_URI
]
)
->addProperty(Vcard::PROPERTY_TZ, '-0500')
->addProperty(
Vcard::PROPERTY_URL,
'http://nomis80.org',
[
Vcard::PARAMETER_TYPE => Vcard::TYPE_HOME
]
)
->render()
;
$vcard = Vcard::import($string);
php composer.phar