PHPackages                             jackal/copycat - 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. jackal/copycat

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jackal/copycat
==============

Library to copy `things` from one format to another

v0.2.13(5y ago)34.4k↑43.3%MITPHPPHP &gt;=5.6CI failing

Since Jul 18Pushed 5y ago2 watchersCompare

[ Source](https://github.com/lucajackal85/Copycat)[ Packagist](https://packagist.org/packages/jackal/copycat)[ RSS](/packages/jackal-copycat/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (4)Versions (18)Used By (0)

CopyCat
=======

[](#copycat)

A simple PHP to "copy" data from one source to another

[![Latest Stable Version](https://camo.githubusercontent.com/4f74479922b99b3d3b9416267cd9f745338e71ded59c239fa9e2d247f32b2e01/68747470733a2f2f706f7365722e707567782e6f72672f6a61636b616c2f636f70796361742f762f737461626c65)](https://packagist.org/packages/jackal/copycat)[![Total Downloads](https://camo.githubusercontent.com/cf023ae8c649837b6f8ec6545ef7bbc52f6346f2498a509a6fe55574883d2b3c/68747470733a2f2f706f7365722e707567782e6f72672f6a61636b616c2f636f70796361742f646f776e6c6f616473)](https://packagist.org/packages/jackal/copycat)[![Latest Unstable Version](https://camo.githubusercontent.com/502a3924e3b546c85b788a8cfd6c8517f68358a3d86f2d61a51dc665b1bad917/68747470733a2f2f706f7365722e707567782e6f72672f6a61636b616c2f636f70796361742f762f756e737461626c65)](https://packagist.org/packages/jackal/copycat)[![License](https://camo.githubusercontent.com/285101cc0ec0316baeea2a758ce402d66dad48f92eebd696364a07215acbad9f/68747470733a2f2f706f7365722e707567782e6f72672f6a61636b616c2f636f70796361742f6c6963656e7365)](https://packagist.org/packages/jackal/copycat)[![Build Status](https://camo.githubusercontent.com/5b56e88b81c0f65efd8e9f1c2b7a76f300300a133aa0d4795b20ea05242da781/68747470733a2f2f7472617669732d63692e6f72672f6c7563616a61636b616c38352f42696e4c6f6361746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/lucajackal85/BinLocator)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b4cbf0a3bd3d2cb57356e8f1a0b0f43df61f7697be28c01b38269b9519287bcb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c7563616a61636b616c38352f436f70796361742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/lucajackal85/Copycat/?branch=master)[![codecov](https://camo.githubusercontent.com/d0c7fd8a57c14b76cd592bb279b1ced5c28c29a45f71ae49db5150b801d202d8/68747470733a2f2f636f6465636f762e696f2f67682f6c7563616a61636b616c38352f636f70796361742f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/lucajackal85/copycat)

### Requirement

[](#requirement)

PHP &gt;= **5.6**

Getting Started
---------------

[](#getting-started)

Install library with composer

```
composer require jackal/copycat

```

Usage
-----

[](#usage)

#### Basic example: from array to sql insert statement

[](#basic-example-from-array-to-sql-insert-statement)

```
require_once __DIR__.'/vendor/autoload.php';
$reader = new \Jackal\Copycat\Reader\ArrayReader([
    ['col1' => 'value1','col2' => 'value2'],
    ['col1' => 'value3','col2' => 'value4'],
    /*...*/
]);

$workflow = new \Jackal\Copycat\Workflow($reader);
$workflow->addWriter(new \Jackal\Copycat\Writer\SQLFileWriter('test_table','test_table.sql'));
$workflow->process();

echo file_get_contents(__DIR__.'/test_table.sql');

```

#### From array to array

[](#from-array-to-array)

```
$reader = new \Jackal\Copycat\Reader\ArrayReader([
    ['value1'],
    ['value2'],
    /*...*/
]);

$workflow = new \Jackal\Copycat\Workflow($reader);
$workflow->addWriter(new \Jackal\Copycat\Writer\ArrayWriter($outputArray));

$workflow->process();

var_dump($outputArray);

```

### Filters

[](#filters)

With Filters you can apply logic to exclude certain values from the output.

```
/*[...]*/
/*Define wich column to apply filter*/
$workflow->addFilter(new NotBlankFilter('col1'));
/*[...]*/

```

Filters are callable objects, you can define your own filter

```
/*[...]*/
/*Define custom filter*/
$workflow->addFilter(function($values){
    return $values['col1'] > 0;
});
/*[...]*/

```

### Converter

[](#converter)

With Converter you can modify values to the output.

```
/*[...]*/
/*Define custom filter*/
$workflow->addConverter(new DatetimeToStringConverter('col1'));
/*[...]*/

```

You can set your own converter

```
/*[...]*/
//apply custom converter
$workflow->addConverter(function ($values){
    foreach ($values as &$value) {
        if ($value == 'to convert') {
            $value = 'converted';
        }
    }
    return $values;
});
/*[...]*/

```

### Sorting

[](#sorting)

Is it possible to sort output values

```
/*[...]*/
//add sorter
$workflow->addSorter(new AscendingSorter('col1'));
/*[...]*/

```

If you want to sort values basing on multiple columns, you can just add multiple params. **Use with care! this method could create performance issues on large input data**

```
/*[...]*/
//add sorter
$workflow->addSorter(new AscendingSorter('col1','col2','col3',/*...*/));
/*[...]*/

```

Authors
-------

[](#authors)

- **Luca Giacalone** (AKA JackalOne)

License
-------

[](#license)

This project is licensed under the MIT License

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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 ~51 days

Recently: every ~1 days

Total

16

Last Release

2144d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/13db4a2702d54af2cbbce04c934f80cddd423fc7a8ad12124cae6459b39e3a05?d=identicon)[lucajackal85](/maintainers/lucajackal85)

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/jackal-copycat/health.svg)

```
[![Health](https://phpackages.com/badges/jackal-copycat/health.svg)](https://phpackages.com/packages/jackal-copycat)
```

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M25.2k](/packages/friendsofphp-php-cs-fixer)[symfony/rate-limiter

Provides a Token Bucket implementation to rate limit input and output in your application

27054.3M290](/packages/symfony-rate-limiter)[symfony/ldap

Provides a LDAP client for PHP on top of PHP's ldap extension

1408.1M59](/packages/symfony-ldap)[symfony/ux-cropperjs

Cropper.js integration for Symfony

19346.6k3](/packages/symfony-ux-cropperjs)[php-soap/ext-soap-engine

An ext-soap engine implementation

443.5M12](/packages/php-soap-ext-soap-engine)[symfony/ux-toggle-password

Toggle visibility of password inputs for Symfony Forms

27600.4k5](/packages/symfony-ux-toggle-password)

PHPackages © 2026

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