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.
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
MarshalOptionseems to make most sense; for nested structs atagprobably makes more sense (or potentially a hybrid, with aMarshalOption.ClassNamespacethat is used for everything, which can be overwritten with aMarshalOption.RootClassNamespaceand aphp:"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.