We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello, first off thank all of you for all the work that goes into this library.
My question is how do I handle or create a resource?
My current workaround is wrapping the resource / pointer in a Php::Base class.
Php::Base
class ResourceWrapper : public Php::Base { private: MyResource *_resource = nullptr; public: ResourceWrapper() : _resource(MyResource()) {} ~ ResourceWrapper() {} inline MyResource *getResource() { return _resource; } };
and then using it like this:
void ClassThatDoesSomethingWithResource::setResource(Php::Parameters ¶meters) { Php::Value object = parameters[0]; if (!object.instanceOf("ResourceWrapper")) throw Php::Exception("First argument must be an instance of ResourceWrapper."); ResourceWrapper *wrapper = (ResourceWrapper *)object.implementation(); MyResource *resource = wrapper->getResource(); }
Is there a more elegant approach to hold the pointer inside PHP?
Many thanks Mario.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello, first off thank all of you for all the work that goes into this library.
My question is how do I handle or create a resource?
My current workaround is wrapping the resource / pointer in a
Php::Base
class.and then using it like this:
Is there a more elegant approach to hold the pointer inside PHP?
Many thanks Mario.
The text was updated successfully, but these errors were encountered: