Answer the question
In order to leave comments, you need to log in
How to combine golang with php?
Hello everybody!
Many people are trying to find out if Golang can be combined with PHP and vice versa. But ... there is little information on the Internet, or I'm not looking well. However, lately I've been asking myself this question. And I would like to know the truth.
Let's imagine such a situation. You have implemented MVC in PHP, for example: A system for parsing associative semantic cores. Then you are faced with the problem of data processing. The database sends a response in 0.003 seconds. But... due to data processing, loading a user page is some 14 to 20 seconds. I understand this is not acceptable!
Therefore, you resort to using Ajax requests or separating services into Server and User. After that, the loading of the user page is approximately the same numbers, from 10 to 15 seconds.
Forgot to say that the database answers you in about 1 million rows. Which significantly affects the processing of data. Therefore, such a long loading of the user page.
Now let's talk about the division of services into Server and User. You decide to test new unknown sciences. You think that the multi-threaded Golang language will save the whole world. This means that the task of introducing this language into your system appears, which is the usual MVC.
Then the question arises: how exactly to do this and how to implement it?
There is a certain architecture of your project directories that must exist in the ecosystem (strictly):
|- app /
|- core /
controller.php
model.php
route.php
view.php
|- lib /
|- messages /
errors.php
|- security
|- validation
database.php
vendor.php
init.php
|- build /
|- controllers
home.php
|- models/
|- home
index.php
|- private /
|- config
routes.php
|- database
name_database.sql
|- public /
|- api /
connect.php
|- docs
|- res /
|- src
|- template /
|- errors /
404.html
|- layouts /
default.html
|- views /
|- home /
index.html
|- web /
|- css
|- js
.htaccess
index.php
.htaccess
Answer the question
In order to leave comments, you need to log in
loading a custom page is about the same numbers, from 10 to 15 seconds.
the database answers you in about 1 million lines
, the question arises: how exactly to do this and how to implement it?
What other alternatives can you suggest? For example, combining Vue with PHP.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question