PHPackages                             bedita/import-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bedita/import-tools

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

bedita/import-tools
===================

Import Tools for data import with BEdita

v3.1.1(2mo ago)28.5k↑157.5%1LGPL-3.0-or-laterPHPPHP &gt;= 8.3CI passing

Since Mar 15Pushed 4d ago4 watchersCompare

[ Source](https://github.com/bedita/import-tools)[ Packagist](https://packagist.org/packages/bedita/import-tools)[ RSS](/packages/bedita-import-tools/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (32)Versions (19)Used By (0)

BEdita/ImportTools plugin for CakePHP apps using BEdita
=======================================================

[](#beditaimporttools-plugin-for-cakephp-apps-using-bedita)

[![Github Actions](https://github.com/bedita/import-tools/workflows/php/badge.svg)](https://github.com/bedita/import-tools/actions?query=workflow%3Aphp)[![codecov](https://camo.githubusercontent.com/229a03b9f93187afd859313cbb7830543630a3b01c853fbf79b0b3b826e13d58/68747470733a2f2f636f6465636f762e696f2f67682f6265646974612f696d706f72742d746f6f6c732f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/bedita/import-tools)[![phpstan](https://camo.githubusercontent.com/0729e562e10fac943b16dbb271b4af26488f779a33fc82cc3eef1e37a432c0b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230352d627269676874677265656e2e737667)](https://phpstan.org)[![psalm](https://camo.githubusercontent.com/c9399531f83db9ad38eace5e32a5d3e3382a79f64223deea86d32c3355952ecf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7073616c6d2d6c6576656c253230382d627269676874677265656e2e737667)](https://psalm.dev)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9eee740bbdbd7e25e501397f58188e3e78e55bec94f2726f95a9bda0871c8359/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6265646974612f696d706f72742d746f6f6c732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/bedita/import-tools/?branch=main)[![image](https://camo.githubusercontent.com/6c590397e8146636b8206465f4a81a6c0ce4b9bb86dee26ba2360a14fbfe193a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6265646974612f696d706f72742d746f6f6c732e7376673f6c6162656c3d737461626c65)](https://packagist.org/packages/bedita/import-tools)[![image](https://camo.githubusercontent.com/65c0ac066451716f970780cc1b8a497e5840f948268d7e921c2a85b13ba8ae6d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6265646974612f696d706f72742d746f6f6c732e737667)](https://github.com/bedita/import-tools/blob/main/LICENSE.LGPL)

Installation
------------

[](#installation)

First, if `vendor` directory has not been created, you have to install composer dependencies using:

```
composer install
```

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

The recommended way to install composer packages is:

```
composer require bedita/import-tools
```

Commands
--------

[](#commands)

### AnonymizeUsersCommand

[](#anonymizeuserscommand)

This command provides a tool to anonymize users. Usage examples

```
// anonymize all users (except user by ID 1, admin)
$ bin/cake anonymize_users

// anonymize users by id 2,3,4
$ bin/cake anonymize_users --id 2,3,4

// anonymize all users except users by id 1,2,3
$ bin/cake anonymize_users --preserve 1,2,3
```

### ImportCommand

[](#importcommand)

This command provides a tool to import data from csv file.

Usage examples:

```
# basic
$ bin/cake import --file documents.csv --type documents
$ bin/cake import -f documents.csv -t documents

# dry-run
$ bin/cake import --file articles.csv --type articles --dryrun yes
$ bin/cake import -f articles.csv -t articles -d yes

# destination folder
$ bin/cake import --file news.csv --type news --parent my-folder-uname
$ bin/cake import -f news.csv -t news -p my-folder-uname

# translations
$ bin/cake import --file translations.csv --type translations
$ bin/cake import -f translations.csv -t translations
```

### ImportProjectCommand

[](#importprojectcommand)

You could use this command when you are copying a remote database to a locale database, and after that you want to "adjust" applications and users. Applications and users in default datasource will be updated.

Before launching it, you should setup properly default and import datasources in config/app\_local.php. Example:

```
'Datasources' => [
    // the target database
    'default' => [
        'className' => 'Cake\Database\Connection',
        'driver' => 'Cake\Database\Driver\Mysql',
        'host' => '***********',
        'port' => '***********',
        'username' => '***********',
        'password' => '***********',
        'database' => '***********',
        // ...
    ],
    // the remote database you want to you as source
    'import' => [
        'className' => 'Cake\Database\Connection',
        'driver' => 'Cake\Database\Driver\Mysql',
        'host' => '***********',
        'port' => '***********',
        'username' => '***********',
        'password' => '***********',
        'database' => '***********',
        // ...
    ],
],
```

Usage example:

```
$ bin/cake import_project
```

### TranslateFileCommand

[](#translatefilecommand)

This command provides a tool to translate the content of a file from one language to another, using a translator service (i.e., set in `config/app_local.php`).

Translator service configuration example:

```
'Translators' => [
    'deepl' => [
        'name' => 'DeepL',
        'class' => '\BEdita\I18n\Deepl\Core\Translator',
        'options' => [
            'auth_key' => '************',
        ],
    ],
]
```

Usage example:

```
$ bin/cake translate_file \
  --input articles-en.txt \
  --output articles-it.txt \
  --from en \
  --to it \
  --translator deepl
```

### TranslateObjectsCommand

[](#translateobjectscommand)

This command provides a tool to translate the content of objects from one language to another, using a translator service (i.e., set in `config/app_local.php`, as described above).

Usage examples:

```
# basic
$ bin/cake translate_objects \
  --from en \
  --to it \
  --engine deepl

# dry-run
$ bin/cake translate_objects \
  --from en \
  --to it \
  --engine deepl \
  --dry-run yes

# limit
$ bin/cake translate_objects \
  --from en \
  --to it \
  --engine deepl \
  --limit 10

# status
$ bin/cake translate_objects \
  --from en \
  --to it \
  --engine deepl \
  --status draft

# type
$ bin/cake translate_objects \
  --from en \
  --to it \
  --engine deepl \
  --type articles
```

Utilities
---------

[](#utilities)

You can find some utility classes in `src/Utility` folder.

### CsvTrait

[](#csvtrait)

This trait provides `readCsv` method to progressively read a csv file line by line.

Usage example:

```
use BEdita\ImportTools\Utility\CsvTrait;

class MyImporter
{
    use CsvTrait;

    public function import(string $filename): void
    {
        foreach ($this->readCsv($filename) as $obj) {
            // process $obj
        }
    }
}
```

### FileTrait

[](#filetrait)

This trait provides `readFileStream` method to open "read-only" file stream (you can use local filesystem or adapter).

Usage example:

```
use BEdita\ImportTools\Utility\FileTrait;

class MyImporter
{
    use FileTrait;

    public function read(string $file): void
    {
        [$fh, $close] = $this->readFileStream($path);

        try {
            flock($fh, LOCK_SH);
            // do your stuff
        } finally {
            $close();
        }
    }
}
```

### TreeTrait

[](#treetrait)

This trait provides `setParent` method to save the parent for a specified entity.

Usage example:

```
use BEdita\ImportTools\Utility\TreeTrait;

class MyImporter
{
    use TreeTrait;

    public function import(string $filename, string $destination): void
    {
        foreach ($this->readCsv($filename) as $obj) {
            $this->setParent($obj, $destination);
        }
    }
}
```

### Import

[](#import)

This class provides functions to import data from csv files into BEdita.

Public methods are:

- `saveObjects`: read data from csv and save objects
- `saveObject`: save a single object
- `saveTranslations`: read data from csv and save translations
- `saveTranslation`: save a single translation
- `translatedFields`: get translated fields for a given object

Usage example:

```
use BEdita\ImportTools\Utility\Import;

class MyImporter
{
    public function import(string $filename, string $type, ?string $parent, ?bool $dryrun): void
    {
        $import = new Import($filename, $type, $parent, $dryrun);
        $import->saveObjects();
    }
}
```

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance93

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 83.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~75 days

Recently: every ~115 days

Total

16

Last Release

78d ago

Major Versions

v1.5.0 → v2.0.02024-12-05

2.x-dev → v3.0.02025-11-28

PHP version history (4 changes)v1.0.0PHP ^7.4 || ^8.0

v1.2.0PHP &gt;= 7.4

v2.0.0PHP &gt;= 8.1

v2.1.0PHP &gt;= 8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/33c95e1516af3f48ebb2057caafd7f331a7aaae58c52442f8e8d00e03b211da9?d=identicon)[stefanorosanelli](/maintainers/stefanorosanelli)

---

Top Contributors

[![didoda](https://avatars.githubusercontent.com/u/2227145?v=4)](https://github.com/didoda "didoda (104 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (12 commits)")[![stefanorosanelli](https://avatars.githubusercontent.com/u/2122280?v=4)](https://github.com/stefanorosanelli "stefanorosanelli (5 commits)")[![fquffio](https://avatars.githubusercontent.com/u/7108146?v=4)](https://github.com/fquffio "fquffio (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bedita-import-tools/health.svg)

```
[![Health](https://phpackages.com/badges/bedita-import-tools/health.svg)](https://phpackages.com/packages/bedita-import-tools)
```

###  Alternatives

[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

3361.0M51](/packages/dereuromark-cakephp-tools)[verbb/formie

The most user-friendly forms plugin for Craft.

102393.6k69](/packages/verbb-formie)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k18](/packages/solspace-craft-freeform)[bedita/manager

BEdita Manager - official admin webapp for BEdita4 API

131.2k](/packages/bedita-manager)[blackfire/player

A powerful web crawler and web scraper with Blackfire support

49617.1k](/packages/blackfire-player)[directorytree/dummy

439.9k](/packages/directorytree-dummy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
