fredyns / nested-numbering
Create nested numbering
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:php-library
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2025-03-16 17:34:36 UTC
README
create nested numbering from PHP like...
1. main item.
a. sub item 1.
b. sub item 2.
2. more item
a. more sub item .
or something like...
1. main item.
1.a. sub item 1.
1.b. sub item 2.
2. more item
2.a. more sub item 1.
Instalation
composer require "fredyns/nested-numbering":"dev-master"
or just copy that one class defined in php file.
Usage
use fredyns\nestednumbering\NestedNumbering; NestedNumbering::start(['1','a']); echo NestedNumbering::newItem($level);
Advance Config
NestedNumbering::start([ $numbering_type_level_1, $numbering_type_level_2, $numbering_type_level_3, $numbering_type_level_4, $numbering_type_level_5, 'full' => true|false, // generate full numering like *A.1.a* 'indentation' => ' ', // will add space before numbering. false for none. ]);
Numbering type:
- A: for uppercase alphabetic
- a: for lowercase alphabetic
- I: for uppercase roman
- i: for lowercase alphabetic
- 1: for numeric
You can also specify numbering tail like '1)'
. First char regarded as type, rest is tail.
For full numbering, tail set to dot (.)
SIDE BONUS
There is converter from integer numeric to alphabetic & roman numbering.
echo NestedNumbering::int2Char($integer, $uppercase); echo NestedNumbering::int2Roman($integer);