We have two apps, each with a Customers plugin on the same server.
One app just needs readonly access to the Customers data.
Option 1: So I’m thinking of having two modes for the Customer plugin: master or slave. If slave, then it would have the server details of where to pull the data from, the app with the master Customer plugin. Not sure if CakePHP supports this? Different database sources for models?
Option 2: triggers on the MySQL server to insert/remove from db1.customer to db2.customer when db1.customer is updated.
Option 3: REST API for Customers plugin, active depending on master/slave setting. If master, gives token/link for slave version plugin to use on API calls etc.
Both apps are CakePHP? Customers plugin is CakePHP?
Yes CakePHP supports different database sources: https://book.cakephp.org/3.0/en/orm/database-basics.html#managing-connections
Are you deciding between one or two databases or you have two databases?
Two separates apps so two databases, each has customers plugin.
One app has the customer plugin as the “master”. The users want to avoid having to enter customer details twice, so the main app will have the enter customer details.
The other app just needs readonly access from customer plugin. So I thought just a cron job copying customer plugin tables from the master to slave, every day/hour/min. Or tell the customer plugin to use a different data source for certain models.