简体   繁体   English

Php-移动+ Web应用程序:Laravel /流明或两者

[英]Php - Mobile + Web App : Laravel / Lumen or Both

I am building an application and currently focusing on the mobile part . 我正在构建一个应用程序,目前专注于移动部分。

I wanted to use Lumen microframework for the server-side and Apis to connect to the mobile app. 我想在服务器端使用Lumen微框架,并使用Apis连接到移动应用程序。

However i also wanted to extend the application later on to build a website (Laravel) 但是我也想在以后扩展应用程序以构建网站(Laravel)

They will both be using the same database . 他们都将使用相同的数据库。

I am wondering whether i should use Laravel directly and make it responsible for the apis too (albeit it would be slower for mobile apps) 我想知道我是否应该直接使用Laravel并使它也负责api(尽管对于移动应用程序来说会更慢)

Or i was wondering if i can use a combination of both. 或者我想知道我是否可以同时使用两者。

Lumen - to deal with server requests eg : api.site.com/... 流明-处理服务器请求,例如:api.site.com / ...

Laravel - to deal with the website eg : site.com/.... Laravel-处理网站,例如:site.com / ....

You could do either or, but I would suggest keeping the website and the API isolated. 您可以选择其中一个,但我建议您将网站和API保持隔离。

I actually just finished up a similar project. 我实际上刚刚完成了一个类似的项目。

I have a mobile app built on Ionic, an API built on Lumen and an admin CMS built on Laravel. 我有一个基于Ionic的移动应用程序,一个基于Lumen的API和一个基于Laravel的管理CMS。 The CMS updates content in the API via authenticated API calls and then the app pulls from it. CMS通过经过身份验证的API调用更新API中的内容,然后应用程序从中提取内容。

If you take this route, you could make API calls from the CMS/Website using client side or server side requests. 如果采用这种方式,则可以使用客户端或服务器端请求从CMS /网站进行API调用。 My CMS uses server side calls leveraging Guzzle . 我的CMS利用Guzzle使用服务器端调用。

I would suggest looking at sharing models between the two applications such that you don't have to update content via API calls. 我建议在看共享的两个应用程序之间的这种模式,你不必更新通过API调用的内容。 Here is a nice article on how to do so. 是一篇不错的文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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