johninamillion/scripture-header

Custom PHP CS-Fixer that injects dynamic copyright headers with random Bible verses.

0.2.0 2025-09-25 20:21 UTC

This package is auto-updated.

Last update: 2025-09-25 21:43:19 UTC


README

PHPUnit PHPStan

Scripture Header is a PHP package that allows you to add copyright headers with bible verses to your code files as comments via php-cs-fixer/php-cs-fixer. It supports various Bible translations from scrollmapper/bible_databases and can be easily integrated into your development workflow.

Table of Contents

Installation

You can install the package via Composer:

composer require --dev johninamillion/scripture-header

Basic Usage

To use Scripture Header, you need to configure PHP-CS-Fixer to apply the header to your files. Create or update the .php-cs-fixer.php.dist file in the root of your project with the following configuration:

Example Configuration

<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use johninamillion\ScriptureHeader\ScriptureHeaderFixer;

// Include the ScriptureHeaderFixer class for github actions.
if (!class_exists(ScriptureHeaderFixer::class)) {
    require_once __DIR__ . '/src/ScriptureHeaderFixer.php';
}

$finder = Finder::create()
    ->in(__DIR__ . '/src');

return (new Config())
    ->setRules([
        'MillionVisions/scripture_header' => true,
    ])
    ->setFinder($finder)
    ->registerCustomFixers([
        'MillionVisions/scripture_header' => new ScriptureHeaderFixer()
    ]);

Customization

You can easily customize the rules for the Scripture Header Fixer by passing options.

    ...
    ->setRules([
        'MillionVisions/scripture_header' => [
            'author'    => 'Your Name',
            'bible'     => 'data/BIBLE.json',
            'template'  => 'your-copyright.php'
            'pattern'   => '/your-pattern/'
        ]
    ])
    ... 
Option Description Default Value
author Custom author name. Vendor name from composer.json
bible Custom path to any bible translation in json format from scrollmapper/bible_databases.
This package only provides the KJV.json.
The filename is used as suffix for the bible verses.
data/KJV.json
template Custom template for your copyright header. ./copyright.php
pattern Custom pattern for copyright header replacements. /^\/\*\*[\s\S]+?copyright (\d{4}) - .+$/

Development

Analyze

To analyze your code for potential issues, you can run phpstan:

composer code:analyse

CS-Fixer

To ensure your code adheres to the coding standards, you can run the php-cs-fixer.

composer code:format

Testing

To run the tests, make sure you have installed phpunit within the dev dependencies and then run:

composer test

Check the Test Coverage:

composer test:coverage

License

This package is licensed under the MIT License. See the LICENSE file for more details.

All Glory To God - The Father, The Son, and The Holy Spirit.