简体   繁体   中英

Web service for Laravel

Assume that I have a third-party database application with SDK that can be used to retrieve data out of the database in XML.

On the other side, I have developed a website using Laravel framework of PHP. The website is supposed to display data from the database of the application.

In regards to above I have the following questions:

  1. As far as I understand, I can either store the requested data in my website database or just show it without storing. What technique do you suggest?
  2. How do I achieve xml data transfer from the database server to the website? Taking into account that I have experience of development in C#, I assume that I have to develop some web-service that would run on the database server, retrieve the required data and send it to my website. So the web-service has to receive the requests from my Laravel website, retrieve data from database server accordingly and pass the xml response to my website that would finally display it. Am I on the right way? If so, could you please guide me on how to code and bind these parts?

Thank you in advance.

I have to agree with @Serge in the comments - there are many ways to do this because it is a very broad question.

My answer was mostly going to deal with how regularly the third party database was going to be updated but judging from your comments, I'm assuming it will be fairly often? In which case, I would likely connect directly to the third party database from your laravel app using the firebird driver found here: https://github.com/jacquestvanzuydam/laravel-firebird (Please note, I have never used this so I cannot comment on it's quality) instead of writing a C# web service. I don't know much about firebird itself but you will likely want to connect using an SSH tunnel or VPN for security reasons.

Then I would either store data in MySQL if you know it isn't likely to change very often (in this case you would use a laravel command, run on a schedule, to pull data out of firebird every [X] days/hours/minutes depending on the data) or, if the data is likely to change on each potential web request, using some form of caching system (redis, memcache, file cache etc) to speed up the web requests.

Sorry if that isn't particularly helpful - if you can provide more information maybe I can help you out further :)

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM