xsuchy09/neon2db

将neon文件中的数据保存到数据库的库。

v1.0.0 2020-06-26 13:22 UTC

This package is auto-updated.

Last update: 2024-08-26 23:12:05 UTC


README

将数据从neon文件保存到数据库,并从数据库返回到neon文件的库。对于管理数据库中的Kdyby/Translation翻译非常有用。

安装

composer require xsuchy09/neon2db

使用

$connection = new \Nette\Database\Connection('dsn', 'user', 'password');
$configuration = new \xsuchy09\Neon2Db\DI\Configuration();
$configuration->setTable('public.translation');

$neon2Database = new \xsuchy09\Neon2Db\Neon2Database($connection, $configuration);
// neon files should be named as name of the file dot locale dot neon - examples:
// admin.cs_CZ.neon
// base.cs_CZ.neon
// ...

// these files you have probably as default in git
$neon2Database->insertFromDir('path to the dir with neon files to import into the database');
// these files should use your app ... they should be regenerate after any update in database - use this method to re/generate them
$neon2Database->saveToNeon('path to the dir where files from database data should be exported');

这就完了 :)

欢迎提出评论和拉取请求。