Library for (de-)serializing data of any complexity (supports JSON, and XML)

Overview

jms/serializer

Build status

alt text

Introduction

This library allows you to (de-)serialize data of any complexity. Currently, it supports XML and JSON.

It also provides you with a rich tool-set to adapt the output to your specific needs.

Built-in features include:

  • (De-)serialize data of any complexity; circular references and complex exclusion strategies are handled gracefully.
  • Supports many built-in PHP types (such as dates, intervals)
  • Integrates with Doctrine ORM, et. al.
  • Supports versioning, e.g. for APIs
  • Configurable via XML, YAML, or Annotations

Documentation

Learn more about the serializer in its documentation.

Notes

You are browsing the code for the 3.x version, if you are interested in the 1.x or 2.x version, check the 1.x and 2.x branches.

The version 3.x is the supported version (master branch). The 1.x and 2.x versions are not supported anymore.

For the 1.x and 2.x branches there will be no additional feature releases.
Security issues will be fixed till the 1st January 2020 and only critical bugs might receive fixes until the 1st September 2019.

Instructions on how to upgrade to 3.x are available in the UPGRADING document.

Professional Support

For eventual paid support please write an email to [email protected].

Comments
  • Change license to MIT

    Change license to MIT

    In order to change the license on this project, we have to get the approval of every past contributor. At the time of writing this we have had 128 contributors.

    If you are reading this and you are a contributor on the below list, please reply to this GitHub issue with the following text:

    I, @username, agree to license my contributions to the schmittjoh/serializer project from the Apache-2.0 to the MIT license effective immediately.
    
    • [ ] @steveYeah commits code changes, already overwritten in 1.x
    • [x] @emgiezet commits changes part of the serializer-bundle already approved in the bundle MIT migration
    • [x] @wheelsandcogs commits yaml driver improvements, become part of the bundle repo and already approved in the bundle MIT migration
    • [x] @dustin10 commits doc changes, already overwritten in 1.x
    • [x] @armetiz
    • [x] @JustBlackBird
    • [x] @dbu
    • [x] @aviortm
    • [x] @ftassi
    • [x] @helmer
    • [x] @lyrixx
    • [x] @minayaserrano commits form handling improvements
    • [x] @mrosiu
    • [x] @Majkl578 commits
    • [x] @olvlvl
    • [x] @passkey1510
    • [x] @ruimarinho
    • [x] @l3l0
    • [x] @igorw
    • [x] @michelsalib
    • [x] @toby-griffiths
    • [x] @gimler
    • [x] @Soullivaneuh
    • [x] @0mars
    • [x] @dsyph3r
    • [x] @ajgarlag
    • [x] @emilien-puget
    • [x] @scasei
    • [x] @TristanMogwai
    • [x] @Strate
    • [x] @spolischook
    • [x] @ribeiropaulor
    • [x] @richardfullmer
    • [x] @jaymecd
    • [x] @cystbear
    • [x] @tarjei
    • [x] @rande
    • [x] @colinfrei
    • [x] @Potherca
    • [x] @mente
    • [x] @DavidMikeSimon
    • [x] @Lumbendil
    • [x] @wouterj
    • [x] @burki
    • [x] @rothfahl
    • [x] @xanido
    • [x] @holtkamp
    • [x] @gnat42
    • [x] @Nyholm
    • [x] @tvlooy
    • [x] @rpg600
    • [x] @phiamo
    • [x] @mikemix
    • [x] @hyperized
    • [x] @patashnik
    • [x] @romantomchak
    • [x] @gordalina
    • [x] @chasen
    • [x] @dunglas
    • [x] @greg0ire
    • [x] @adrienbrault
    • [x] @stof
    • [x] @tystr
    • [x] @scaytrase
    • [x] @xoob
    • [x] @jhkchan
    • [x] @vicb
    • [x] @xabbuh
    • [x] @bblue
    • [x] @mpajunen
    • [x] @hacfi
    • [x] @lsmith77
    • [x] @yethee
    • [x] @anyx
    • [x] @jonotron
    • [x] @ruudk
    • [x] @Aliance
    • [x] @robocoder
    • [x] @andy-morgan
    • [x] @tmilos
    • [x] @leonnleite
    • [x] @urakozz
    • [x] @develth
    • [x] @AlexKovalevych
    • [x] @smurfy
    • [x] @zerkms
    • [x] @tyler-sommer
    • [x] @bobvandevijver
    • [x] @veloxy
    • [x] @prosalov
    • [x] @goetas
    • [x] @schmittjoh
    • [x] @chregu
    • [x] @alcalyn
    • [x] @fdyckhoff
    • [x] @megazoll
    • [x] @bburnichon
    • [x] @akoebbe
    • [x] @dragosprotung
    • [x] @rosstuck
    • [x] @josser
    • [x] @Seldaek
    • [x] @jockri
    • [x] @BraisGabin
    • [x] @Bukashk0zzz
    • [x] @arghav
    • [x] @scrutinizer-auto-fixer (@schmittjoh bot)
    • [x] @bertterheide
    • [x] @chrisjohnson00
    • [x] @jeserkin
    • [x] @c0ntax
    • [x] @aledeg
    • [x] @guilhermeblanco
    • [x] @willdurand
    • [x] @HarmenM
    • [x] @carusogabriel
    • [x] @iambrosi
    • [x] @zebraf1
    • [x] @jgendera
    • [x] @enumag
    • [x] @kriswallsmith
    • [x] @LeaklessGfy
    • [x] @marcospassos
    • [x] @MDrollette
    • [x] @inanimatt
    • [x] @JMSBot (@schmittjoh bot)
    • [x] @mvanmeerbeck
    • [x] @colinmorelli
    enhancement 
    opened by goetas 129
  • Generate namespaced element on XmlList entries

    Generate namespaced element on XmlList entries

    Things done with this patch:

    • Merged #237
    • Added documentation for #237
    • @XmlNamespace(uri="http://example.com/namespace") acts as default namespace
    • XmlDeserializationVisitor
      • Removed a lot of XPath stuff in flavor of simpler SimpleXMLElement::children method
      • Added $objectMetadataStack to access class metadata from a property
    • XmlSerializationVisitor
      • Removed unnecessary element prefixing when the document/node default namespace match the desired namesapce
      • Removed some duplicated code, adding createElement and setAttributeOnNode methods
    opened by goetas 41
  • Adds XML namespaces support

    Adds XML namespaces support

    I've tried to implement the XML namespaces support for serialization and deserialization.

    Please, review it if you can and tell me what you think about.

    opened by ajgarlag 40
  • Add metadata informations

    Add metadata informations

    Hi, I'm using jms serializer (bundle) in a symfony project. For now, I'm serializing an array of object and it's all ok.

    [
    {"prop": "value"},
    {"prop": "value"},
    {"prop": "value"}
    ]
    

    But I need to add information about the pagination (I fetch data with doctrine) to end up to have a json like this:

    [
    "meta": {"page": 2, "total": 3, "per_page": 2},
    "results": [
       {"prop": "value"},
       {"prop": "value"},
       {"prop": "value"}
       ]
    ]
    

    As you can see, I need to add the informations about total items, current pagination page and the number of the elements in the page.

    I have created a PostSerializationSubscriber that implements JMS\Serializer\EventDispatcher\EventSubscriberInterface and I have implemented the getSubscribedEvents() method like this:

        public static function getSubscribedEvents()
        {
            return [
                [
                    'event' => 'serializer.post_serialize',
                    'method' => 'onPostSerialize'
                ],
            ];
        }
    

    how can I edit my serialized object in onPostSerialize() method?

        public function onPostSerialize(ObjectEvent $postSerializeEvent)
        {
            $postSerializeEvent->getContext()->getVisitor()->addData('someKey','someValue');
        }
    

    The code below, add 'someKey','someValue' for each elements... but it is not what I want

    Thanks

    opened by matiux 32
  • Handle array format for dateHandler

    Handle array format for dateHandler

    | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Doc updated | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT

    enhancement 
    opened by VincentLanglet 30
  • Serialization of nested polymorphic objects

    Serialization of nested polymorphic objects

    Serializer has trouble with nested objects of polymorphic types; it serializes them as their stated base type in an annotation, rather than their real type.

    This PR adds tests which exhibit this bug, then adds an additional pre-serialize event subscriber that corrects the issue.

    opened by DavidMikeSimon 30
  • Allow Constructed Object to be Passed to Deserialize

    Allow Constructed Object to be Passed to Deserialize

    It doesn't appear that there's a way to give an already constructed object to the deserialize method (in which case the serializer would just skip the object construction phase and begin mapping properties).

    My use case is simple: In a REST API, I want to allow a user to create or update objects. Each type of operation (create, update, delete, read) has a different set of security rules. However, with the current implementation of the deserializer (in which we are using the Doctrine object constructor), the user can issue a create request, but specify an "id" as part of the payload. The Doctrine object constructor will then return a mapped entity before deserialization begins, allowing the end user to perform an update (while the server still thinks it's doing a create).

    Also, on this point: I was considering making a separate object constructor - but I need to give some attributes to the object constructor on each use (such as the ID which it should construct an object for). Right now, the only way to get those attributes to the deserializer is to include them in the payload string that gets passed to it - which is precisely what I'd like to avoid.

    There are ways to handle this in the actual REST endpoint, but none of them are really ideal.What I'd like to be able to do is pass an already-constructed object (which my REST endpoint will handle fetching) to the deserializer and just have it do it's property mapping onto the object. This way, I can always pass a blank object in create calls, while I can pass a constructed object in update calls.

    Would this be possible? I could submit a PR if this is something you'd be willing to implement.

    opened by cmorelli 28
  • Resolve collections from DocBlock

    Resolve collections from DocBlock

    | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Doc updated | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | https://github.com/schmittjoh/serializer/issues/1208 | License | MIT

    There are few things worth discussion:

    1. What should happen, when incorrect DocBlock type is given?

      /**
      * @var \stdClass
      */
      public array $productIds;
      

    Current implementation will throw exception, as above has no sense

    1. What should happen, when union type is given?

       /**
       * @var ProductName[]|ProductDescription[]
       */
      public array $productIds;
      

    Current implementation will throw exception, as we will not know, which class should be used for deserialization.

    1. What should happen, when class does not exists?

       /**
       * @var NotExistingClass[]
       */
      public array $productIds;
      

    Current implementation will throw exception as, this class will not be deserializable.

    1. If exception is thrown in any case of 1) and 2) 3) what exception type it should be?

    Current implementation will throw \InvalidArgumentException

    opened by dgafka 19
  • added option to decide to make the deserialisation strict or not

    added option to decide to make the deserialisation strict or not

    Serializer requires an type attribute to be able to deserialize data when a discriminator map is used. this makes not always sense if the filed only contains a referenced id to an existing object. This option enables to set the strict type checking to true/false on the discriminator map.

    Related to https://github.com/schmittjoh/JMSSerializerBundle/issues/292

    Feature Request to review 
    opened by tspycher 19
  • Add DateTimeImmutable support to DateHandler

    Add DateTimeImmutable support to DateHandler

    Hello The actual DateHandler support DateTime and DateInterval types. Would you consider adding DateTimeImmutable support for this handler ? I can do a Pr if you like the idea.

    Regards,

    @mathroc

    enhancement 
    opened by wI2L 19
  • The sub-class

    The sub-class "Proxy-Class" is not listed in the discriminator of the base class "DiscriminatorClass"

    I have a strange Problem here,

    im getting this Error on serialization:

    [LogicException]
    The sub-class "Dl\DomainModel\Proxies\__CG__\Dl\Component\DomainModel\Product\Attribute\EntityAttribute" is not listed in the discriminator of the base class "Dl\Component\DomainModel\Product\Attribute\AbstractAttribute".
    

    it happens during serialization:

     [file]: string (57) "/www/vendor/jms/metadata/src/Metadata/MetadataFactory.php"
     [line]: int 150
     [function]: string (5) "merge"
     [class]: string (37) "JMS\Serializer\Metadata\ClassMetadata"
     [type]: string (2) "->"
     [args]: array (1)
      · [0]: object(JMS\Serializer\Metadata\ClassMetadata)
    
     [1]: array (6)
     [file]: string (57) "/www/vendor/jms/metadata/src/Metadata/MetadataFactory.php"
     [line]: int 105
     [function]: string (16) "addClassMetadata"
     [class]: string (24) "Metadata\MetadataFactory"
     [type]: string (2) "->"
     [args]: array (2)
      · [0]: object(JMS\Serializer\Metadata\ClassMetadata)
      · [1]: object(JMS\Serializer\Metadata\ClassMetadata)
    
     [2]: array (6)
     [file]: string (64) "/www/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php"
     [line]: int 188
     [function]: string (19) "getMetadataForClass"
     [class]: string (24) "Metadata\MetadataFactory"
     [type]: string (2) "->"
     [args]: array (1)
      · [0]: string (88) "Dl\DomainModel\Proxies\__CG__\Dl\Component\DomainModel\Product\Attribute\EntityAttribute"
    
     [3]: array (6)
     [file]: string (77) "/www/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php"
     [line]: int 140
     [function]: string (6) "accept"
     [class]: string (29) "JMS\Serializer\GraphNavigator"
     [type]: string (2) "->"
     [args]: array (3)
      · [0]: object(Dl\DomainModel\Proxies\__CG__\Dl\Component\DomainModel\Product\Attribute\EntityAttribute)
      · [1]: array (2)
      ·  · [name]: string (88) "Dl\DomainModel\Proxies\__CG__\Dl\Component\DomainModel\Product\Attribute\EntityAttribute"
      ·  · [params]: array (0)
    
      · [2]: object(JMS\Serializer\SerializationContext)
    
     [4]: array (6)
     [file]: string (64) "/www/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php"
     [line]: int 235
     [function]: string (13) "visitProperty"
     [class]: string (42) "JMS\Serializer\GenericSerializationVisitor"
     [type]: string (2) "->"
     [args]: array (3)
      · [0]: object(JMS\Serializer\Metadata\PropertyMetadata)
      · [1]: object(Dl\Component\DomainModel\Partner\UnmatchedValue)
      · [2]: object(JMS\Serializer\SerializationContext)
    
     [5]: array (6)
     [file]: string (77) "/www/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php"
     [line]: int 102
     [function]: string (6) "accept"
     [class]: string (29) "JMS\Serializer\GraphNavigator"
     [type]: string (2) "->"
     [args]: array (3)
      · [0]: object(Dl\Component\DomainModel\Partner\UnmatchedValue)
      · [1]: array (2)
      ·  · [name]: string (47) "Dl\Component\DomainModel\Partner\UnmatchedValue"
      ·  · [params]: array (0)
    
      · [2]: object(JMS\Serializer\SerializationContext)
    
     [6]: array (6)
     [file]: string (74) "/www/vendor/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php"
     [line]: int 55
     [function]: string (10) "visitArray"
     [class]: string (42) "JMS\Serializer\GenericSerializationVisitor"
     [type]: string (2) "->"
     [args]: array (3)
      · [0]: object(Dl\Component\Helpers\DataType\ArrayCollection)
      · [1]: array (2)
      ·  · [name]: string (5) "array"
      ·  · [params]: array (1)
      ·  ·  · [0]: array (2)
      ·  ·  ·  · [name]: string (47) "Dl\Component\DomainModel\Partner\UnmatchedValue"
      ·  ·  ·  · [params]: array (0)
    
      · [2]: object(JMS\Serializer\SerializationContext)
    
     [7]: array (6)
     [file]: string (64) "/www/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php"
     [line]: int 129
     [function]: string (10) "visitArray"
     [class]: string (39) "JMS\Serializer\JsonSerializationVisitor"
     [type]: string (2) "->"
     [args]: array (3)
      · [0]: object(Dl\Component\Helpers\DataType\ArrayCollection)
      · [1]: array (2)
      ·  · [name]: string (5) "array"
      ·  · [params]: array (1)
      ·  ·  · [0]: array (2)
      ·  ·  ·  · [name]: string (47) "Dl\Component\DomainModel\Partner\UnmatchedValue"
      ·  ·  ·  · [params]: array (0)
    
      · [2]: object(JMS\Serializer\SerializationContext)
    
     [8]: array (6)
     [file]: string (77) "/www/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php"
     [line]: int 140
     [function]: string (6) "accept"
     [class]: string (29) "JMS\Serializer\GraphNavigator"
     [type]: string (2) "->"
     [args]: array (3)
      · [0]: object(Dl\Component\Helpers\DataType\ArrayCollection)
      · [1]: array (2)
      ·  · [name]: string (5) "array"
      ·  · [params]: array (1)
      ·  ·  · [0]: array (2)
      ·  ·  ·  · [name]: string (47) "Dl\Component\DomainModel\Partner\UnmatchedValue"
      ·  ·  ·  · [params]: array (0)
    
      · [2]: object(JMS\Serializer\SerializationContext)
    
     [9]: array (6)
     [file]: string (64) "/www/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php"
     [line]: int 235
     [function]: string (13) "visitProperty"
     [class]: string (42) "JMS\Serializer\GenericSerializationVisitor"
     [type]: string (2) "->"
     [args]: array (3)
      · [0]: object(JMS\Serializer\Metadata\PropertyMetadata)
      · [1]: object(Dl\Import\Task\PersistTask)
      · [2]: object(JMS\Serializer\SerializationContext)
    
     [10]: array (6)
     [file]: string (60) "/www/vendor/jms/serializer/src/JMS/Serializer/Serializer.php"
     [line]: int 176
     [function]: string (6) "accept"
     [class]: string (29) "JMS\Serializer\GraphNavigator"
     [type]: string (2) "->"
     [args]: array (3)
      · [0]: object(Dl\Import\Task\PersistTask)
      · [1]: array (2)
      ·  · [name]: string (26) "Dl\Import\Task\PersistTask"
      ·  · [params]: array (0)
    
      · [2]: object(JMS\Serializer\SerializationContext)
    
     [11]: array (6)
     [file]: string (60) "/www/vendor/jms/serializer/src/JMS/Serializer/Serializer.php"
     [line]: int 82
     [function]: string (5) "visit"
     [class]: string (25) "JMS\Serializer\Serializer"
     [type]: string (2) "->"
     [args]: array (4)
      · [0]: object(JMS\Serializer\JsonSerializationVisitor)
      · [1]: object(JMS\Serializer\SerializationContext)
      · [2]: object(Dl\Import\Task\PersistTask)
      · [3]: string (4) "json"
    
     [12]: array (2)
     [function]: string (44) "Closure$JMS\Serializer\Serializer::serialize"
     [args]: array (1)
      · [0]: object(JMS\Serializer\JsonSerializationVisitor)
    
     [13]: array (4)
     [file]: string (54) "/www/vendor/phpoption/phpoption/src/PhpOption/Some.php"
     [line]: int 89
     [function]: string (14) "call_user_func"
     [args]: array (2)
      · [0]: object(Closure$JMS\Serializer\Serializer::serialize;1748757503)
      · [1]: object(JMS\Serializer\JsonSerializationVisitor)
    
     [14]: array (6)
     [file]: string (60) "/www/vendor/jms/serializer/src/JMS/Serializer/Serializer.php"
     [line]: int 85
     [function]: string (3) "map"
     [class]: string (14) "PhpOption\Some"
     [type]: string (2) "->"
     [args]: array (1)
      · [0]: object(Closure$JMS\Serializer\Serializer::serialize;1748757503)
    
    

    anyone have a clue why this occurs?

    opened by digitalkaoz 19
  • Allow doctrine/annotations 2.0

    Allow doctrine/annotations 2.0

    | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Doc updated | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT

    This will allow using the doctrine/annotations package's 2.x release with the serializer. The only B/C issue in https://github.com/doctrine/annotations/blob/2.0.x/UPGRADE.md that looks to impact this package was already addressed by #1447 so there shouldn't be any other problems.

    opened by mbabker 0
  • Handle constructor property promotion

    Handle constructor property promotion

    This PR handles constructor property promotion for docblock type resolver.

    | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Doc updated | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT

    opened by dgafka 0
  • Handle phpstan array shapes

    Handle phpstan array shapes

    This PR provides possibility to serialize and deserialize phpstan array shapes.

    As no matter of the structure JMS can handle arrays, instead of throwing exception when we meet phpstan array shape, we can simply serialize it as array.

    | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Doc updated | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT

    opened by dgafka 0
  • add php 8.1 enum support

    add php 8.1 enum support

    | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Doc updated | yes | BC breaks? | maybe?? | Deprecations? | no | Tests pass? | yes | Fixed tickets | #1393 #1392 #1373 | License | MIT

    opened by goetas 0
  • feat: Implement PHPStan lvl 2

    feat: Implement PHPStan lvl 2

    | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Doc updated | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT

    Bump code style to PHPStan lvl 2. Improved types whenever it was possible. Enabled only for PHP8.1. PHP 8.0 and PHP 7.4 still uses lvl 1.

    opened by scyzoryck 0
  • Fix typo in annotations doc

    Fix typo in annotations doc

    | Q | A | ------------- | --- | Bug fix? |no | New feature? |no | Doc updated | yes | BC breaks? |no | Deprecations? |no | Tests pass? | yes | License | MIT

    opened by qdequippe 0
Releases(3.18.2)
  • 3.18.2(Sep 12, 2022)

    What's Changed

    • Define method for the FormInterface type in the FormErrorHandler by @Spea in https://github.com/schmittjoh/serializer/pull/1432

    New Contributors

    • @Spea made their first contribution in https://github.com/schmittjoh/serializer/pull/1432

    Full Changelog: https://github.com/schmittjoh/serializer/compare/3.18.1...3.18.2

    Source code(tar.gz)
    Source code(zip)
  • 3.18.1(Aug 24, 2022)

    What's Changed

    • if groups are nested arrays, do not use them for checking paths by @goetas in https://github.com/schmittjoh/serializer/pull/1427
    • Fixed "PHP 8 support" header in annotations documentation by @friek in https://github.com/schmittjoh/serializer/pull/1425

    New Contributors

    • @friek made their first contribution in https://github.com/schmittjoh/serializer/pull/1425

    Full Changelog: https://github.com/schmittjoh/serializer/compare/3.18.0...3.18.1

    Source code(tar.gz)
    Source code(zip)
  • 3.18.0(Aug 6, 2022)

    What's Changed

    • Fix deprecation by @ruudk in https://github.com/schmittjoh/serializer/pull/1386
    • Handle union types for typed properties and docblocks by @dgafka in https://github.com/schmittjoh/serializer/pull/1330
    • Split visitorsAdded flag by @simPod in https://github.com/schmittjoh/serializer/pull/1400
    • Add support for list<T> by @simPod in https://github.com/schmittjoh/serializer/pull/1354
    • Test bool type for null in Serialization tests by @simPod in https://github.com/schmittjoh/serializer/pull/1399
    • Fix #1396 by @niconoe- in https://github.com/schmittjoh/serializer/pull/1397
    • Cleanup FirstClassMapCollection fixture by @simPod in https://github.com/schmittjoh/serializer/pull/1402
    • Fixed decimal type mapping to match the actual type from doctrine by @LANGERGabrielle in https://github.com/schmittjoh/serializer/pull/1398
    • Fix cs by @simPod in https://github.com/schmittjoh/serializer/pull/1409
    • Fix compatibility of ReadOnly annotation for PHP8.1 by @simPod in https://github.com/schmittjoh/serializer/pull/1410
    • Add PHP8.2 tests by @scyzoryck in https://github.com/schmittjoh/serializer/pull/1418
    • Fixed decimal type mapping to match the actual type from doctrine by @LANGERGabrielle in https://github.com/schmittjoh/serializer/pull/1411
    • Add a handler supporting symfony/uid by @mbabker in https://github.com/schmittjoh/serializer/pull/1391
    • Introduce strict deserializer visitor by @simPod in https://github.com/schmittjoh/serializer/pull/1401
    • Feature/uninitialize property exception by @pag1903 in https://github.com/schmittjoh/serializer/pull/1408
    • Fix deserialization not initializing properties when they have a default value and the field is not found in the payload by @joaojacome in https://github.com/schmittjoh/serializer/pull/1417

    New Contributors

    • @niconoe- made their first contribution in https://github.com/schmittjoh/serializer/pull/1397
    • @LANGERGabrielle made their first contribution in https://github.com/schmittjoh/serializer/pull/1398
    • @pag1903 made their first contribution in https://github.com/schmittjoh/serializer/pull/1408
    • @joaojacome made their first contribution in https://github.com/schmittjoh/serializer/pull/1417

    Full Changelog: https://github.com/schmittjoh/serializer/compare/3.17.1...3.18.0

    Source code(tar.gz)
    Source code(zip)
  • 3.17.1(Dec 28, 2021)

    What's Changed

    • Fix exclusions for max depth 0 by @scyzoryck in https://github.com/schmittjoh/serializer/pull/1383

    Full Changelog: https://github.com/schmittjoh/serializer/compare/3.17.0...3.17.1

    Source code(tar.gz)
    Source code(zip)
  • 3.17.0(Dec 14, 2021)

    What's Changed

    • Improve static analyzability of example deseralisation code. by @bdsl in https://github.com/schmittjoh/serializer/pull/1368
    • Run full tests for php8.1 and static analytics by @scyzoryck in https://github.com/schmittjoh/serializer/pull/1370
    • Improve performance of max depth exclusions by @scyzoryck in https://github.com/schmittjoh/serializer/pull/1369
    • Add |null for nullable properties by @VincentLanglet in https://github.com/schmittjoh/serializer/pull/1372
    • Move fixture to correct directory by @scyzoryck in https://github.com/schmittjoh/serializer/pull/1374
    • added return native types for AttributeReader by @maikelohcfg in https://github.com/schmittjoh/serializer/pull/1378
    • Composer > Define allowed plugins by @ruudk in https://github.com/schmittjoh/serializer/pull/1379

    New Contributors

    • @maikelohcfg made their first contribution in https://github.com/schmittjoh/serializer/pull/1378

    Full Changelog: https://github.com/schmittjoh/serializer/compare/3.16.0...3.17.0

    Source code(tar.gz)
    Source code(zip)
  • 3.16.0(Nov 22, 2021)

    What's Changed

    • Fix CS and lock to v7.2 by @simPod in https://github.com/schmittjoh/serializer/pull/1353
    • Precision float by @re2bit in https://github.com/schmittjoh/serializer/pull/1359
    • Update phpstan to 1.0.2 by @scyzoryck in https://github.com/schmittjoh/serializer/pull/1363
    • add support for persistent collections so orphan removal works by @re2bit in https://github.com/schmittjoh/serializer/pull/1357
    • PHP 8.1 deprecations by @W0rma in https://github.com/schmittjoh/serializer/pull/1360
    • Accept FormInterface instead of Form in FormErrorHandler by @W0rma in https://github.com/schmittjoh/serializer/pull/1362
    • Fix PHP 8.1 pipeline by @W0rma in https://github.com/schmittjoh/serializer/pull/1364
    • Use jms/metadata 2.6 to start using the new serialization strategy by @goetas in https://github.com/schmittjoh/serializer/pull/1366
    • Add performnace benchmarks by @scyzoryck in https://github.com/schmittjoh/serializer/pull/1365

    New Contributors

    • @W0rma made their first contribution in https://github.com/schmittjoh/serializer/pull/1360

    Full Changelog: https://github.com/schmittjoh/serializer/compare/3.15.0...3.16.0

    Source code(tar.gz)
    Source code(zip)
  • 3.15.0(Oct 14, 2021)

  • 3.14.0(Aug 6, 2021)

  • 3.14.0-rc2(Aug 6, 2021)

  • 3.14.0-rc1(Aug 1, 2021)

  • 3.13.0(Jul 5, 2021)

  • 3.12.3(Apr 25, 2021)

  • 3.12.2(Mar 23, 2021)

  • 3.12.1(Mar 21, 2021)

  • 3.12.0(Mar 4, 2021)

  • 3.11.0(Dec 29, 2020)

  • 3.10.0(Oct 29, 2020)

  • 3.9.0(Aug 26, 2020)

    Implemented enhancements:

    • Add support for skippable (de)serialization handlers #1238 (bobvandevijver)
    • added support for milliseconds in DateInterval deserialization #1234 (ivoba)

    Fixed bugs:

    • Do not load entities when deserializing if their identifier is not ex… #1247 (goetas)
    • Do not use excluded fields when fetching entities #1246 (goetas)
    • Ensure accessors are cached per property when using reflection #1237 (goetas)

    Merged pull requests:

    Source code(tar.gz)
    Source code(zip)
  • 3.8.0(Jun 28, 2020)

  • 3.7.0(May 23, 2020)

    Implemented enhancements:

    • Allow deserialization of typehinted DateTimeInterface to DateTime class #1193 (goetas)
    • Infer types from PHP 7.4 type declarations #1192 (goetas)
    • Support conditional exclude for classes #1099 (arneee)

    Fixed bugs:

    • Exclude if at class level are not merge #1203
    • Class level expression exclusion strategy should work with hierarchies #1204 (goetas)

    Merged pull requests:

    Source code(tar.gz)
    Source code(zip)
  • 3.6.0(Mar 21, 2020)

  • 3.5.0(Feb 22, 2020)

  • 1.14.1(Feb 22, 2020)

  • 3.4.0(Dec 14, 2019)

    3.4.0 (2019-12-14)

    Implemented enhancements:

    Closed issues:

    • [Improvement] Ability to define a global exclusion_policy: ALL for all classes. #1144
    • Embed JSON string without extra escape #1142
    • Make possible to set ArrayCollectionHandler classes from outside #1131

    Merged pull requests:

    Source code(tar.gz)
    Source code(zip)
  • 3.3.0(Sep 20, 2019)

    Implemented enhancements:

    • Implement short expose syntax for XML as it is available for YAML #1127 (goetas)

    Fixed bugs:

    • Avoid implicit expose of a property instead of virtual-property #1126 (goetas)

    Closed issues:

    • Accessing static property as non static #1122
    • Travis builds on 1.x are failing #1120

    Merged pull requests:

    • Allow failures on php "7.4snapshot" (waiting for stable symfony 4.4) #1128 (goetas)
    • Fix PHPUnit deprecations #1123 (Majkl578)
    • Test 1.x on PHP 7.3 on Travis; fix builds for PHP 5.5 #1119 (sanmai)
    Source code(tar.gz)
    Source code(zip)
  • 3.2.0(Sep 4, 2019)

    Fixed bugs:

    • PHP7.4: Deprecated warning - serializationContext.php on line 152 #1111

    Closed issues:

    • StaticPropertyMetadata first constructor argument not nullable #1116
    • Add support for PSR-7 URIInterface objects #1115
    • Upgraded 2.4 -> 3.4 / Symfony 4.3.3 #1112
    • Empty namespace #1087
    • Format constants (JSON, XML) #1079
    • @ExclusionPolicy(policy="ALL") causes PHP notice message #1073

    Merged pull requests:

    Source code(tar.gz)
    Source code(zip)
  • 3.1.1(Jun 28, 2019)

  • 3.1.0(Jun 25, 2019)

    Implemented enhancements:

    Fixed bugs:

    • Fix for failing doctrine object constructor on embeddable class #1031 (notrix)

    Closed issues:

    • Behavior serializeNull -> not always honored in 2.* (but was in 1.*) #1101
    • Support for iterable #1094
    • Prevent deserialisation with missing required field #1090
    • Allow using @XmlValue together with @Accessor/@AccessType #1083
    • Support *.yaml extension #1077

    Merged pull requests:

    Source code(tar.gz)
    Source code(zip)
  • 3.0.1(Apr 23, 2019)

  • 3.0.0(Apr 23, 2019)

    Upgrade notes

    How to upgrade to 3.0.0 is explained in https://github.com/schmittjoh/serializer/blob/master/UPGRADING.md

    • Upgrading from 2.x to 3.0 should require almost no effort as only one changes introduced in 2.x has been reverted as it was in 1.x
    • Upgrading from 1.x to 3.0 requires to follow the same steps as the upgrade from 1.x to 2.x, skipping only the "deeper branch group exclusion strategy"

    Detailed changes:

    Backward incompatible changes:

    • Revert v2 nested groups and release 3.0 #1071 (goetas)

    Implemented enhancements:

    Merged pull requests:

    Closed issues:

    • [RFC] revert #946 and release new major #1058
    Source code(tar.gz)
    Source code(zip)
:lipstick: Scalable and durable all-purpose data import library for publishing APIs and SDKs.

Porter Scalable and durable data imports for publishing and consuming APIs Porter is the all-purpose PHP data importer. She fetches data from anywhere

null 594 Jan 1, 2023
Map nested JSON structures onto PHP classes

JsonMapper - map nested JSON structures onto PHP classes Takes data retrieved from a JSON web service and converts them into nested object and arrays

Christian Weiske 1.4k Dec 30, 2022
JsonMapper - map nested JSON structures onto PHP classes

Takes data retrieved from a JSON web service and converts them into nested object and arrays - using your own model classes.

Netresearch 9 Aug 21, 2022
A repository with implementations of different data structures and algorithms using PHP

PHP Data Structures and Algorithms Data structure and Algorithm is always important for any programming language. PHP, being one of the most popular l

Mizanur Rahman 610 Jan 2, 2023
Output complex, flexible, AJAX/RESTful data structures.

Fractal Fractal provides a presentation and transformation layer for complex data output, the like found in RESTful APIs, and works really well with J

The League of Extraordinary Packages 3.5k Jan 8, 2023
Changeset calculator between two states of a data

Totem \\\\//// |.)(.| | || | Changeset calculator between two state of a data \(__)/ Requires PHP 5.4 ; Compatible

Wisembly 75 May 6, 2021
Missing data types for PHP. Highly extendable.

Neverending data validation can be exhausting. Either you have to validate your data over and over again in every function you use it, or you have to rely it has already been validated somewhere else and risk potential problems.

SmartEmailing 82 Nov 11, 2022
A Collections library for PHP.

A Library of Collections for OO Programming While developing and helping others develop PHP applications I noticed the trend to use PHP's arrays in ne

Levi Morrison 629 Nov 20, 2022
PHP Integrated Query, a real LINQ library for PHP

PHP Integrated Query - Official site What is PINQ? Based off the .NET's LINQ (Language integrated query), PINQ unifies querying across arrays/iterator

Elliot Levin 465 Dec 30, 2022
🗃 Array manipulation library for PHP, called Arrayy!

?? Arrayy A PHP array manipulation library. Compatible with PHP 7+ & PHP 8+ \Arrayy\Type\StringCollection::create(['Array', 'Array'])->unique()->appen

Lars Moelleken 430 Jan 5, 2023
[READ-ONLY] Collection library in CakePHP. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

CakePHP Collection Library The collection classes provide a set of tools to manipulate arrays or Traversable objects. If you have ever used underscore

CakePHP 85 Nov 28, 2022
Collections Abstraction library for PHP

Collections Collections Abstraction library for PHP The Collection library is one of the most useful things that many modern languages has, but for so

Ítalo Vietro 62 Dec 27, 2021
CRUDlex is an easy to use CRUD generator for Symfony 4 and Silex 2 which is great for auto generated admin pages

CRUDlex CRUDlex is an easy to use, well documented and tested CRUD generator for Symfony 4 and Silex 2. It is very useful to generate admin pages for

Philip 108 Jun 30, 2022
Leetcode for PHP, five questions a week and weekends are updated irregularly

✏️ Leetcode for PHP why do you have to sleep for a long time ,and naturally sleep after death 联系 说明 由于目前工作主要是 golang,我又新起了一个LeetCode-Go-Week项目,- Leetc

吴亲库里 370 Dec 29, 2022
True asynchronous PHP I/O and HTTP without frameworks, extensions, or annoying code. Uses the accepted Fibers RFC to be implemented into PHP 8.1

PHP Fibers - Async Examples Without External Dependencies True asynchronous PHP I/O and HTTP without frameworks, extensions, or annoying code behemoth

Cole Green 121 Jan 6, 2023
Best FlexForm based content elements since 2012. With TCA mapping feature, simple backend view and much more features which makes it super easy to create own content element types.

DCE-Extension for TYPO3 What is DCE? DCE is an extension for TYPO3 CMS, which creates easily and fast dynamic content elements. Based on Extbase, Flui

Armin Vieweg 10 Nov 2, 2022
JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

Eboubaker Eboubaker 2 Jul 31, 2022
Config is a file configuration loader that supports PHP, INI, XML, JSON, YML, Properties and serialized files and string

Config Config is a file configuration loader that supports PHP, INI, XML, JSON, YML, Properties and serialized files and strings. Requirements Config

Hassan Khan 946 Jan 1, 2023
World countries in JSON, CSV, XML and Yaml. Any help is welcome!

World countries in JSON, CSV, XML and YAML. Countries data This repository contains a list of world countries, as defined by ISO Standard 3166-1, in J

Mohammed Le Doze 5.6k Jan 3, 2023