1. Go to this page and download the library: Download rumenx/php-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/ */
rumenx / php-vcard example snippets
use Rumenx\PhpVcard\VCard;
$vcard = new VCard();
$vcard->addName('Jon', 'Snow');
$vcard->addEmail('[email protected]');
$vcard->addPhone('+1234567890');
$vcard->addAddress('123 Main St', 'City', 'State', '12345', 'Country');
// Save to file
$vcard->saveToFile('jon_snow.vcf');
// Or get as string
$content = $vcard->toString();
use Rumenx\PhpVcard\VCard;
Route::get('/vcard', function () {
$vcard = new VCard();
$vcard->addName('Arya', 'Stark');
$vcard->addEmail('[email protected]');
$vcard->addPhone('+1987654321');
return response($vcard->toString(), 200, [
'Content-Type' => 'text/vcard',
'Content-Disposition' => 'attachment; filename="arya_stark.vcf"',
]);
});
use Rumenx\PhpVcard\VCard;
use Symfony\Component\HttpFoundation\Response;
// ...
$vcard = new VCard();
$vcard->addName('Alice', 'Brown');
$vcard->addEmail('[email protected]');
$vcard->addPhone('+1122334455');
$response = new Response(
$vcard->toString(),
200,
[
'Content-Type' => 'text/vcard',
'Content-Disposition' => 'attachment; filename="alice_brown.vcf"',
]
);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.