PHP code example of astrotomic / laravel-vcard

1. Go to this page and download the library: Download astrotomic/laravel-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/ */

    

astrotomic / laravel-vcard example snippets


use Astrotomic\Vcard\Properties\Email;
use Astrotomic\Vcard\Properties\Gender;
use Astrotomic\Vcard\Properties\Kind;
use Astrotomic\Vcard\Properties\Tel;
use Astrotomic\Vcard\Vcard;
use Carbon\Carbon;

Vcard::make()
    ->kind(Kind::INDIVIDUAL)
    ->gender(Gender::MALE)
    ->fullName('John Adam Smith')
    ->name('Smith', 'John', 'Adam')
    ->email('[email protected]')
    ->email('[email protected]', [Email::WORK, Email::INTERNET])
    ->tel('+1234567890', [Tel::HOME, Tel::VOICE])
    ->tel('+0987654321', [Tel::WORK, Tel::VOICE])
    ->tel('+0123456789', [Tel::CELL, Tel::VOICE])
    ->url('https://johnsmith.com')
    ->url('https://company.com')
    ->bday(Carbon::parse('1990-06-24'))
    ->adr('','','1600 Pennsylvania Ave NW', 'Washington', 'DC', '20500-0003', 'USA')
    ->photo('data:image/jpeg;base64,'.base64_encode(file_get_contents(__DIR__.'/stubs/photo.jpg')))
    ->title('V. P. Research and Development')
    ->role('Excecutive')
    ->org('Google', 'GMail Team', 'Spam Detection Squad')
    ->member('[email protected]', '550e8400-e29b-11d4-a716-446655440000')
    ->note('Hello world')
;