Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1bb11a5
commit 615e228
Showing
26 changed files
with
384 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,5 @@ | ||
# Encoder | ||
|
||
```php | ||
<?php | ||
Use [Encoder][1] from chubbyphp/chubbyphp-decode-encode. | ||
|
||
use Chubbyphp\Serialization\Encoder\Encoder; | ||
use Chubbyphp\Serialization\Encoder\JsonTypeEncoder; | ||
use Chubbyphp\Serialization\Encoder\JsonxTypeEncoder; | ||
use Chubbyphp\Serialization\Encoder\UrlEncodedTypeEncoder; | ||
use Chubbyphp\Serialization\Encoder\XmlTypeEncoder; | ||
use Chubbyphp\Serialization\Encoder\YamlTypeEncoder; | ||
|
||
$encoder = new Encoder([ | ||
new JsonTypeEncoder(), | ||
new JsonxTypeEncoder(), | ||
new UrlEncodedTypeEncoder(), | ||
new XmlTypeEncoder(), | ||
new YamlTypeEncoder() | ||
]); | ||
|
||
print_r($encoder->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"}' | ||
``` | ||
[1]: https://github.com/chubbyphp/chubbyphp-decode-encode/blob/master/doc/Encoder/Encoder.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
# JsonTypeEncoder | ||
|
||
```php | ||
<?php | ||
Use [JsonTypeEncoder][1] from chubbyphp/chubbyphp-decode-encode. | ||
|
||
use Chubbyphp\Serialization\Encoder\JsonTypeEncoder; | ||
|
||
$encoderType = new JsonTypeEncoder(); | ||
|
||
echo $encoderType->getContentType(); | ||
// 'application/json' | ||
|
||
echo $encoderType->encode(['name' => 'php']); | ||
// '{"name": "php"}' | ||
``` | ||
[1]: https://github.com/chubbyphp/chubbyphp-decode-encode/blob/master/doc/Encoder/JsonTypeEncoder.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
# JsonxTypeEncoder | ||
|
||
```php | ||
<?php | ||
Use [JsonxTypeEncoder][1] from chubbyphp/chubbyphp-decode-encode. | ||
|
||
use Chubbyphp\Serialization\Encoder\JsonxTypeEncoder; | ||
|
||
$encoderType = new JsonxTypeEncoder(); | ||
|
||
echo $encoderType->getContentType(); | ||
// 'application/jsonx+xml' | ||
|
||
echo $encoderType->encode(['name' => 'php']); | ||
// '<json:object><json:string name="name">php</json:string></json:object>' | ||
``` | ||
[1]: https://github.com/chubbyphp/chubbyphp-decode-encode/blob/master/doc/Encoder/JsonxTypeEncoder.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
# UrlEncodedTypeEncoder | ||
|
||
```php | ||
<?php | ||
Use [UrlEncodedTypeEncoder][1] from chubbyphp/chubbyphp-decode-encode. | ||
|
||
use Chubbyphp\Serialization\Encoder\UrlEncodedTypeEncoder; | ||
|
||
$encoderType = new UrlEncodedTypeEncoder(); | ||
|
||
echo $encoderType->getContentType(); | ||
// 'application/x-www-form-urlencoded' | ||
|
||
echo $encoderType->encode(['name' => 'php']); | ||
// 'name=php' | ||
``` | ||
[1]: https://github.com/chubbyphp/chubbyphp-decode-encode/blob/master/doc/Encoder/UrlEncodedTypeEncoder.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
# XmlTypeEncoder (alias for Jsonx) | ||
# XmlTypeEncoder | ||
|
||
```php | ||
<?php | ||
Use [XmlTypeEncoder][1] from chubbyphp/chubbyphp-decode-encode. | ||
|
||
use Chubbyphp\Serialization\Encoder\XmlTypeEncoder; | ||
|
||
$encoderType = new XmlTypeEncoder(); | ||
|
||
echo $encoderType->getContentType(); | ||
// 'application/xml' | ||
|
||
echo $encoderType->encode(['name' => 'php']); | ||
// '<json:object><json:string name="name">php</json:string></json:object>' | ||
``` | ||
[1]: https://github.com/chubbyphp/chubbyphp-decode-encode/blob/master/doc/Encoder/XmlTypeEncoder.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
# YamlTypeEncoder | ||
|
||
```php | ||
<?php | ||
Use [YamlTypeEncoder][1] from chubbyphp/chubbyphp-decode-encode. | ||
|
||
use Chubbyphp\Serialization\Encoder\YamlTypeEncoder; | ||
|
||
$encoderType = new YamlTypeEncoder(); | ||
|
||
echo $encoderType->getContentType(); | ||
// 'application/x-yaml' | ||
|
||
echo $encoderType->encode(['name' => 'php']); | ||
// 'name: php' | ||
``` | ||
[1]: https://github.com/chubbyphp/chubbyphp-decode-encode/blob/master/doc/Encoder/YamlTypeEncoder.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.