Download the PHP package ichthus-soft/bible_ref without Composer
On this page you can find all versions of the php package ichthus-soft/bible_ref. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package bible_ref
Bible_ref
About the project
Bible_ref is a composer package that transforms real text references into PHP an PHP array for better handling in MySQL queries or stuff like that.
Installation
It is recommended that you install this package through Composer. Create a file name in your working directory and paste the following in it:
And after that run .
Or if you already have an file in your project, add the above code and run .
After this, you can use the package like this:
Manual installation
Clone this repository and include src/BibleRef/Utils.php
and src/BibleRef/Reference.php
in your PHP file!
Query syntax
So, to summarize:
- The format is BookName chapter:verse[-endVerse] (Genesis 1:1[-10])
- To add another chapter, concatenate with & (Genesis 1:1&2:1)
- To add another book, concatenate with ; (that's a semi-colon) (Genesis 1:1;Acts 1:1)
Version 2 (current)
Version 2 is the new recommended version to be used. The returned output is sligtly different than the old version.
Warning: this version gives the output in the order you request it (the old version gave you the verses in ascending order. If you request first the chapter 2 verse 4 and after verse 2, the first element in the array will be verse 4 because it was first requested!
Example of the output structure:
Example:
Real life usage:
This package was made for the ichthus-soft/bible-api package, so let me give you an example of how we use this package there (contains parts in Romanian). You can also see this code directly on the GitHub repository by clicking here!
Version 1 (old)
This version should not be used.
Be careful!
If you add multiple chapters, the return value will be default empty and the return value will be an array of chapters with the verses associated.
In order to get the verses in the return value you have to init the Reference class with the second parameter set to :
And basically the key of the returned array will be a clone of the key (an associative array with chapterNumber => array() of verses!
Examples
More advanced example
returns this