https://github.com/chubbyphp/chubbyphp-decode-encode
Chubbyphp decode/encode json/jsonx/url-encoded/xml/yaml
https://github.com/chubbyphp/chubbyphp-decode-encode
Last synced: 2 months ago
JSON representation
Chubbyphp decode/encode json/jsonx/url-encoded/xml/yaml
- Host: GitHub
- URL: https://github.com/chubbyphp/chubbyphp-decode-encode
- Owner: chubbyphp
- License: mit
- Created: 2022-05-17T16:35:56.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-03-12T14:09:37.000Z (3 months ago)
- Last Synced: 2025-04-11T22:07:52.801Z (2 months ago)
- Language: PHP
- Size: 85.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chubbyphp-decode-encode
[](https://github.com/chubbyphp/chubbyphp-decode-encode/actions/workflows/ci.yml)
[](https://coveralls.io/github/chubbyphp/chubbyphp-decode-encode?branch=master)
[](https://dashboard.stryker-mutator.io/reports/github.com/chubbyphp/chubbyphp-decode-encode/master)
[](https://packagist.org/packages/chubbyphp/chubbyphp-decode-encode)
[](https://packagist.org/packages/chubbyphp/chubbyphp-decode-encode)
[](https://packagist.org/packages/chubbyphp/chubbyphp-decode-encode)[](https://sonarcloud.io/dashboard?id=chubbyphp_chubbyphp-decode-encode)
[](https://sonarcloud.io/dashboard?id=chubbyphp_chubbyphp-decode-encode)
[](https://sonarcloud.io/dashboard?id=chubbyphp_chubbyphp-decode-encode)
[](https://sonarcloud.io/dashboard?id=chubbyphp_chubbyphp-decode-encode)
[](https://sonarcloud.io/dashboard?id=chubbyphp_chubbyphp-decode-encode)
[](https://sonarcloud.io/dashboard?id=chubbyphp_chubbyphp-decode-encode)
[](https://sonarcloud.io/dashboard?id=chubbyphp_chubbyphp-decode-encode)
[](https://sonarcloud.io/dashboard?id=chubbyphp_chubbyphp-decode-encode)
[](https://sonarcloud.io/dashboard?id=chubbyphp_chubbyphp-decode-encode)
[](https://sonarcloud.io/dashboard?id=chubbyphp_chubbyphp-decode-encode)
[](https://sonarcloud.io/dashboard?id=chubbyphp_chubbyphp-decode-encode)## Description
A simple decode/encode solution for json / jsonx / url-encoded / xml / yaml.
## Requirements
* php: ^8.2
* symfony/yaml: ^5.4.45|^6.4.18|^7.2## Suggest
* chubbyphp/chubbyphp-container: ^2.2
* psr/container: ^1.1.2|^2.0.2## Installation
Through [Composer](http://getcomposer.org) as [chubbyphp/chubbyphp-decode-encode][1].
```sh
composer require chubbyphp/chubbyphp-decode-encode "^1.2"
```## Usage
### Decoder
```php
getContentTypes());
//[
// 'application/json',
// 'application/jsonx+xml',
// 'application/x-www-form-urlencoded',
// 'application/xml',
// 'application/x-yaml'
//]print_r($decoder->decode(
'{"name": "php"}',
'application/json'
));
// ['name' => 'php']
```#### Type Decoder
* [JsonTypeDecoder][3]
* [JsonxTypeDecoder][4]
* [UrlEncodedTypeDecoder][5]
* [XmlTypeDecoder][6]
* [YamlTypeDecoder][7]### Encoder
# Encoder
```php
getContentTypes());
//[
// 'application/json',
// 'application/jsonx+xml',
// 'application/x-www-form-urlencoded',
// 'application/xml',
// 'application/x-yaml'
//]echo $encoder->encode(
['name' => 'php'],
'application/json'
);
// '{"name": "php"}'
```#### Type Encoder
* [JsonTypeEncoder][11]
* [JsonxTypeEncoder][12]
* [UrlEncodedTypeEncoder][13]
* [XmlTypeEncoder][14]
* [YamlTypeEncoder][15]### ServiceFactory
#### chubbyphp-laminas-config-factory
* [DecoderFactory][20]
* [EncoderFactory][21]## Copyright
2025 Dominik Zogg
[1]: https://packagist.org/packages/chubbyphp/chubbyphp-decode-encode
[3]: doc/Decoder/JsonTypeDecoder.md
[4]: doc/Decoder/JsonxTypeDecoder.md
[5]: doc/Decoder/UrlEncodedTypeDecoder.md
[6]: doc/Decoder/XmlTypeDecoder.md
[7]: doc/Decoder/YamlTypeDecoder.md[11]: doc/Encoder/JsonTypeEncoder.md
[12]: doc/Encoder/JsonxTypeEncoder.md
[13]: doc/Encoder/UrlEncodedTypeEncoder.md
[14]: doc/Encoder/XmlTypeEncoder.md
[15]: doc/Encoder/YamlTypeEncoder.md[20]: doc/ServiceFactory/DecoderFactory.md
[21]: doc/ServiceFactory/EncoderFactory.md