leodido / conversio
A library that provides a simple infrastructure to create your own converters and to perform any conversion you want
Fund package maintenance!
leodido
Installs: 47 457
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 1
Open Issues: 1
Requires
- php: >=5.4
- laminas/laminas-filter: 2.*
Requires (Dev)
- phpunit/phpunit: ~4.2
This package is auto-updated.
Last update: 2024-12-11 16:49:17 UTC
README
Conversio is a PHP library that provides a simple infrastructure to create your own converters and to perform any conversion.
Explaination
The entry point for conversion is the class Conversion
, that acts as a filter (i.e., Zend\Filter\AbstractFilter
).
To implement a conversion you have to create an adapter (that will be passed to Conversion
class) that describes its process.
The adapters must implement the ConversionAlgorithmInterface
interface.
Furthermore, adapters can have options too, in the form of a Zend\Stdlib\AbstractOptions
subclass. Conversio library requires only that the options class of each adapter is called with the name of the adapter followed by the suffix "Options" (e.g., LanguageCodeOptions
is the option class of LanguageCode
adapter class).
In this case your adapter can extend AbstractOptionsEnabledAdapter
abstract class to take advantage of its options related methods.
The OptionsMap
class is an utility class aimed to create a option class starting from a configuration hash that describes the options (by name) and their admitted values.
Installation
Add leodido/conversio
to your composer.json
.
{ "require": { "leodido/conversio": "v0.3.0" } }
Usage
WIP
Converters
Here will be listed the converters created using Conversio library.