PHPackages                             techwilk/bible-verse-parser - 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. techwilk/bible-verse-parser

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

techwilk/bible-verse-parser
===========================

Parse verse textual representation into book/chapter/verse ranges

2.8.3(1y ago)73.6k↑257.6%6[4 issues](https://github.com/TechWilk/bible-verse-parser/issues)[2 PRs](https://github.com/TechWilk/bible-verse-parser/pulls)MITPHPPHP &gt;=7.4

Since Oct 20Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/TechWilk/bible-verse-parser)[ Packagist](https://packagist.org/packages/techwilk/bible-verse-parser)[ Docs](http://github.com/techwilk/bible-verse-parser)[ RSS](/packages/techwilk-bible-verse-parser/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (2)Versions (53)Used By (0)

Bible Verse Parser [![builds.sr.ht status](https://camo.githubusercontent.com/cb0ff05b6b102d06ca18cc2e11f5b1036ed7420e914b87fc7e13b53aadcbbc80/68747470733a2f2f6275696c64732e73722e68742f7e7465636877696c6b2f6269626c652d76657273652d7061727365722f636f6d6d6974732f6d61737465722e737667)](https://builds.sr.ht/~techwilk/bible-verse-parser/commits/master?)
============================================================================================================================================================================================================================================================================================================================================================

[](#bible-verse-parser-)

[![Total Downloads](https://camo.githubusercontent.com/97c10bcb496314aa42f5c83219cd9ddb6691accfa8898ff12a750c022463be57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7465636877696c6b2f6269626c652d76657273652d7061727365722e737667)](https://packagist.org/packages/techwilk/bible-verse-parser)[![Latest Stable Version](https://camo.githubusercontent.com/fd9a4a123621d070355f5467220109fb77b064488fe5a73c0b158c1a00ea2fb4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7465636877696c6b2f6269626c652d76657273652d7061727365722e737667)](https://packagist.org/packages/techwilk/bible-verse-parser)[![License](https://camo.githubusercontent.com/9530d5a897d716708de9d85ed7ea0b8cbbdeeb43ebbaf28f34ec3d42ff2ab13d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7465636877696c6b2f6269626c652d76657273652d7061727365722e737667)](https://packagist.org/packages/techwilk/bible-verse-parser)

Parse verse textual representation into book/chapter/verse ranges

Allows you to standardise many different people's bible passage/reference formats and gain programmatic access to them.

Demo
----

[](#demo)

A demo of the library's parsing can usually be found at

The code for the demo is in `public/`.

Installation
------------

[](#installation)

1. Install through composer.

    ```
    composer require techwilk/bible-verse-parser
    ```
2. Then create a parser

    ```
    use TechWilk\BibleVerseParser\BiblePassageParser;

    $passageParser = new BiblePassageParser();
    ```

Use
---

[](#use)

Just pass in a string, and it will parse into an array of passages. Each range will be a separate object in the array.

> Shorthand book abbreviations will be converted into full book names

```
/** @var BiblePassage[] */
$passages = $passageParser->parse('1 John 5:4-17, 19-21 & Esther 2');
```

### Casting to string

[](#casting-to-string)

```
foreach ($passages as $passage) {
    echo (string) $passage . PHP_EOL;
}
```

outputs:

```
1 John 5:4-17
1 John 5:19-21
Esther 2

```

### Custom formatting

[](#custom-formatting)

Alternatively use the values yourself.

```
foreach ($passages as $passage) {
    echo "From {$passage->from()->book()->name()}";
    echo " chapter {$passage->from()->chapter()}";
    echo " verse {$passage->from()->verse()}";

    echo ", to {$passage->to()->book()->name()}";
    echo " chapter {$passage->to()->chapter()}";
    echo " verse {$passage->to()->verse()}." . PHP_EOL;
}
```

outputs:

```
From 1 John chapter 5 verse 4, to 1 John chapter 5 verse 17.
From 1 John chapter 5 verse 19, to 1 John chapter 5 verse 21.
From Esther chapter 2 verse 1, to Esther chapter 2 verse 23.

```

### Integer notation

[](#integer-notation)

Ideal for storing in a database &amp; querying with something like MySQL. The integer notation is the same as several other libraries, with book number in millions, chapter in thousands and verse as ones `(1000000 * book) + (1000 * chapter) + verse`.

```
foreach ($passages as $passage) {
    echo $passage->from()->integerNotation();
    echo ' (' . (string)$passage->from() . ')' . PHP_EOL;

    echo $passage->to()->integerNotation();
    echo ' (' . (string)$passage->to() . ')' . PHP_EOL;

    echo PHP_EOL;
}
```

outputs:

```
62005004 (1 John 5:4)
62005017 (1 John 5:17)

62005019 (1 John 5:19)
62005021 (1 John 5:21)

17002001 (Esther 2:1)
17002023 (Esther 2:23)

```

Supported formats
-----------------

[](#supported-formats)

We may add additional formats in the future (please open an issue if you use a format which isn't listed.)

### Single verse

[](#single-verse)

```
John 3:16
John 3v16
John 3vv16
John 3 v16
John 3.16
John 3 16
John c3 v16
John ch3 v16
John chapter 3 verse 16

```

### Whole chapter

[](#whole-chapter)

```
John 3

```

### Combinations of the above / multiples

[](#combinations-of-the-above--multiples)

```
John 3, 4
John 3:16-18, 19-22
Gen 1:1; 4:26
John 3:16 & Isiah 22
Is 53: 1-6 & 2 Cor 5: 20-21
Deut 6: 4-9, 16-end & Luke 15: 1-10
1 Peter 2, 5 & Job 34
1 Peter 2:15-16, 18-20
1 John 3:1-4:12

```

Roadmap
-------

[](#roadmap)

- Parse many formats into book / chapter / verse ranges
- Validate book names
- Translate abbreviated book names into full names
- Validate chapter / verse is valid in a given book
- Passages which span over chapter or book boundries
- Ability to explode verse ranges into one object per verse

Badges
------

[](#badges)

[![builds.sr.ht status](https://camo.githubusercontent.com/cb0ff05b6b102d06ca18cc2e11f5b1036ed7420e914b87fc7e13b53aadcbbc80/68747470733a2f2f6275696c64732e73722e68742f7e7465636877696c6b2f6269626c652d76657273652d7061727365722f636f6d6d6974732f6d61737465722e737667)](https://builds.sr.ht/~techwilk/bible-verse-parser/commits/master?)[![Coverage Status](https://camo.githubusercontent.com/fe77cdea18206b75ab9ba303f9dc8aaa638df57def4f718d0c04bff2d2cfad21/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f5465636857696c6b2f6269626c652d76657273652d7061727365722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/TechWilk/bible-verse-parser?branch=master)[![](https://camo.githubusercontent.com/b75f2fd7eced9ba133861f53f0e108a8dd1e2fc48a80b6070448d96b190b3c38/68747470733a2f2f7374796c6563692e696f2f7265706f732f373534383938362f736869656c64)](https://styleci.io/repos/7548986)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1f076f35c6647b87228a209fca5143834e99d73f2a89602ab81adcbee9f9ed7a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5465636857696c6b2f6269626c652d76657273652d7061727365722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/TechWilk/bible-verse-parser/?branch=master)[![Codacy Badge](https://camo.githubusercontent.com/06c4a5153686f4f4cce992a5e949df555a4c442c6c1ca857f5ed5ef3ea0f43cb/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3232366266663732633338323462333938356636346539333237653235356333)](https://www.codacy.com/gh/TechWilk/bible-verse-parser/dashboard?utm_source=github.com&utm_medium=referral&utm_content=TechWilk/bible-verse-parser&utm_campaign=Badge_Grade)

Source code: [Github](https://github.com/TechWilk/bible-verse-parser)| [Sourcehut](https://git.sr.ht/~techwilk/bible-verse-parser)| [Codeberg](https://codeberg.org/techwilk/bible-verse-parser)

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance51

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 79.2% 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 ~80 days

Recently: every ~45 days

Total

19

Last Release

625d ago

Major Versions

1.2.0 → 2.0.02021-11-03

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9367803?v=4)[Christopher Wilkinson](/maintainers/TechWilk)[@TechWilk](https://github.com/TechWilk)

---

Top Contributors

[![TechWilk](https://avatars.githubusercontent.com/u/9367803?v=4)](https://github.com/TechWilk "TechWilk (141 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (15 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (6 commits)")[![earboxer](https://avatars.githubusercontent.com/u/12452738?v=4)](https://github.com/earboxer "earboxer (6 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (4 commits)")[![jeff-h](https://avatars.githubusercontent.com/u/841871?v=4)](https://github.com/jeff-h "jeff-h (2 commits)")[![lucaromanoxyz](https://avatars.githubusercontent.com/u/7868224?v=4)](https://github.com/lucaromanoxyz "lucaromanoxyz (2 commits)")[![lucaromano-intelligentia](https://avatars.githubusercontent.com/u/156905352?v=4)](https://github.com/lucaromano-intelligentia "lucaromano-intelligentia (1 commits)")[![GeorgeCraggs](https://avatars.githubusercontent.com/u/1363175?v=4)](https://github.com/GeorgeCraggs "GeorgeCraggs (1 commits)")

---

Tags

parsebiblescriptureversePassage

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/techwilk-bible-verse-parser/health.svg)

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

###  Alternatives

[aranyasen/hl7

HL7 parser, generator and sender.

1991.8M](/packages/aranyasen-hl7)[olamedia/nokogiri

HTML Parser

23178.0k3](/packages/olamedia-nokogiri)[nihongodera/limelight

A php Japanese language text analyzer and parser.

11182.6k](/packages/nihongodera-limelight)[adci/full-name-parser

Parses a human name

29751.3k7](/packages/adci-full-name-parser)[dimabdc/php-fast-simple-html-dom-parser

PHP Fast Simple HTML DOM parser.

9055.5k](/packages/dimabdc-php-fast-simple-html-dom-parser)[jstewmc/rtf

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

45153.1k6](/packages/jstewmc-rtf)

PHPackages © 2026

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