Korin API

Gedcom
in package

FinalYes

Entry point for common tasks; the classes behind it can be injected directly.

Table of Contents

Methods

convert()  : ConversionResult
Converts the document to another version; the document is not changed.
convertFile()  : LossReport
Converts a file of any size record by record, writing the output as it goes: the same bytes and losses as {@see self::convert()} of the whole document, in memory that holds an index of the input rather than its tree.
open()  : IndexedDocument
Opens a file for reading without its tree in memory: an index of the records, which are read from the file when asked for. A resource that cannot seek is copied to php://temp first (in memory up to 2 MB, then in a temporary file). A zip:// path is not copied: the entry is read forward and opened again to go back, which decompresses it from the start; read its records in order (as {@see self::convertFile()} does), not at random.
parse()  : Document
read()  : Document
readGedzip()  : Archive
Reads a GEDZIP archive (.gdz): gedcom.ged as a document, the media as streams on demand.
serialize()  : string
stream()  : RecordStream
Reads a file one record at a time, in memory that does not grow with the file.
validate()  : ValidationReport
Checks the document against the profile of its version; the document is not changed. An indexed file ({@see self::open()}) is checked record by record, without its tree in memory.
write()  : void
writeGedzip()  : void
Writes a GEDZIP archive: a 7.0 document as gedcom.ged, and the media under the names its FILE references use. Needs ext-zip.

Methods

convertFile()

Converts a file of any size record by record, writing the output as it goes: the same bytes and losses as {@see self::convert()} of the whole document, in memory that holds an index of the input rather than its tree.

public static convertFile(string|resource $input, string|resource $output, Version $to[, ConvertOptions $options = new ConvertOptions() ][, ReadOptions $read = new ReadOptions() ]) : LossReport
Parameters
$input : string|resource

a path, or an open handle read from its current position (not closed)

$output : string|resource

a path, or an open handle written from its current position (not closed)

$to : Version
$options : ConvertOptions = new ConvertOptions()
$read : ReadOptions = new ReadOptions()
Tags
throws
ConversionException

when the conversion is not supported, or at a loss under LossPolicy::Fail

Return values
LossReport

open()

Opens a file for reading without its tree in memory: an index of the records, which are read from the file when asked for. A resource that cannot seek is copied to php://temp first (in memory up to 2 MB, then in a temporary file). A zip:// path is not copied: the entry is read forward and opened again to go back, which decompresses it from the start; read its records in order (as {@see self::convertFile()} does), not at random.

public static open(string|resource $source[, ReadOptions $options = new ReadOptions() ]) : IndexedDocument
Parameters
$source : string|resource

a path, or an open handle read from its current position (not closed)

$options : ReadOptions = new ReadOptions()
Tags
throws
ParseException

when a line exceeds the limits of the options (length, nesting), or at an error in strict mode

Return values
IndexedDocument

stream()

Reads a file one record at a time, in memory that does not grow with the file.

public static stream(string|resource $source[, ReadOptions $options = new ReadOptions() ]) : RecordStream
Parameters
$source : string|resource

a path, or an open handle read from its current position (not closed)

$options : ReadOptions = new ReadOptions()
Tags
throws
ParseException

when a line exceeds the limits of the options (length, nesting), or at an error in strict mode

Return values
RecordStream

writeGedzip()

Writes a GEDZIP archive: a 7.0 document as gedcom.ged, and the media under the names its FILE references use. Needs ext-zip.

public static writeGedzip(Document $document, string $path[, array<string|int, string|resource> $media = [] ][, WriteOptions $options = new WriteOptions() ]) : void
Parameters
$document : Document
$path : string
$media : array<string|int, string|resource> = []

entry name => a file to add, or a stream

$options : WriteOptions = new WriteOptions()
Tags
throws
GedzipException
On this page

Search results