Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.php_cs
tmp/*
vendor/*
.idea/*
tmp/*

18 changes: 18 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/src');

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'heredoc_to_nowdoc' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'phpdoc_add_missing_param_annotation' => true,
'psr4' => true,
])
->setFinder($finder);
19 changes: 4 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
language: php

php:
- 5.6
- 5.5
- 5.4
- 7
- hhvm
- hhvm-nightly

matrix:
fast_finish: true
allow_failures:
- php: 7
- php: hhvm
- php: hhvm-nightly
- 7.1

before_script:
- composer install --prefer-dist --dev
- composer install --prefer-dist

script:
- vendor/bin/phpunit -c tests/phpunit.xml tests/
- vendor/bin/phpcs --standard=PSR2 -n library/ tests/
- composer check-style
- composer test
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contributing

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

We accept contributions via Pull Requests on
[Github](https://github.com/mrkrstphr/php-gedcom).


## Pull Requests

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** -
Check the code style with ``$ composer check-style`` and fix it with ``$ composer fix-style``.

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept
up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs
is not an option.

- **Create feature 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](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before
submitting.

**Happy coding**!
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright (c) 2010-2017 Kristopher Wilson <[email protected]>

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
58 changes: 18 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,34 @@
# 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=2.0-dev)](https://travis-ci.org/mrkrstphr/php-gedcom)

[![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).
php-gedcom helps parse GEDCOM data files in PHP. It's purpose is to provide a mechanism
for converting GEDCOM files into other formats, or loading them into a database.

## 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.*"
}
}
```bash
composer install mrkrstphr/php-gedcom
```

### Download and __autoload
## Usage

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:
TODO

```php
spl_autoload_register(function ($class) {
$pathToPhpGedcom = __DIR__ . '/library/'; // TODO FIXME
## Tests

if (!substr(ltrim($class, '\\'), 0, 7) == 'PhpGedcom\\') {
return;
}
To run the tests:

$class = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
if (file_exists($pathToPhpGedcom . $class)) {
require_once($pathToPhpGedcom . $class);
}
});
```bash
composer test
```

### Usage
To check code style:

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:
```bash
composer check-style
```

```php
$parser = new \PhpGedcom\Parser();
$gedcom = $parser->parse('tmp\gedcom.ged');
## Contributing

foreach ($gedcom->getIndi() as $individual) {
echo $individual->getId() . ': ' . current($individual->getName())->getSurn() .
', ' . current($indi->$individual())->getGivn();
}
```
See [CONTRIBUTING.md](CONTRIBUTING.md).
43 changes: 26 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
{
"name": "mrkrstphr/php-gedcom",
"description": "A GEDCOM file parser (read + write) for PHP 5.3+",
"type": "library",
"keywords": ["gedcom","parser"],
"homepage": "http://github.com/mrkrstphr/php-gedcom",
"license": "GPL-3.0",
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/PHPUnit": "3.7.*",
"squizlabs/php_codesniffer": "1.*"
},
"autoload": {
"psr-0": {
"PhpGedcom\\": "library/"
}
"name": "mrkrstphr/php-gedcom",
"description": "A GEDCOM file parser for PHP",
"type": "library",
"keywords": [
"gedcom",
"parser"
],
"homepage": "http://github.com/mrkrstphr/php-gedcom",
"license": "MIT",
"require": {
"php": ">=7.0, <=8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.3",
"peridot-php/leo": "^1.6",
"peridot-php/peridot": "^1.19"
},
"autoload": {
"psr-4": {
"PhpGedcom\\": "src/"
}
},
"scripts": {
"check-style": "vendor/bin/php-cs-fixer fix --dry-run --verbose --ansi",
"fix-style": "vendor/bin/php-cs-fixer fix",
"test": "vendor/bin/peridot --force-colors"
}
}
Loading