xsuchy09 / neon2db
Library to save data from neon file into the database.
v1.0.0
2020-06-26 13:22 UTC
Requires
- php: >= 7.4
- ext-json: *
- ext-pdo: *
- nette/database: ^3.0
- nette/neon: ^3.1
- nette/utils: ^3.1
Requires (Dev)
- nette/tester: ^2.3
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^0.12.31
- phpstan/phpstan-nette: ^0.12.6
This package is auto-updated.
Last update: 2024-10-26 23:34:59 UTC
README
Library to save data from neon file to the database and back to the neon file. It can be helpful for managing translates in the database for Kdyby/Translation.
Install
composer require xsuchy09/neon2db
Usage
$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');
That's all :)
Any comments and pull requests are welcome.