Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrkrstphr/php-gedcom
UNMAINTAINED - A library for reading and writing GEDCOM files in PHP.
https://github.com/mrkrstphr/php-gedcom
Last synced: 3 months ago
JSON representation
UNMAINTAINED - A library for reading and writing GEDCOM files in PHP.
- Host: GitHub
- URL: https://github.com/mrkrstphr/php-gedcom
- Owner: mrkrstphr
- License: mit
- Created: 2013-01-28T00:28:42.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T11:39:36.000Z (almost 2 years ago)
- Last Synced: 2024-07-30T15:47:47.265Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 1.13 MB
- Stars: 38
- Watchers: 12
- Forks: 46
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-gedcom - php-gedcom - A library for reading and writing GEDCOM files in PHP (Parsers / PHP)
README
# php-gedcom
## This project is no longer actively maintained. I may pick it back up in the future, but right now I have no need.
[![Build Status](https://secure.travis-ci.org/mrkrstphr/php-gedcom.png?branch=master)](https://travis-ci.org/mrkrstphr/php-gedcom)
## Requirements
* php-gedcom 1.0+ requires PHP 5.3 (or later).
## Installation
There are two ways of installing php-gedcom.
### Composer
To install php-gedcom in your project using composer, simply add the following require line to your project's `composer.json` file:
{
"require": {
"mrkrstphr/php-gedcom": "1.0.*"
}
}### Download and __autoload
If you are not using composer, you can download an archive of the source from GitHub and extract it into your project. You'll need to setup an autoloader for the files, unless you go through the painstaking process if requiring all the needed files one-by-one. Something like the following should suffice:
```php
spl_autoload_register(function ($class) {
$pathToPhpGedcom = __DIR__ . '/library/'; // TODO FIXMEif (!substr(ltrim($class, '\\'), 0, 7) == 'PhpGedcom\\') {
return;
}$class = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
if (file_exists($pathToPhpGedcom . $class)) {
require_once($pathToPhpGedcom . $class);
}
});
```### Usage
To parse a GEDCOM file and load it into a collection of PHP Objects, simply instantiate a new Parser object and pass it the file name to parse. The resulting Gedcom object will contain all the information stored within the supplied GEDCOM file:
```php
$parser = new \PhpGedcom\Parser();
$gedcom = $parser->parse('tmp\gedcom.ged');foreach ($gedcom->getIndi() as $individual) {
echo $individual->getId() . ': ' . current($individual->getName())->getSurn() .
', ' . current($indi->$individual())->getGivn();
}
```