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.
You can install the package via Composer:
composer require --dev johninamillion/scripture-headerTo 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:
<?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()
]);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}) - .+$/ |
To analyze your code for potential issues, you can run phpstan:
composer code:analyseTo ensure your code adheres to the coding standards, you can run the php-cs-fixer.
composer code:formatTo run the tests, make sure you have installed phpunit within the dev dependencies and then run:
composer testCheck the Test Coverage:
composer test:coverageThis package is licensed under the MIT License. See the LICENSE file for more details.