urbanmonastics/sourcetextlibrary

A simple way to load, read, and present texts from various source text libraries.

dev-release 2022-01-31 19:37 UTC

This package is auto-updated.

Last update: 2024-11-05 22:02:16 UTC


README

Build Status Total Downloads Version License

A simple way to load, read, and present texts from various Source Text libraries.

This is a companion library to the Source Text Parser library.

Features

  • Quickly load one or many source text libraries
  • Navigate to desired texts or segments and render them for display.

Adding to your Project

Install the composer package:

composer require UrbanMonastics/SourceTextLibrary

Example Usage

In the most simple approach you can pass text to be parsed.

$SourceTextLibrary = new /UrbanMonastics/SourceTextLibrary();

echo $SourceTextLibrary->text("Hello *Source Parser*!");  # prints: <p>Hello <em>Source Parser</em>!</p>

You can also take advantage of the structure of the source texts.

$SourceTextLibrary = new SourceTextLibrary();

// Load the source data into the parser
$Source = json_decode( file_get_contents('path/to/source.json'), true );
$SourceTextLibrary->loadSource( $Source );

$SourceTextLibrary->loadText();

echo $SourceTextLibrary->text("Hello *Source Parser*!");  # prints: <p>Hello <em>Source Parser</em>!</p>

// Clear the loaded Source and Texts - without altering other options
$SourceTextLibrary->clearSource();