0

I've been doing further research about choosing a right framework for our server side processes,

So I camed with the question:

  • Is it possible to have two frameworks working aside of each other as seperate?
  • For instance I wanna have Laravel for my server side admin, and I want PHP Phalcon for our web services (because it written with C and faster),Is it possible?
  • Does it create any integration problem or sth?

Thanks in advance,

  • As long as you don't mix the code everything should be fine. Phalcon rest api can be in www.com/api/ while the rest of the site runs on laravel. It's same as people including wordpress installation in /blog/ subfolder :) – Nikolay Mihaylov Mar 17 '17 at 09:20

2 Answers2

1

Of course, you can. Just configure Nginx for two separated projects. If you need to operate main (Phalcon) project's data from admin (Laravel), you can use one database configuration in Laravel and Phalcon projects. Or as said Rodrane, you can create Oauth server in Phalcon project to manipulating data from admin without handling the same database connection.

Nickstery
  • 116
  • 4
  • What's Your advice in this subject for high traffic site – Mohammadali Mirhamed Mar 17 '17 at 09:44
  • If main project is highloaded, using OAuth for interaction admin and main won't be a good idea. Cause each action from the admin will generate api call to main project, and it will be slower as each api call will generate DB call (for grabbing or inserting data), when you can directly access the DB from Laravel (admin) page. I'd like to use the same Database connection and if admin select requests is too expensive also use caching. It is my opinion – Nickstery Mar 17 '17 at 09:59
1

If you want to use the same web server then of course you can set up two sites admin.mysite.com and www.mysite.com

Each site will be served by a different folder and in that folder you can have your Phalcon, Laravel or any other installation you wish.

You could also change the boostrapping method i.e.

if ('/admin' === $url} {
    // Bootstrap Laravel
} else {
    //Bootstrap Phalcon
}

but that might become very difficult to maintain - you will also need to ensure that security is at max i.e. if you have login on the Phalcon side you need to reauthenticate on the Laravel side etc.

Nikolaos Dimopoulos
  • 11,195
  • 6
  • 37
  • 66