forked from jeroendesloovere/vcard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
50 lines (36 loc) · 1.18 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* VCard generator test - can save to file or output as a download
*
* @author Jeroen Desloovere <[email protected]>
*/
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../src/VCard.php';
use JeroenDesloovere\VCard\VCard;
// define vcard
$vcard = new VCard();
// define variables
$firstname = 'Jeroen';
$lastname = 'Desloovere';
// add personal data
$vcard->addName($lastname, $firstname);
// add work data
$vcard->addCompany('Siesqo');
$vcard->addJobtitle('Web Developer');
$vcard->addEmail('[email protected]');
$vcard->addPhoneNumber(1234121212, 'PREF;WORK');
$vcard->addPhoneNumber(123456789, 'WORK');
$vcard->addAddress(null, null, 'street', 'worktown', null, 'workpostcode', 'Belgium');
$vcard->addURL('http://www.siesqo.be');
$vcard->addPhoto(__DIR__ . '/assets/landscape.jpeg');
// return vcard as a string
//return $vcard->getOutput();
// return vcard as a download
return $vcard->download();
// echo message
echo 'A personal vCard is saved in this folder: ' . __DIR__;
// or
// save the card in file in the current folder
// return $vcard->save();
// echo message
// echo 'A personal vCard is saved in this folder: ' . __DIR__;