Download the PHP package wandersonwhcr/romans without Composer

On this page you can find all versions of the php package wandersonwhcr/romans. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package romans

romans

A Simple PHP Roman Numerals Library

Build Status Updated Latest Stable Version codecov License StandWithUkraine

Usage

This library includes a simple couple of filters to convert a string with Roman number to an int that represents the input as decimal and decimal int to a string with Roman number as result.

Installation

This package uses Composer as default repository. You can install it adding the name of package in require section of composer.json, pointing to the last stable version.

Also, Romans uses Semantic Versioning. The following package versions support these PHP releases:

Integrations

This library can be used as dependency for projects, making integrations with libraries or frameworks easier. If you want to add more items in this list, please, open an issue or create a pull request, adding your project alphabetically.

Advanced Usage

The Romans package uses a Lexer-Parser approach and a Deterministic Finite Automaton (DFA) to convert Roman number to int, using a Grammar Token library.

Exception Handling

The filter RomanToInt uses Lexer to tokenize the input and Parser to build the int number. When errors are found, the Lexer or Parser throw Exceptions to notify the problem with a specific code.

You can use this structure to validate Roman numbers, adding a try..catch block to check if $input is valid. Also, you can validate if an int can be filtered to Roman using an IntToRoman filter.

Zero

The zero value is represented as string "N", the initial of nulla or nihil, the Latin word for "nothing" (see references).

Cache

This package uses PSR-6 Caching Interface to improve execution, mainly over loops (like while or foreach) using cache libraries. Any PSR-6 implementation can be used and we suggest Symfony Cache package.

Development

You can use Docker Compose to build an image and run a container to develop and test this package.

Techniques

This section describes techniques used by this package to convert Roman numbers into int and vice-versa.

Lexer-Parser

A Lexer-Parser approach was chosen because the validating and reading of Roman numbers are more simplified: the Lexer is responsible for reading and transform the input into tokens, validating content at char level; and the Parser is responsible for transform tokens into numbers, validating content at position level and converting to int through a DFA.

Wikipedia says that "lexical analysis is the process of converting a sequence of characters into a sequence of tokens", that "is a structure representing a lexeme that explicity indicates its categorization for the purpose of parsing". Even, Wikipedia says that "parsing or syntax analysis is the process of analysing symbols conforming to the rules of a formal grammar".

This structure makes easier the development of a structure responsible to read an input string, converting it to another structure according to specific charset and its position inside input.

Deterministic Finite Automaton (DFA)

A DFA was developed to check if a string with Roman number is valid. This technique was choiced because other implementations simply convert the input without checking rules, like four chars sequentially.

The current automaton definition is declared below.

References

License

This package is opensource and available under MIT license described in LICENSE.


All versions of romans with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wandersonwhcr/romans contains the following files

Loading the files please wait ....