PHP code example of urbanmonastics / sourceparser

1. Go to this page and download the library: Download urbanmonastics/sourceparser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

urbanmonastics / sourceparser example snippets


composer 

$SourceTextParser = new /UrbanMonastics/SourceTextParser();

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

$SourceTextParser = new SourceTextParser();

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

$SourceTextParser->loadText();

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

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

$SourceTextParser->setLiturgicalElements( true );
echo $SourceTextParser->text("God, [+] come to my assistance,[*]");
// prints: <p>God, <span class="symbol-cross">✛</span> come to my assistance,<span class="symbol-star">*</span></p>

$SourceTextParser->setLiturgicalHTML( false );	# The default value is True, so you can manually disable wrapping liturgical elements.
echo $SourceTextParser->text("God, [+] come to my assistance,[*]");
// prints: <p>God, ✛ come to my assistance,*</p>