Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support namespaced classes #33

Open
jorygeerts opened this issue Aug 26, 2024 · 1 comment
Open

Support namespaced classes #33

jorygeerts opened this issue Aug 26, 2024 · 1 comment

Comments

@jorygeerts
Copy link

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.

@elliotchance
Copy link
Owner

Sure, happy to accept a PR. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@jorygeerts @elliotchance and others