Koinos: PHP Library for working with References and Greek
Posted: December 17th, 2014, 3:38 pm
Here's a PHP library (also composer package and Symfony Bundle, though can be used by itself).
It's good at matching, manipulating and DB querying for complex biblical references, and at manipulating Unicode Greek text.
https://github.com/eukras/koinos
This is MIT licensed, so feel free to fork and mod. There is a large Unit Test suite, so you'll know immediately if you've broken anything.
INTRO
Libraries are defined in CSV files (Resources/libraries/nt/books.csv, and easy to add more):
To query that book:
It can match references in texts and turn them into links, or can identify if they exist in parallels (pipe-separated).
Internally, references are arrays of ranges [start, finish], each value being a quadruple of [bookId, sectionNum, chapterNum, verseNum]. These map to INT(12)s for efficient SQL querying:
The Greek utility provides a bundle of useful tools, incl. some for scanning texts, and can romanize any word in the Perseus dataset:
Plenty more info in the README.md, code doc and Test suites...
It's good at matching, manipulating and DB querying for complex biblical references, and at manipulating Unicode Greek text.
https://github.com/eukras/koinos
This is MIT licensed, so feel free to fork and mod. There is a large Unit Test suite, so you'll know immediately if you've broken anything.
INTRO
Libraries are defined in CSV files (Resources/libraries/nt/books.csv, and easy to add more):
Code: Select all
107,NT,1 Corinthians,1 Cor,1cor,2,1co,16
Code: Select all
use Koinos\Bundle\KoinosBundle\Service\ReferenceManager;
$rm = new ReferenceManager($libraries=['nt', 'lxx']);
$ref1 = $rm->createReferenceFromQuery('1 Cor 16:1-5,8,10-12,13-14');
echo $rm->getTitle($ref1); // 1 Corinthians 16:1-5,8,10-14 -- note merged ranges
Internally, references are arrays of ranges [start, finish], each value being a quadruple of [bookId, sectionNum, chapterNum, verseNum]. These map to INT(12)s for efficient SQL querying:
Code: Select all
echo $ref1->getSqlClause($columnName='reference');
// (reference BETWEEN 107001016001 AND 107001016005) OR
// (reference BETWEEN 107001016008 AND 107001016008) OR
// (reference BETWEEN 107001016010 AND 107001016014)
Code: Select all
use Koinos\Bundle\KoinosBundle\Utility\Greek;
$g = new Greek;
echo $g->romanize('Ῥύγχος'); // Rhunchos
echo $g->romanize('Ἡσυχάζω'); // Hēsuchazō
echo $g->romanize('Αὑτοῖσι'); // Hautoisi
Plenty more info in the README.md, code doc and Test suites...