Skip to content

Support namespaced classesΒ #33

@jorygeerts

Description

@jorygeerts

This code can only generate PHP serialized strings of classes that are in the root namespace. Most PHP classes aren't in the root namespace though, so it would be useful to be able to somehow "set" the namespace.

Ideally, this would work for both the root struct, and any nested structs. For the root, doing this via a MarshalOption seems to make most sense; for nested structs a tag probably makes more sense (or potentially a hybrid, with a MarshalOption.ClassNamespace that is used for everything, which can be overwritten with a MarshalOption.RootClassNamespace and a php:"namespace=" tag).

If you agree this would be an improvement to this package, I'd be happy to create a PR for it.

As an aside, it would (probably) also solve the actual issue behind #31.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions