Hi,
a few days ago I started my adventure with MailWizz so I don't know the MailWizz API very well but I'm learning. I want to use the API to subscribe users automatically using code call from our existing registration system (based on Concrete5 CMS). I created a dry code based on the examples provided with the MailWizz API, I put MailWizz on the server and everything works fine. I am able to subscribe users to lists from my clean, external PHP code without any problems using the provided API & examples on the target server and domain. So everything works fine.
The problem arises as soon as I try to close that code in any namespace, and unfortunately the place where I want to attach this code just forcing me to put it in the CMS namespace by default. When I put code in a namespace then the API stops working. It is enough to add any namespace in the example code file and it cuts it off completely from access to API functions.
I've never used namespaces more extensively in PHP programming, just following the documentation requirements when needed and never with problems. So maybe I omit something unknowingly and the solution is very simple? Is there any way to put the code from the examples in a namespace? Alternatively, how to force PHP to ignore the namespaces of the CMS at the moment when the code is including MailWizz API? Even MailWizz API simplest example code? I don't need anything else to move on. Just run any MailWizz API example in any random php namespace other than none.
Thanks a lot for any suggestions and help.
Kajetan @ NawHQ
a few days ago I started my adventure with MailWizz so I don't know the MailWizz API very well but I'm learning. I want to use the API to subscribe users automatically using code call from our existing registration system (based on Concrete5 CMS). I created a dry code based on the examples provided with the MailWizz API, I put MailWizz on the server and everything works fine. I am able to subscribe users to lists from my clean, external PHP code without any problems using the provided API & examples on the target server and domain. So everything works fine.
The problem arises as soon as I try to close that code in any namespace, and unfortunately the place where I want to attach this code just forcing me to put it in the CMS namespace by default. When I put code in a namespace then the API stops working. It is enough to add any namespace in the example code file and it cuts it off completely from access to API functions.
I've never used namespaces more extensively in PHP programming, just following the documentation requirements when needed and never with problems. So maybe I omit something unknowingly and the solution is very simple? Is there any way to put the code from the examples in a namespace? Alternatively, how to force PHP to ignore the namespaces of the CMS at the moment when the code is including MailWizz API? Even MailWizz API simplest example code? I don't need anything else to move on. Just run any MailWizz API example in any random php namespace other than none.
Thanks a lot for any suggestions and help.
Kajetan @ NawHQ