jalendport / craft-roman
Convert an integer into roman numerals and vice versa.
Fund package maintenance!
jalendport
Installs: 144
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 1
Type:craft-plugin
Requires
- craftcms/cms: ^4.0.0
This package is auto-updated.
Last update: 2024-11-09 08:47:09 UTC
README
Convert an integer into roman numerals and vice versa.
— Based on the Craft 2 version of the Roman plugin by Bransin Anderson
Installation
Requirements
This plugin requires Craft CMS 4.0.0 or later.
Plugin Store
Log into your control panel and click on 'Plugin Store'. Search for 'Roman'.
Composer
- Open your terminal and go to your Craft project:
cd /path/to/project
- Then tell Composer to load the plugin:
composer require jalendport/craft-roman
- In the Control Panel, go to Settings → Plugins and click the “Install” button for Roman.
Using Roman
Roman provides several Twig methods for easy conversion between integers and roman numerals:
-
You can pass an integer (or a string) into the
getRoman()
method to get roman numerals:{{ craft.roman.getRoman(298) }} // Output: CCXCVIII {{ craft.roman.getRoman('539') }} // Output: DXXXIX
-
You can pass a string (of roman numerals) into the
getNumber()
method to get an integer:{{ craft.roman.getNumber('ML') }} // Output: 1050
-
Roman also includes a helper attribute to quickly get the current year in roman numeral form:
{{ craft.roman.currentYear }} // Output: MMXXIII
Found a Bug? Need Support?
Please open an issue describing what's going wrong.
Roadmap
Some things to do, and ideas for potential features:
- Twig filter for converting all integers in a string of text to roman numerals.
If there's a feature you think should be added to Roman, please open an issue. PRs are also welcome!
Contributors
- Plugin development: Jalen Davenport / @jalendport
- Craft 2 plugin development: Bransin Anderson
- Icon: nawaf falah, via The Noun Project