PHPackages                             tomsgu/vcard - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tomsgu/vcard

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tomsgu/vcard
============

This VCard PHP class can generate a vCard with some data. When using an iOS device it will export as a .ics file because iOS devices don't support the default .vcf files.

2.0.0(4y ago)0189MITPHPPHP ^8.0

Since Apr 2Pushed 4y agoCompare

[ Source](https://github.com/Tomsgu/vcard)[ Packagist](https://packagist.org/packages/tomsgu/vcard)[ Docs](https://github.com/jeroendesloovere/vcard)[ RSS](/packages/tomsgu-vcard/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (30)Used By (0)

VCard PHP library
=================

[](#vcard-php-library)

[![Latest Stable Version](https://camo.githubusercontent.com/20058708a4328b636349c17fcdb136969b27bddaa79cca264af0dff06b6ae951/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a65726f656e6465736c6f6f766572652f76636172642e737667)](https://packagist.org/packages/jeroendesloovere/vcard)[![License](https://camo.githubusercontent.com/5a911ddcd16b9110e7821386ffd8d637005a8b856c14a3c0861b955e91da4eba/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d6c69676874677265792e737667)](https://github.com/jeroendesloovere/vcard/blob/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/1178db36136cd9552dd3fdebc7a7308e60d17979d1ef2f777965d660fa8b2be7/68747470733a2f2f7472617669732d63692e6f72672f6a65726f656e6465736c6f6f766572652f76636172642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jeroendesloovere/vcard)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/3d692dd2d296ccc8199430a8fc6573b592f99853ac495ac2590381ebfe13ff1b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a65726f656e6465736c6f6f766572652f76636172642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jeroendesloovere/vcard/?branch=master)

This VCard PHP library can generate a vCard with some data. When using an iOS device &lt; iOS 8 it will export as a .ics file because iOS devices don't support the default .vcf files.

**NOTE**: We are working on a complete new version to work with vCard version 4.0, with extreme good code quality. [Check out the new version](https://github.com/jeroendesloovere/vcard/tree/2.0.0-dev)

Usage
-----

[](#usage)

### Installation

[](#installation)

```
composer require jeroendesloovere/vcard
```

> This will install the latest version of vcard with [Composer](https://getcomposer.org)

### Example

[](#example)

```
use JeroenDesloovere\VCard\VCard;

// define vcard
$vcard = new VCard();

// define variables
$lastname = 'Desloovere';
$firstname = 'Jeroen';
$additional = '';
$prefix = '';
$suffix = '';

// add personal data
$vcard->addName($lastname, $firstname, $additional, $prefix, $suffix);

// add work data
$vcard->addCompany('Siesqo');
$vcard->addJobtitle('Web Developer');
$vcard->addRole('Data Protection Officer');
$vcard->addEmail('info@jeroendesloovere.be');
$vcard->addPhoneNumber(1234121212, 'PREF;WORK');
$vcard->addPhoneNumber(123456789, 'WORK');
$vcard->addAddress(null, null, 'street', 'worktown', null, 'workpostcode', 'Belgium');
$vcard->addLabel('street, worktown, workpostcode Belgium');
$vcard->addURL('http://www.jeroendesloovere.be');

$vcard->addPhoto(__DIR__ . '/landscape.jpeg');

// return vcard as a string
//return $vcard->getOutput();

// return vcard as a download
return $vcard->download();

// save vcard on disk
//$vcard->setSavePath('/path/to/directory');
//$vcard->save();
```

> [View all examples](/examples/example.php) or check [the VCard class](/src/VCard.php).

### Parsing examples

[](#parsing-examples)

The parser can either get passed a VCard string, like so:

```
// load VCardParser classes
use JeroenDesloovere\VCard\VCardParser;

$parser = new VCardParser($vcardString);
echo $parser->getCardAtIndex(0)->fullname; // Prints the full name.
```

Or by using a factory method with a file name:

```
$parser = VCardParser::parseFromFile('path/to/file.vcf');
echo $parser->getCardAtIndex(0)->fullname; // Prints the full name.
```

> [View the parsing example](/examples/example_parsing.php) or check the [the VCardParser class](/src/VCardParser.php) class.

**Support for frameworks**

I've created a Symfony Bundle: [VCard Bundle](https://github.com/jeroendesloovere/vcard-bundle)

Usage in for example: Laravel

```
return Response::make(
    $this->vcard->getOutput(),
    200,
    $this->vcard->getHeaders(true)
);
```

Documentation
-------------

[](#documentation)

The class is well documented inline. If you use a decent IDE you'll see that each method is documented with PHPDoc.

Contributing
------------

[](#contributing)

Contributions are **welcome** and will be fully **credited**.

### Pull Requests

[](#pull-requests)

> To add or update code

- **Coding Syntax** - Please keep the code syntax consistent with the rest of the package.
- **Add unit tests!** - Your patch won't be accepted if it doesn't have tests.
- **Document any change in behavior** - Make sure the README and any other relevant documentation are kept up-to-date.
- **Consider our release cycle** - We try to follow [semver](http://semver.org/). Randomly breaking public APIs is not an option.
- **Create topic branches** - Don't ask us to pull from your master branch.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.

### Issues

[](#issues)

> For bug reporting or code discussions.

More info on how to work with GitHub on help.github.com.

Credits
-------

[](#credits)

- [Jeroen Desloovere](https://github.com/jeroendesloovere)
- [All Contributors](https://github.com/jeroendesloovere/vcard/contributors)

License
-------

[](#license)

The module is licensed under [MIT](./LICENSE.md). In short, this license allows you to do everything as long as the copyright statement stays present.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 78% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~102 days

Recently: every ~331 days

Total

28

Last Release

1656d ago

Major Versions

1.7.2 → 2.0.02021-10-27

PHP version history (2 changes)1.1.0PHP &gt;=5.3.3

2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f9ebdaae2204a36dda75aa9ef0573dbba2e06f912a04a088c0b703a16a307616?d=identicon)[Tomsgu](/maintainers/Tomsgu)

---

Top Contributors

[![jeroendesloovere](https://avatars.githubusercontent.com/u/588616?v=4)](https://github.com/jeroendesloovere "jeroendesloovere (192 commits)")[![wadmiraal](https://avatars.githubusercontent.com/u/745643?v=4)](https://github.com/wadmiraal "wadmiraal (13 commits)")[![Synchro](https://avatars.githubusercontent.com/u/81561?v=4)](https://github.com/Synchro "Synchro (7 commits)")[![h44z](https://avatars.githubusercontent.com/u/1370804?v=4)](https://github.com/h44z "h44z (5 commits)")[![Tomsgu](https://avatars.githubusercontent.com/u/2694769?v=4)](https://github.com/Tomsgu "Tomsgu (5 commits)")[![Lidbetter](https://avatars.githubusercontent.com/u/6525616?v=4)](https://github.com/Lidbetter "Lidbetter (3 commits)")[![therouv](https://avatars.githubusercontent.com/u/393419?v=4)](https://github.com/therouv "therouv (3 commits)")[![Jako](https://avatars.githubusercontent.com/u/148371?v=4)](https://github.com/Jako "Jako (2 commits)")[![christianruhstaller](https://avatars.githubusercontent.com/u/13237645?v=4)](https://github.com/christianruhstaller "christianruhstaller (2 commits)")[![mgrundkoetter](https://avatars.githubusercontent.com/u/1526725?v=4)](https://github.com/mgrundkoetter "mgrundkoetter (2 commits)")[![claudusd](https://avatars.githubusercontent.com/u/3321326?v=4)](https://github.com/claudusd "claudusd (2 commits)")[![Stadly](https://avatars.githubusercontent.com/u/7263579?v=4)](https://github.com/Stadly "Stadly (2 commits)")[![yuks](https://avatars.githubusercontent.com/u/2283558?v=4)](https://github.com/yuks "yuks (1 commits)")[![ch-feedbackpeople](https://avatars.githubusercontent.com/u/40589559?v=4)](https://github.com/ch-feedbackpeople "ch-feedbackpeople (1 commits)")[![fetchandadd](https://avatars.githubusercontent.com/u/15845152?v=4)](https://github.com/fetchandadd "fetchandadd (1 commits)")[![joshk](https://avatars.githubusercontent.com/u/8701?v=4)](https://github.com/joshk "joshk (1 commits)")[![muhammetus](https://avatars.githubusercontent.com/u/5948976?v=4)](https://github.com/muhammetus "muhammetus (1 commits)")[![sajjadrad](https://avatars.githubusercontent.com/u/1608837?v=4)](https://github.com/sajjadrad "sajjadrad (1 commits)")[![SimonHeimberg](https://avatars.githubusercontent.com/u/16302148?v=4)](https://github.com/SimonHeimberg "SimonHeimberg (1 commits)")[![bartgloudemans](https://avatars.githubusercontent.com/u/411451?v=4)](https://github.com/bartgloudemans "bartgloudemans (1 commits)")

---

Tags

phpgeneratorvCardvcf

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tomsgu-vcard/health.svg)

```
[![Health](https://phpackages.com/badges/tomsgu-vcard/health.svg)](https://phpackages.com/packages/tomsgu-vcard)
```

###  Alternatives

[jeroendesloovere/vcard

This VCard PHP class can generate a vCard with some data. When using an iOS device it will export as a .ics file because iOS devices don't support the default .vcf files.

5193.6M12](/packages/jeroendesloovere-vcard)[jeroendesloovere/vcard-bundle

This Symfony 2 bundle can generate vCards with lots of data. When using an &lt; iOS 7 device it will export as a .ics file because iOS devices don't support the default .vcf files.

1677.3k3](/packages/jeroendesloovere-vcard-bundle)[tomloprod/radiance

A deterministic mesh gradient avatar generator for PHP.

1393.7k](/packages/tomloprod-radiance)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
