englishdom / converter
A data converter
Installs: 4 492
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- php: ^7.1|^8.0
Requires (Dev)
- phpunit/phpunit: ^8.4
README
A library for reading data, converting and writing
Setup reader
Setup PdoReader for reading data from mysql.
$reader = new \Converter\Reader\PdoReader(
'mysql:host=localhost;port=3306;dbname=base;charset=utf8',
'user',
'pass',
[\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION],
'table'
);
If need extend query adapter has method setSQL
Setup manager
After reading data need convert data to entity
$manager = new \Converter\Manager(
[['reader' => $reader, 'transformer' => \Converter\Reader\Transformer\BaseTransformer::class]],
[new \Converter\Processor\FileExistProcessor()],
[['writer' => $writer, 'transformer' => \Converter\Writer\Transformer\BaseTransformer::class]]
);
$manager->manage();