rk/php-sword

A PHP library for reading SWORD project Bible modules. Inspired by PySword.

Maintainers

Package info

github.com/rk/PhpSword

pkg:composer/rk/php-sword

Statistics

Installs: 30

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.2.6 2026-06-13 15:32 UTC

This package is auto-updated.

Last update: 2026-06-13 15:35:44 UTC


README

PHP Sword is a library for interacting with SWORD Project Bible Modules, intended for other uses like converting to other formats or working with the raw data. Inspired by PySword.

Features

  • Reads Bible modules.
  • Supports ztext, ztext4, rawtext, rawtext4 formats.
  • Supports compressed modules, in zip format.
  • Supports PHP 8.4+
  • Sapphire II Stream Cipher

Development Structure

- _doc - internal planning documents, ignored in .git
- _doc/wiki - internal documentation of the structure
- _doc/PySword - a copy of PySword for translation from
- src/ - PSR-4 compatible package root
- tests/ - where our tests go

AI agents SHALL MAINTAIN the _doc/wiki as a current description of architecture, decisions, and memories.

Goals

  • A feature-complete translation of PySword in PHP.
  • It SHOULD be idiomatic PHP.
  • It MUST use minimal or preferably NO 3rd party packages except during development.
  • It MUST adhere to PSR-4 and PER3.0 standards.
  • It MUST adhere to SemVer.
  • It SHOULD document/DocBlock anything that requires additional context.
  • It MUST exclude non-essential files using .gitattributes.
  • It MUST maintain a changelog for each release, and it should state both the WHAT and WHY.

Getting Started

composer install
composer download-bibles   # fetches KJV, ASV, and other fixture modules
composer test              # 45 tests; 3 skipped when FTP fixtures unavailable
composer lint && composer analyse

Set PHP_SWORD_AUTO_DOWNLOAD=1 to auto-download missing bible fixtures when running tests.

ChiPinyin test gap: testLoadChipinyinZip is skipped when chipinyin.zip is missing. The CrossWire/Xiphos FTP mirror for that module is down and no alternative download URL was found, so this integration test cannot be repaired until a substitute fixture source is available.

Roadmap

  • Phase 1
    • Package development environment configuration, like test framework, linter, formatter, etc.
    • Translate all test cases from PySword as a reference implementation.
      • Tests should be able to pass on both the KJV and ASV modules. Those are our first targets to test against. They should probably be downloaded into test when the test case runs, if they don't already exist.
  • Phase 2
    • Translate or implement all features in PySword.
    • Test cases UNCHANGED (fixture text captured from downloaded modules where PySword assertions differ).
  • Phase 3
    • Complete test case coverage if less than 80%.
  • Phase 4
    • TBD