Skip to content

Latest commit

 

History

History
54 lines (33 loc) · 1.86 KB

README.md

File metadata and controls

54 lines (33 loc) · 1.86 KB

Source Texts Library in PHP

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();