Skip to content

Commit 36adc24

Browse files
committed
v1.1.1
1 parent 6d402f4 commit 36adc24

File tree

2 files changed

+5
-62
lines changed

2 files changed

+5
-62
lines changed

README.md

+3-60
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,5 @@
1-
## Data Coder
1+
# A flexible data coder for encoding and decoding formats like JSON, YAML, and more.
22

3-
### A flexible data coder for encoding and decoding formats like JSON, YAML, and more.
3+
## Resources
44

5-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sunrise-php/coder/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sunrise-php/coder/?branch=master)
6-
[![Code Coverage](https://scrutinizer-ci.com/g/sunrise-php/coder/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/sunrise-php/coder/?branch=master)
7-
[![Total Downloads](https://poser.pugx.org/sunrise/coder/downloads?format=flat)](https://packagist.org/packages/sunrise/coder)
8-
9-
## Installation
10-
11-
```bash
12-
composer require sunrise/coder
13-
```
14-
15-
## How to use
16-
17-
### Quick Start
18-
19-
```php
20-
use Sunrise\Coder\CodecManager;
21-
use Sunrise\Coder\Codec\JsonCodec;
22-
use Sunrise\Coder\Codec\UrlEncodedCodec;
23-
use Sunrise\Coder\Dictionary\MediaType;
24-
25-
$codecManager = new CodecManager(codecs: [
26-
new JsonCodec(),
27-
new UrlEncodedCodec(),
28-
]);
29-
30-
// Encoding result: {"foo": "bar"}
31-
$codecManager->encode(MediaType::JSON, ['foo' => 'bar']);
32-
// Decoding result: ['foo' => 'bar']
33-
$codecManager->decode(MediaType::JSON, '{"foo": "bar"}');
34-
35-
// Encoding result: foo=bar
36-
$codecManager->encode(MediaType::UrlEncoded, ['foo' => 'bar']);
37-
// Decoding result: ['foo' => 'bar']
38-
$codecManager->decode(MediaType::UrlEncoded, 'foo=bar');
39-
```
40-
41-
### PHP-DI definitions
42-
43-
```php
44-
use DI\ContainerBuilder;
45-
use Sunrise\Coder\CodecManagerInterface;
46-
47-
$containerBuilder = new ContainerBuilder();
48-
$containerBuilder->addDefinition(__DIR__ . '/../vendor/sunrise/coder/resources/definitions/coder.php');
49-
$containerBuilder->addDefinition(__DIR__ . '/../vendor/sunrise/coder/resources/definitions/codecs/json_codec.php');
50-
$containerBuilder->addDefinition(__DIR__ . '/../vendor/sunrise/coder/resources/definitions/codecs/url_encoded_codec.php');
51-
52-
$container = $containerBuilder->build();
53-
54-
// See above for usage examples.
55-
$codecManager = $container->get(CodecManagerInterface::class);
56-
```
57-
58-
## Tests
59-
60-
```bash
61-
composer test
62-
```
5+
- [Documentation](https://dev.sunrise-studio.io/docs/packages/sunrise/coder/)

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"keywords": [
77
"fenric",
88
"sunrise",
9-
"data",
109
"coder",
1110
"encoder",
1211
"decoder",
13-
"serializer"
12+
"serializer",
13+
"deserializer"
1414
],
1515
"authors": [
1616
{

0 commit comments

Comments
 (0)