S
S
stfed842015-12-21 17:59:44
PHP
stfed84, 2015-12-21 17:59:44

How to organize interaction between projects?

Good afternoon!
Several projects run on the same server. They are written in PHP + MySQL
One of the projects is central, a large database is connected to it and it includes all the mechanisms and logic.
Other projects / applications / sites have their own independent logic, but in certain places there is a need to take data from the central project.
Visible solutions:
1. We connect to the database directly and take what we need.
2. via HTTP (via file_get_contents) we access some interface of the central project and take data in JSON / XML format
3. Use a command line wrapper - execute a PHP file from another PHP file via CLI.
Now everything works according to Option No. 2, but due to the fact that an extra HTTP connection is created, strong brakes. The option to connect to the database is rejected, because in addition to the data itself, the project contains a huge processing and analysis logic.
Option number 3 seems to be the way out? Please share your experience in solving such problems.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
OnYourLips, 2015-12-21
@OnYourLips

1 and 3 are no good.
2 is REST when implemented correctly.
Most popular implementations: REST, SOAP, queues.

M
MetaDone, 2015-12-21
@MetaDone

Transfer small services with independent logic to other servers, and continue interaction according to scheme No. 2.
If your connections create brakes - optimize the web server. If there are very heavy selections or resource-intensive operations - put them in a queue, at the end of processing, kick the child service, and it will sort out what's what. If not resource-intensive and rarely change, cache everything you can
Option # 3 - rather a perversion

P
Pavel K, 2015-12-21
@PavelK

Why not just "include" your interface and call it directly?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question