-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from brettminnie/develop
Initial 0.1.0 release
- Loading branch information
Showing
44 changed files
with
3,436 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.idea/ | ||
vendor/ | ||
coverage/ |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
filter: | ||
paths: [src/*, test/*] | ||
excluded_paths: [vendor/*] | ||
before_commands: | ||
- 'composer install --dev --prefer-source' | ||
tools: | ||
external_code_coverage: true | ||
php_mess_detector: true | ||
php_code_sniffer: true | ||
sensiolabs_security_checker: true | ||
php_code_coverage: true | ||
php_pdepend: true | ||
php_loc: | ||
enabled: true | ||
excluded_dirs: [vendor] | ||
php_cpd: | ||
enabled: true | ||
excluded_dirs: [vendor] |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
language: php | ||
|
||
matrix: | ||
allow_failures: | ||
- php: 7.0 | ||
|
||
php: | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
|
||
branches: | ||
only: | ||
- master | ||
- develop | ||
|
||
install: | ||
- composer require satooshi/php-coveralls:~0.6@stable | ||
|
||
before_script: | ||
- composer self-update | ||
- composer install --dev | ||
- mkdir -p build/logs | ||
|
||
script: | ||
vendor/bin/phpunit --coverage-clover build/logs/clover.xml | ||
|
||
after_success: | ||
- wget https://scrutinizer-ci.com/ocular.phar | ||
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml | ||
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php vendor/bin/coveralls -v; fi;' |
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,2 +1,59 @@ | ||
# breakfast-serializer | ||
A (hopefully) backwards compatible replacement for the JMS serializer | ||
|
||
[![Build Status](https://travis-ci.org/brettminnie/breakfast-serializer.svg)](https://travis-ci.org/brettminnie/breakfast-serializer) | ||
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/brettminnie/breakfast-serializer/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/brettminnie/breakfast-serializer/?branch=develop) | ||
[![Dependency Status](https://www.versioneye.com/user/projects/55378b007f43bcd88900033d/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55378b007f43bcd88900033d) | ||
[![Coverage Status](https://coveralls.io/repos/brettminnie/breakfast-serializer/badge.svg?branch=master&service=github)](https://coveralls.io/github/brettminnie/breakfast-serializer?branch=master) | ||
|
||
A replacement for the other well known serializer, initially we were aiming for backwards compatibility, however it seemed | ||
more appropriate to develop a lightweight alternative. We are forgoing the depth of features now to offer something that is | ||
easy to configure and works well without any configuration. | ||
|
||
### Installation | ||
|
||
`$ composer require brettminnie/breakfast-serializer:0.1.*` | ||
|
||
Job done, start enjoying your morning serial! | ||
|
||
### Configuration | ||
|
||
Out the box will do a full depth/breadth recursion and serialize to JSON format, no config is required. It will always | ||
serialize with a variable called `className` attached to the object. This is a fully fledged namespace and is required | ||
to deserialize. If you want to deserialize from JSON data that is missing this variable it needs to be injected into the | ||
object. | ||
|
||
### Supported Serialization Formats | ||
- [x] JSON | ||
- [ ] XML | ||
- [ ] PHP Object Notation | ||
- [ ] YAML | ||
|
||
### Features | ||
- [x] Simple limiting of traversal depth | ||
- [x] Mapping of properties to alternate names and back again | ||
- [x] Excluding of properties from serialization and ignoring them on deserialization | ||
- [x] Simple YAML config format (Yay no slow php annotations!) | ||
|
||
Quick and Dirty Example | ||
```php | ||
|
||
// To retrieve the json representation json of an object | ||
$jsonData = BDBStudios\BreakfastSerializer\SerializerFactory::getSerializer() | ||
->serialize($myClass); | ||
|
||
// To unserialize | ||
$myClass = BDBStudios\BreakfastSerializer\SerializerFactory::getSerializer() | ||
->deserialize($jsonData); | ||
|
||
//To serialize an object with a limited depth recursion (aka only some of it) | ||
$jsonData = | ||
BDBStudios\BreakfastSerializer\SerializerFactory::getSerializer( | ||
BDBStudios\BreakfastSerializer\IsSerializable::FORMAT_JSON, | ||
2 | ||
) | ||
->serialize($myClass); | ||
|
||
``` | ||
|
||
Further examples in the [documentation](documentation/index.md) directory. | ||
|
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.