socoolbear / matrix-converter
tab or json matrix string converter
v0.0.4
2017-12-12 07:36 UTC
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.8
- phpunit/phpunit: ^6.4
This package is not auto-updated.
Last update: 2025-07-06 09:38:56 UTC
README
Tab Or Json spereated Matrix String Converter
Getting started
composer require socoolbear/matrix-converter
Example
<?php
require __DIR__ . '/vendor/autoload.php';
$jconv = new MatrixConverter\JsonConverter();
$jcor = $jconv->toMatrix("a\tb\r\nc\td");
$tconv = new MatrixConverter\TabConverter();
$tcor = $tconv->toMatrix($jcor);
echo 'json converter : ' . $jcor . PHP_EOL;
echo 'tab converter : ' . $tcor . PHP_EOL;
json converter :
{
"count": {
"trados": 0
},
"data": [
[
{
"from": "seo.translate_dictionary_source",
"keyword": "a",
"result": "a",
"type": "head"
},
{
"from": "seo.translate_dictionary_source",
"keyword": "b\r",
"result": "b\r",
"type": "head"
}
],
[
{
"from": "seo.translate_dictionary_source",
"keyword": "c",
"result": "c",
"type": "body"
},
{
"from": "seo.translate_dictionary_source",
"keyword": "d",
"result": "d",
"type": "body"
}
]
]
}
tab converter :
a b
c d