Skip to content

Commit d358e01

Browse files
committed
Update readme.md file
1 parent 1790975 commit d358e01

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

readme.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,90 @@ Formatter Bundle
44
[![Build Status](https://travis-ci.org/SoapBox/laravel-formatter.svg?branch=master)](https://travis-ci.org/SoapBox/laravel-formatter)
55

66
A formatter package that will help you to easily convert between various formats such as XML, JSON, CSV, etc...
7+
8+
# Goals
9+
The goals of this library to to allow the transfomation of data formats from one type to another. See Parsers and Formats to see supported input / output formats.
10+
11+
# Installation
12+
13+
Through command line:
14+
15+
```bash
16+
composer require soapbox/laravel-formatter
17+
```
18+
19+
Through composer.json:
20+
21+
```json
22+
{
23+
"require": {
24+
"soapbox/laravel-formatter": "2.x"
25+
}
26+
}
27+
28+
```
29+
30+
## Parsers
31+
All of the following are supported formats that the formatter can read from.
32+
* Array
33+
* CSV
34+
* JSON
35+
* XML
36+
* YAML
37+
38+
## Formats
39+
All of the following are formats that are supported for output.
40+
* Array
41+
* CSV
42+
* JSON
43+
* XML
44+
* YAML
45+
46+
## General Usage (See tests for most up to date examples)
47+
48+
__Including The Formatter__
49+
50+
```php
51+
use SoapBox\Formatter\Formatter;
52+
```
53+
54+
__Supported Types__
55+
56+
```php
57+
Formatter::JSON; //json
58+
Formatter::CSV; //csv
59+
Formatter::XML; //xml
60+
Formatter::ARR; //array
61+
Formatter::YAML; //yaml
62+
```
63+
64+
__Making Your First Formatter__
65+
66+
```php
67+
$formatter = Formatter::make($jsonString, Formatter::JSON);
68+
```
69+
70+
__Outputting From Your Formatter__
71+
72+
```php
73+
$csv = $formatter->toCsv();
74+
$json = $formatter->toJson();
75+
$xml = $formatter->toXml();
76+
$array = $formatter->toArray();
77+
$yaml = $formatter->toYaml();
78+
```
79+
80+
## Deprecated Functionality
81+
The following have been deprecated from the library, however you can easily continue using them in your application
82+
83+
__Serialized Array__
84+
85+
```php
86+
$serialized = serialize($formatter->toArray());
87+
```
88+
89+
__PHP Export__
90+
91+
```php
92+
$export = var_export($formatter->toArray());
93+
```

0 commit comments

Comments
 (0)