This section describes how Custom PHP can be used to increase platform's flexibility.
This article will:
- explain goals to be achieved
- explain module's architecture
- show how to add Custom PHP to your project
- Provide examples of use cases
Goals to use Custom PHP Module
There are a lot of different purposes on why you could need to use platform's Custom PHP module. The most common are:
- Connect directly to external databases without APIs
- Make complex integrations and logic with any external APIs and Mobsted internal APIs
- Manage and re-factor data arrays, strings, time/dates
- Perform complex operations on your app’s backend, instead of front end
Architecture of the Module - "PHP inside API method":
Custom PHP lives inside a API method, which can be called as any other Mobsted API method to perform needed actions.
This kind of architecture allows the following benefits and flexibility:
- running this code on request from your mobile app’s UI
- running this code as Operation for Filter/Trigger results
- running this code by API call from your outside system
Adding "Custom PHP" module:
3. Select Custom PHP method (Orange marks 3-6)
4. Name this new Operation - how it will be visible throughout your system. You can have as many of these PHP operations as you need. Just make sure each has a different name.
5. Insert PHP code into TEXT field
6. Optional - add any Variables (key-value pairs), if you want to pass Incoming data to the PHP function.
7. Press - Save operation ( GREEN MARK)
Example of a use case - connecting external DBs
Related articles