Download the PHP package jaredhowland/contacts without Composer
On this page you can find all versions of the php package jaredhowland/contacts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jaredhowland/contacts
More information about jaredhowland/contacts
Files in jaredhowland/contacts
Package contacts
Short Description PHP library to create files to store contact information
License MIT
Homepage http://github.com/jaredhowland/contacts
Informations about the package contacts
Contacts
Contacts is a small PHP library to create files containing address book information for people or organizations. Currently, vCard 3.0 is the only supported export format.
Features
- vCard 3.0 Compatibility:
- Generates vCards that should be compatible with all applications that use vCards
- Includes fields that are unique to the iOS and macOS contacts application (
Supervisor
,Anniversary
,Spouse
,Child
) - Flexible: future implementations will include other formats commonly used to store contact information—other vCard formats, microformats, Google contacts format,
.csv
format, etc. - Method chaining for constructing contact information in a fluid interface
- The method argument order typically comes directly from the standard itself
Installation
Contacts is available as a Composer package:
- If needed, install Composer
- Add the following to your
composer.json
file
"require": {
"jaredhowland/contacts": "~6.0"
}
Usage
Input
This is an extensive example. The code is well documented and you should get all the hints needed for using it in an IDE. Most of the time, you will only need a fraction of these fields to create a vCard:
Or you can chain methods together to build the vCard:
Output
BEGIN:VCARD
VERSION:3.0
FN:Jane Doe
N:Doe;Jane;;;
NICKNAME:Janie,Jan
PHOTO;ENCODING=b;TYPE=JPEG:/9j/4QBwRXhpZgAASUkqAAgAAAABAJiCAgBLAAAAGgAAAA
AAAABDb3B5cmlnaHQgQllVIFB …rest of binary-encoded photo
BDAY;X-APPLE-OMIT-YEAR=1604:1604-02-10
ADR;TYPE=dom,postal,parcel,work:;;123 Main;Provo;UT;84602;United States
ADR;TYPE=dom,postal,parcel,home:;;123 Main;Provo;UT;84602;United States
LABEL;TYPE=dom,parcel:Jane Doe\n123 Main St\nProvo\, UT 84602
TEL;TYPE=cell,iphone:(555) 555-5555
EMAIL;TYPE=internet:[email protected]
TZ:-07:00
GEO:40.333333;-111.777778
TITLE:System Administrator
ROLE:Programmer
ORG:Awesome Company
CATEGORIES:School,Work
NOTE:Not much is known about Jane Doe.
SORT-STRING:Doe
URL:https://www.example.com
item1.X-ABDATE;type=pref:2010-10-10
item1.X-ABLabel:_$!<Anniversary>!$_
item2.X-ABRELATEDNAMES:Jane Smith
item2.X-ABLabel:_$!<Manager>!$_
item3.X-ABRELATEDNAMES:John Doe
item3.X-ABLabel:_$!<Spouse>!$_
item4.X-ABRELATEDNAMES:Jeff Doe
item4.X-ABLabel:_$!<Child>!$_
item5.X-ABRELATEDNAMES:Lisa Doe
item5.X-ABLabel:_$!<Child>!$_
X-TWITTER:@jared_howland
UID:5a32a74023b097.12918287
REV:2023-09-05T00:00:00Z
END:VCARD
Options
Available options and defaults in the Options
class:
setDataDirectory
:./data/
setDefaultAreaCode
:null
setFormatUsTelephone
:true
With appropriate getters:
getDataDirectory()
getDefaultAreaCode()
isFormatUsTelephone()
Contribute
- Issue Tracker: https://github.com/jaredhowland/contacts/issues
- Source Code: https://github.com/jaredhowland/contacts
- Code of conduct: https://github.com/jaredhowland/contacts/blob/master/CODE_OF_CONDUCT.md
Known Issues
- Date-time values not supported for
BDAY
field (only date values). No plans to implement. - Text values not supported for
TZ
field (only UTC-offset values). No plans to implement. - The following vCard elements are not currently supported (no plans to implement):
AGENT
SOUND
KEY
Inspired by https://github.com/jeroendesloovere/vcard