PHPackages                             samad/array-conversion - 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. samad/array-conversion

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

samad/array-conversion
======================

PHP Library for converting associative arrays as html table, XML, JSON, CSV. Also add, remove or edit column can be possible.

v1.0.0(6y ago)1630↓50%MITPHP

Since Feb 12Pushed 6y ago1 watchersCompare

[ Source](https://github.com/samadfcibd/ArrayConversion)[ Packagist](https://packagist.org/packages/samad/array-conversion)[ Docs](https://github.com/samadfcibd/ArrayConversion)[ RSS](/packages/samad-array-conversion/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

ArrayConversion
===============

[](#arrayconversion)

PHP Library for converting associative arrays as html table, XML, JSON, CSV. Also add, remove or edit column can be possible.

Inspired by [yajra/laravel-datatables](https://github.com/yajra/laravel-datatables)

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

[](#installation)

Install the library by composer with following command:

```
composer install samad/array-conversion
```

Documentation
-------------

[](#documentation)

An associative/ multidimensional array or object can be manipulate with this script. You can convert the array/ object to HTML table, CSV file, JSON or XML data.

Suppose, you have an array as like following:

```
$data = [
            [
                'name' => 'Abdus Samad',
                'email' => 'samadocpl@gmail.com'
            ],
            [
                'name' => 'Ibrahim Ahad',
                'email' => 'ahad@gmail.com'
            ]
        ];
```

now, you can convert this `$data` as HTML table

```
$toTableInitiate = new ArrayConversion($data);
$toTableInitiate->toTable()
```

also, this `$data` can be converted into following formats:

- CSV file `toCSV()`
- JSON format `toJson()`
- XML format `toXml()`

#### Add, Edit or Remove column

[](#add-edit-or-remove-column)

You can add an extra column by using closure. As like `Action` to each single array of `$data`

```
$addColumnToTable = new ArrayConversion($data);

$addColumnToTable->addColumn('Action', function ($data) {
    return 'Action';
})->toTable();
```

or you can remove single/ multiple column from each single array

```
$removeColumnFromTable = new ArrayConversion($data);

$removeColumnFromTable->removeColumn('email', 'name')
                      ->toTable();
```

also, you can edit column from each single array

```
$editColumn = new ArrayConversion($data);
$editColumn->editColumn('email', function ($data) {
    return 'Email: ' . $data['email'];
})->toTable();
```

After installation this library, you will see a file `index.php` with details example.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/samadfcibd/ArrayConversion/blob/master/LICENSE) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2287d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/989fbf05410d8e036a5fe2816d0eff01b7197a148e65b4bbbc4a8755dfa5f33f?d=identicon)[samadfci](/maintainers/samadfci)

---

Top Contributors

[![samadfcibd](https://avatars.githubusercontent.com/u/24468211?v=4)](https://github.com/samadfcibd "samadfcibd (14 commits)")

---

Tags

arrayarray conversionarray-to-xmlarray-convertarray-to-csvarray-to-jsonarray-to-html

### Embed Badge

![Health badge](/badges/samad-array-conversion/health.svg)

```
[![Health](https://phpackages.com/badges/samad-array-conversion/health.svg)](https://phpackages.com/packages/samad-array-conversion)
```

###  Alternatives

[doctrine/collections

PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.

6.0k411.1M1.2k](/packages/doctrine-collections)[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[openlss/lib-array2xml

Array2XML conversion library credit to lalit.org

31052.5M47](/packages/openlss-lib-array2xml)[league/config

Define configuration arrays with strict schemas and access values with dot notation

564302.2M24](/packages/league-config)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)

PHPackages © 2026

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