PHPackages                             nmfmcosta/laravel-formatter - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. nmfmcosta/laravel-formatter

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

nmfmcosta/laravel-formatter
===========================

A formatting library that converts data output between XML, CSV, JSON, TXT, YAML and a few others.

v1.4(3mo ago)115.1k—0.5%2[1 PRs](https://github.com/nmfmcosta/laravel-formatter/pulls)MITPHPPHP ^7.2|^8.0

Since Dec 9Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/nmfmcosta/laravel-formatter)[ Packagist](https://packagist.org/packages/nmfmcosta/laravel-formatter)[ Docs](http://github.com/nmfmcosta/laravel-formatter)[ RSS](/packages/nmfmcosta-laravel-formatter/feed)WikiDiscussions main Synced 1mo ago

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

Formatter Bundle
================

[](#formatter-bundle)

This is a fork from  updated to work on Laravel 8 and 9.

**All credit goes to the original authors.**

A formatter package that will help you to easily convert between various formats such as XML, JSON, CSV, etc...

Goals
=====

[](#goals)

The goals of this library are to allow the transfomation of data formats from one type to another. See Parsers and Formats to see supported input / output formats.

Installation
============

[](#installation)

Through command line:

```
composer require nmfmcosta/laravel-formatter
```

Through composer.json:

```
{
  "require": {
    "nmfmcosta/laravel-formatter": "1.x"
  }
}
```

Parsers
-------

[](#parsers)

All of the following are supported formats that the formatter can read from.

- Array
- CSV
- JSON
- XML
- YAML

Formats
-------

[](#formats)

All of the following are formats that are supported for output.

- Array
- CSV
- JSON
- XML
- YAML

General Usage
-------------

[](#general-usage)

**Including The Formatter**

```
use LB\Formatter\Formatter;
```

**Supported Types**

```
Formatter::JSON; //json
Formatter::CSV;  //csv
Formatter::XML;  //xml
Formatter::ARR;  //array
Formatter::YAML; //yaml
```

**Making Your First Formatter(s)**

```
$formatter = Formatter::make($jsonString, Formatter::JSON);
$formatter = Formatter::make($yamlString, Formatter::YAML);
$formatter = Formatter::make($array, Formatter::ARR);
...
```

**Outputting From Your Formatter**

```
$csv   = $formatter->toCsv();
$json  = $formatter->toJson();
$xml   = $formatter->toXml();
$array = $formatter->toArray();
$yaml  = $formatter->toYaml();
```

Deprecated Functionality
------------------------

[](#deprecated-functionality)

The following have been deprecated from the library, however you can easily continue using them in your application

**Serialized Array**

```
$serialized = serialize($formatter->toArray());
```

**PHP Export**

```
$export = var_export($formatter->toArray());
```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance78

Regular maintenance activity

Popularity30

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

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

Every ~570 days

Total

3

Last Release

116d ago

PHP version history (2 changes)1.0PHP ^8.0

v1.3PHP ^7.2|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6989039?v=4)[Nuno Costa](/maintainers/nmfmcosta)[@nmfmcosta](https://github.com/nmfmcosta)

---

Top Contributors

[![nmfmcosta](https://avatars.githubusercontent.com/u/6989039?v=4)](https://github.com/nmfmcosta "nmfmcosta (8 commits)")

---

Tags

formatterlaravelxmlconvertdatayamlcsv

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nmfmcosta-laravel-formatter/health.svg)

```
[![Health](https://phpackages.com/badges/nmfmcosta-laravel-formatter/health.svg)](https://phpackages.com/packages/nmfmcosta-laravel-formatter)
```

###  Alternatives

[soapbox/laravel-formatter

A formatting library that converts data output between XML, CSV, JSON, TXT, YAML and a few others.

2501.1M12](/packages/soapbox-laravel-formatter)[hitsend/laravel-formatter

A formatting library that converts data output between XML, CSV, JSON, TXT, YAML and a few others.

2502.0k](/packages/hitsend-laravel-formatter)[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[dracoblue/craur

A lossless xml to json and json to xml converter (and csv/xlsx/yaml). Writing PHP Json/Xml/Csv/Yaml/excel Importers made easy

4643.1k2](/packages/dracoblue-craur)

PHPackages © 2026

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