Skip to content

Serializer and general bernard questions #407

@ninze

Description

@ninze

Hi,

I am new to this project and I am trying to figure out how message serialization works. I know the default place for questions is usually stack overflow, but currently it doesn't have a bernard tag and I had a feeling that I would need to wait a few months to get an answer there :)

Bernard installed from composer (currently v0.13) comes with Bernard\Serializer\SimpleSerializer class and suggests using symfony or JMS serializers instead. This doc says that currently bernard uses symfony serializer by default.

On the other hand I couldn't find symfony/serializer in composer.json. The Bernard\Serializer namespace is gone and Bernard/Serializer class seems to use json_encode / json_decode. To confuse things even more, Bernard/Serializer is an interface in the latest composer and a class in the latest master branch.

So I figured I should go read the docs again :) This doc says that if I plan to use a custom message class (which I do), then I must provide a normalizer for it. Except there is no such thing in the currently available composer version of bernard.

My questions are:

PHP native serialize() function should be able to handle simple classes like PlainMessage. Why does bernard need complex serializers from symfony or JMS even for the most basic message type?

It seems that 0.x branch (which is installed by default via composer) is many years behind the current master and current documentation is no longer usable for 0.x. Is it generally a good idea to use the current master instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions