elouafidev / vcf-generator
A simple VCF generator for Laravel.
1.0.3
2024-08-11 17:48 UTC
Requires
- php: >=7.4
- illuminate/support: ^7.0|^8.0|^9.0|^10.0|^11
Requires (Dev)
- phpunit/phpunit: ^9.0
README
A simple VCF (vCard) generator for Laravel. This package provides an easy way to generate VCF files for contacts in your Laravel applications. It supports adding various contact details such as full name, email addresses, phone numbers, addresses, social media profiles, and more.
Installation
You can install the package via composer:
composer require elouafidev/vcf-generator
Usage
Here is a simple example of how to use the VCF generator in your Laravel project:
use ElouafiDev\VCFGenerator\VCFGenerator; $vcf = new VCFGenerator(); $vcf->setFullName('John Doe') ->setEmail('john.doe@example.com', VCFGenerator::WORK) ->setPhoneNumber('+123456789', VCFGenerator::WORK) ->setAddress('123 Main St, Anytown, USA') ->setTitle('Software Engineer') ->setDescription('Experienced software engineer with a passion for developing innovative programs.') ->setProfileImage150x150('/path/to/image.png') ->setFacebook('https://facebook.com/johndoe') ->setTwitter('https://twitter.com/johndoe') ->setLinkedin('https://linkedin.com/in/johndoe') ->setYoutube('https://youtube.com/johndoe') ->setInstagram('https://instagram.com/johndoe') ->setWebsite('https://johndoe.com') ->setSkype('johndoe'); return $vcf->download();
Methods
setFullName(string $full_name): self
setEmail(string $email, string $type): self
setPhoneNumber(string $phone, string $type): self
setAddress(string $address): self
setTitle(string $title): self
setDescription(string $description): self
setProfileImage150x150(string $profile_image_150x150): self
setFacebook(string $url): self
setTwitter(string $url): self
setLinkedin(string $url): self
setYoutube(string $url): self
setInstagram(string $url): self
setWebsite(string $url): self
setSkype(string $url): self
vcfContent(): string
toBase64(): string
toUri(): string
download()
validateEmail(string $email): bool
validatePhoneNumber(string $phone): bool
clear(): self
setAttributes(array $attributes): self
Examples
Generate VCF Content
$vcfContent = $vcf->vcfContent(); echo $vcfContent;
Get VCF as Base64
$vcfBase64 = $vcf->toBase64(); echo $vcfBase64;
Get VCF as Data URI
$vcfUri = $vcf->toUri(); echo $vcfUri;
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.
Author
Mouad Elouafi
- Email: support@elouafi.dev