Download the PHP package pleb/vcardio without Composer
On this page you can find all versions of the php package pleb/vcardio. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package vcardio
Short Description Parse vCards from files (.vcf) or raw data. Build vCards from scratch. Export vCards as string or file.
License MIT
Homepage https://github.com/PierreLebedel/vCardIO
Informations about the package vcardio
vCardIO - Parse, read, manipulate & write vCard (.vcf files)
This package based on RFC 6350 is intended to simplify the parsing and the manipulation of vCard objects, coming from .vcf files or from raw data. It allows you to build vCard objects & export them to text or .vcf files.
Installation
Via composer:
Documentation
- Parsing data
- vCards collection
- vCard builder
- vCard object
- Exporting files
Usage
Parsing data
You can parse vCards objects from .vcf file or from raw data, and obtain an iterable collection of vCards.
The vCards collection
The result of parsing is a collection of vCards:
Manually build a vCards collection
Manipulate collection
The VCardsCollection
object implements ArrayAccess
, Iterator
and Countable
interfaces, so you can loop on it.
The vCard object
A huge set of methods is implemented to read the vCard properties. You can see all available getters methods on the vCard object documentation.
Note on "Pseudo-singular" properties
RFC 6350 allows most of properties to be present multiple times in a vCard. For example the FN
(fullName) property can be present 1 or multiple times, and accompagnied by attributes to distinct them.
In this package, we assume that some of properties (like fullName) got a unique main value. The vCard's getProperty()
methods will return this main value, as well as the sub-object $vCard->relevantData
.
The complete set of value is stil available in the root of $vCard
object.
Note on the old school AGENT
property
The AGENT
property is not longer supported by the vCard specification, but if you parse old data, you can see something like this, with nested vCards:
This package will parse it as a VCard's agent
property:
The vCard builder
You can create your vCard objects from scratch fluently by using the large set of methods implemented on the vCard builder. You can see all available setters methods on the vCard builder documentation.
Each method returns the builder instance, so you can chain them.
Use the get()
method to get your vCard.
Print vCards
Print a single vCard
You can use (string) $vCard
to display vCard contents:
Print vCards collection
The same is true for vCards collections, what will display the vCards serially:
Export vCards
Export a single vCard
The existing .vcf file will be overwritten.
Export vCards collection
The existing .vcf can be overwritten or appended.
Contribute
Code formatting
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.