astrotomic / laravel-vcard
A fluent builder class for vCard files.
Fund package maintenance!
Gummibeer
SarahSibert
Issuehunt
forest.astrotomic.info
Installs: 14 676
Dependents: 0
Suggesters: 0
Security: 0
Stars: 46
Watchers: 4
Forks: 16
Open Issues: 6
Requires
- php: ^8.1
- astrotomic/php-conditional-proxy: ^0.2.1
- illuminate/contracts: ^9.0 || ^10.0 || ^11.0
- illuminate/http: ^9.0 || ^10.0 || ^11.0
- illuminate/support: ^9.0 || ^10.0 || ^11.0
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/testbench: ^7.0 || ^8.0 || ^9.0
- phpunit/phpunit: ^9.3 || ^10.0
- spatie/phpunit-snapshot-assertions: ^4.2 || ^5.1
README
A fluent builder class for vCard files.
Installation
You can install the package via composer:
composer require astrotomic/laravel-vcard
Usage
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') ;
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