https://github.com/astrotomic/laravel-vcard
A fluent builder class for vCard files.
https://github.com/astrotomic/laravel-vcard
contact contacts laravel vcard vcf
Last synced: 6 months ago
JSON representation
A fluent builder class for vCard files.
- Host: GitHub
- URL: https://github.com/astrotomic/laravel-vcard
- Owner: Astrotomic
- License: mit
- Created: 2021-02-21T23:49:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-10T11:33:20.000Z (over 1 year ago)
- Last Synced: 2025-04-19T06:42:02.821Z (6 months ago)
- Topics: contact, contacts, laravel, vcard, vcf
- Language: PHP
- Homepage:
- Size: 211 KB
- Stars: 50
- Watchers: 3
- Forks: 17
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel vCard
[](https://packagist.org/packages/astrotomic/laravel-vcard)
[](https://github.com/Astrotomic/laravel-vcard/blob/master/LICENSE)
[](https://plant.treeware.earth/Astrotomic/laravel-vcard)
[](https://www.larabelles.com/)[](https://github.com/Astrotomic/laravel-vcard/actions?query=workflow%3Aphpunit)
[](https://github.com/Astrotomic/laravel-vcard/actions?query=workflow%3Apint)
[](https://packagist.org/packages/astrotomic/laravel-vcard)A fluent builder class for vCard files.
## Installation
You can install the package via composer:
```bash
composer require astrotomic/laravel-vcard
```## Usage
```php
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('john.smith@mail.com')
->email('john.smith@company.com', [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('john.smith@company.com', '550e8400-e29b-11d4-a716-446655440000')
->note('Hello world')
;
``````vcard
BEGIN:VCARD
VERSION:4.0
FN;CHARSET=UTF-8:John Adam Smith
N;CHARSET=UTF-8:Smith;John;Adam;;
KIND:individual
GENDER:M
EMAIL;TYPE=INTERNET:john.smith@mail.com
EMAIL;TYPE=WORK;TYPE=INTERNET:john.smith@company.com
TEL;TYPE=HOME;TYPE=VOICE:+1234567890
TEL;TYPE=WORK;TYPE=VOICE:+0987654321
TEL;TYPE=CELL;TYPE=VOICE:+0123456789
URL:https://johnsmith.com
URL:https://company.com
BDAY:1990-06-24
ADR;TYPE=WORK:;;1600 Pennsylvania Ave NW;Washington;DC;20500-0003;USA
PHOTO;data:image/jpeg;base64,...
TITLE:V. P. Research and Development
ROLE:Excecutive
ORG:Google;GMail Team;Spam Detection Squad
MEMBER:urn:uuid:550e8400-e29b-11d4-a716-446655440000
REV:2021-02-25T10:30:45.000000Z
PRODID:-//Astrotomic vCard
END:VCARD
```