Skip to content

Commit

Permalink
Merge pull request #32 from brettminnie/develop
Browse files Browse the repository at this point in the history
Initial 0.1.0 release
  • Loading branch information
brettminnie committed Jul 26, 2015
2 parents 2680a61 + 68256b2 commit 2f20b34
Show file tree
Hide file tree
Showing 44 changed files with 3,436 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea/
vendor/
coverage/
18 changes: 18 additions & 0 deletions .scrutinizer.yml
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]
31 changes: 31 additions & 0 deletions .travis.yml
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;'
59 changes: 58 additions & 1 deletion README.md
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.

14 changes: 8 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "brettminnie/breakfast-serializer",
"type": "library",
"description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML. Replacement with hopeful backwards compatibility with JMS",
"description": "Library for (de-)serializing data of any complexity to JSON",
"keywords": ["serialization", "deserialization", "json", "jaxb", "xml"],
"license": "MIT",
"authors": [
Expand All @@ -11,16 +11,18 @@
}
],
"require": {
"php": ">=5.3.2"
"php": ">=5.5",
"symfony/yaml": "~3.0@dev"
},
"minimum-stability": "dev",
"require-dev": {
"phpunit/phpunit": "~4.0"
"phpunit/phpunit": "4.7.*",
"mockery/mockery": "0.9.*"
},
"autoload": {
"psr-0": {
"BDBStudios\\Serializer": "src/"
"psr-4": {
"BDBStudios\\BreakfastSerializer\\": "src/BreakfastSerializer/",
"BDBStudios\\BreakfastSerializerTest\\": "test/BreakfastSerializer/"
}
}
}

Loading

0 comments on commit 2f20b34

Please sign in to comment.