elouafidev / vcf-generator
A simple VCF generator for Laravel.
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/elouafidev/vcf-generator
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): selfsetEmail(string $email, string $type): selfsetPhoneNumber(string $phone, string $type): selfsetAddress(string $address): selfsetTitle(string $title): selfsetDescription(string $description): selfsetProfileImage150x150(string $profile_image_150x150): selfsetFacebook(string $url): selfsetTwitter(string $url): selfsetLinkedin(string $url): selfsetYoutube(string $url): selfsetInstagram(string $url): selfsetWebsite(string $url): selfsetSkype(string $url): selfvcfContent(): stringtoBase64(): stringtoUri(): stringdownload()validateEmail(string $email): boolvalidatePhoneNumber(string $phone): boolclear(): selfsetAttributes(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