|
| 1 | +<?php |
| 2 | +// Don't forget to include the composer autoloader |
| 3 | +require_once __DIR__ . '/vendor/autoload.php'; |
| 4 | + |
| 5 | +use \rutgerkirkels\vcard_generator\Generator; |
| 6 | +use \rutgerkirkels\vcard_generator\Models\Name; |
| 7 | +use \rutgerkirkels\vcard_generator\Models\Organization; |
| 8 | +use \rutgerkirkels\vcard_generator\Models\Email; |
| 9 | +use \rutgerkirkels\vcard_generator\Models\Telephone; |
| 10 | +use \rutgerkirkels\vcard_generator\Models\Url; |
| 11 | +use \rutgerkirkels\vcard_generator\Models\Birthday; |
| 12 | +use \rutgerkirkels\vcard_generator\Models\Note; |
| 13 | +use \rutgerkirkels\vcard_generator\Models\Photo; |
| 14 | + |
| 15 | +$generator = new Generator(); |
| 16 | +$generator |
| 17 | + // Set the first and last name |
| 18 | + ->setName(new Name('Marco', 'Woodberry')) |
| 19 | + // Set the name of the organization and the department (optional) |
| 20 | + ->setOrganization(new Organization('ACME', 'Engineering')) |
| 21 | + // Add a business landline (optional) |
| 22 | + ->addTelephone(new Telephone('+31206255455', 'WORK')) |
| 23 | + // Add a cellphone (optional) |
| 24 | + ->addTelephone(new Telephone('+31693382817', 'CELL')) |
| 25 | + // Add a business e-mail address (optional) |
| 26 | + -> addEmailAddress( new Email( '[email protected]', 'work')) |
| 27 | + // Add a personal e-mail address (optional) |
| 28 | + -> addEmailAddress( new Email( '[email protected]', 'home')) |
| 29 | + // Set the person's birth date (optional) |
| 30 | + ->setBirthday(new Birthday(new DateTime('1963-03-11'))) |
| 31 | + // Add a note (optional) |
| 32 | + ->setNote(new Note('First line of the note' . PHP_EOL . 'Second line of the note')) |
| 33 | + // Add a business website (optional) |
| 34 | + ->addUrl(new Url('https://www.acme.com','work')) |
| 35 | + // Store the VCF file. (default location is the current directory) |
| 36 | + ->store(); |
0 commit comments