Skip to content

v1.2.0

Compare
Choose a tag to compare
@elliotchance elliotchance released this 22 Jan 20:35
· 5 commits to master since this release
Implemented "php" tags for structs (#20)

If you marshal or unmarshal from/into a struct, you may want to use go tags for it, instead of staticly using the struct field names just changing the first letter to upper/lower case.

Example:

    type Target struct {
        FirstName string `php:"vorname"`
        LastName string  `php:"nachname"`
    }

This will correctly be filled with the according fields of serialized php object.
Also unmarshaling will not fail if a struct field does not exist, because you may want to skip some fields from php objects.