PHPackages                             stevenbuehner/bible-verse-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. stevenbuehner/bible-verse-bundle

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

stevenbuehner/bible-verse-bundle
================================

A highly tested library to parse, identify, merge store and work with bibleverses.

2.6.0(3y ago)1101[1 issues](https://github.com/stevenbuehner/BibleVerseBundle/issues)[1 PRs](https://github.com/stevenbuehner/BibleVerseBundle/pulls)MITPHPPHP &gt;7.0CI failing

Since Aug 20Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/stevenbuehner/BibleVerseBundle)[ Packagist](https://packagist.org/packages/stevenbuehner/bible-verse-bundle)[ Docs](https://github.com/stevenbuehner/BibleVerseBundle)[ RSS](/packages/stevenbuehner-bible-verse-bundle/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (4)Versions (46)Used By (0)

What is it?
===========

[](#what-is-it)

With this bundle you get an incredible powerful backend to parse any text and identify bible verses within it. It works with symphony but also with any other composer system. The bible verses are not only recognized, but intelligently seperated into book, chapter and vers-ranges.

I am using it in a big installation to store and index bible verses in the database and perform very quick and complex searches.

Features
========

[](#features)

The library recognizes all kind of different texts as bible verses in german and in english. For example:

- 1Tim 3,16
- 1 Tim 3,16f (one following verse)
- 1 Tim 3,15-16 (multiple verses as range joined by "-")
- 1 Tim 3,16ff (following verses with "ff" until to the chapters end)
- 1 Timotheus 3,16 (long naming convention)
- 1 Tim 3,15.16 (multiple verses joined with ".")
- 1 Tim 3,15+16 (multiple verses joined with "+")
- 1\. Timothy 3,16 (preceding "1." convention)
- I Timothy 3,16 (preceding "I" convention / with or without ".")
- First Timothy 3,16 (preceding "First" convention)
- 1st Timothy 3,16 (preceding "1st" convention)
- 1.Timotheusbrief 3,16 (german long naming convention)
- 1 Ti 3,16 (different short naming conventions)
- 1Tim 3,16-4,2 (ranges over multiple chapters)
- 1Tim 3 (whole Chapter)

Examples
========

[](#examples)

The texts are recognized and parsed into valid integers. For 1Tim 3,16-17 this would be:

Parsed-TextBook-IdFrom ChapterFrom VerseTo ChapterTo Verse1Tim 3,15-16543153161Tim 3,15f543153161Tim 3,16-4,254316421Tim 354313161Tim 3-45431416Storage and search optimization
===============================

[](#storage-and-search-optimization)

Internally the bible verses are stored as two numbers which describe a range (start - end). This makes it possible so index bible verses and search for intersecting bible verses super quickly.

START and END are set together as three-digit codes:

Book-IDChapter-NumberVerse-Number(three digits, zero padded)(three digits, zero padded)(three digits, zero padded)Which results in this indexing:

Parsed-TextBook-IdFrom ChapterFrom VerseTo ChapterTo Verse**START****END**1Tim 3,15-1654315316**054003015****054003016**1Tim 3,15f54315316**054003015****054003016**1Tim 3,16-4,25431642**054003016****054004002**1Tim 35431316**054003001****054003016**1Tim 3-45431416**054003001****054004016**Usage
=====

[](#usage)

Parsing text to BibleVerses Entities
------------------------------------

[](#parsing-text-to-bibleverses-entities)

```
$service = new BibleVerseService();
$found = $service->stringToBibleVerse('1Tim 3,16');
```

Formatting BibleVerses Entities as Text
---------------------------------------

[](#formatting-bibleverses-entities-as-text)

Language German and English are supported by default

```
foreach($found as $bibleverse){
	// long labels
	echo $service->bibleVerseToString($bibleverse);

	// or short labels
	echo $service->bibleVerseToString($bibleverse, 'short');
}
```

Extracting bible verses as BibleVerse entities from larger texts
----------------------------------------------------------------

[](#extracting-bible-verses-as-bibleverse-entities-from-larger-texts)

```
$found = $service->stringToBibleVerse('Hello. I learned from 2Tim 3,16 that it differs from Gen 1,1');
// --> $found will be an array with two recognized bibleverses

$rest = $service->getLastRestString();
// --> $rest will be the remaining string, without the found bibleverses = "Hello. I learned from that it differs from "
```

Join multiple BibleVerse Entities together
------------------------------------------

[](#join-multiple-bibleverse-entities-together)

```
// Join biblevereses
$found = $service->stringToBibleVerse('Hello. I learned from 2Tim 3,16 that it differs from 2Tim 3,17');
// --> $found will be an array with two recognized bibleverses
$merged = $service->mergeBibleverses($found);
// --> $merged will be an array with ONE bibleverse. Both verses where merged into 2Tim 3,16-17
```

Accessing BibleVerse start and end number
-----------------------------------------

[](#accessing-bibleverse-start-and-end-number)

```
	/**
	 * @return int
	 */
	public function getStart() {
		return $this->start;
	}

	/**
	 * @return int
	 */
	public function getEnd() {
		return $this->end;
	}
```

BibleVerse Interface
--------------------

[](#bibleverse-interface)

Bible verses are valid `BibleVerseInterface` instances. Which means they can be extended and come with these default functions

```
	/**
	 * Set From and To bookId
	 * @param integer $bookId
	 */
	public function setBookId($bookId);

	/**
	 * Get bookId
	 * @return int
	 */
	public function getFromBookId();

	/**
	 * Get bookId
	 * @return int
	 */
	public function getToBookId();

	/**
	 * Set $fromBookId
	 * @param integer $fromBookId
	 */
	public function setFromBookId($fromBookId);

	/**
	 * Set $toBookId
	 * @param integer $toBookId
	 */
	public function setToBookId($toBookId);

	/**
	 * Set fromChapter
	 * @param integer $fromChapter
	 */
	public function setFromChapter($fromChapter);

	/**
	 * Get fromChapter
	 * @return int
	 */
	public function getFromChapter();

	/**
	 * Set toChapter
	 * @param integer $toChapter
	 */
	public function setToChapter($toChapter);

	/**
	 * Get toChapter
	 * @return int
	 */
	public function getToChapter();

	/**
	 * Set fromVerse
	 * @param integer $fromVerse
	 */
	public function setFromVerse($fromVerse);

	/**
	 * Get fromVerse
	 * @return int
	 */
	public function getFromVerse();

	/**
	 * Set toVerse
	 *
	 * @param integer $toVerse
	 */
	public function setToVerse($toVerse);

	/**
	 * Get toVerse
	 *
	 * @return int
	 */
	public function getToVerse();

	/**
	 * @param int      $bookId
	 * @param int      $fromChapter
	 * @param int      $fromVerse
	 * @param int|NULL $toChapter
	 * @param int|NULL $toVerse
	 */
	public function setVerse($bookId, $fromChapter, $fromVerse, $toChapter = NULL, $toVerse = NULL);
```

JavaScript
==========

[](#javascript)

There is also a JavaScript library for parsing bible verses and use it i.e. for markdown purposes.

Generating Javascript-Library-Updates
-------------------------------------

[](#generating-javascript-library-updates)

The JavaScript library is generated with the command:

```
php ./js/Generator/cmd.php
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~57 days

Recently: every ~288 days

Total

43

Last Release

1209d ago

Major Versions

0.1.2 → 1.0.02016-08-27

1.3.0 → 2.02017-04-18

PHP version history (3 changes)0.1.2PHP &gt;5.4

1.0.0PHP &gt;5.3

2.6.0PHP &gt;7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/539fb0fe02d3a484cebe51f48a1d52a206d2d0267609737331c1742d2e9e5b61?d=identicon)[stevenbuehner](/maintainers/stevenbuehner)

---

Top Contributors

[![stevenbuehner](https://avatars.githubusercontent.com/u/1318984?v=4)](https://github.com/stevenbuehner "stevenbuehner (133 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stevenbuehner-bible-verse-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/stevenbuehner-bible-verse-bundle/health.svg)](https://phpackages.com/packages/stevenbuehner-bible-verse-bundle)
```

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19037.7M41](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9642.0k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

46143.1k6](/packages/jstewmc-rtf)[moonshine/layouts-field

Field for repeating groups of fields for MoonShine

107.9k](/packages/moonshine-layouts-field)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

112.9k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
