This is a broad question, because it depends on your project, which we do not know here.
Laravel does not care about where your project files are located, it allows you to freely do whatever you need with all of them; most of the problems people face with non-Laravel projects sharing the folder with the Laravel application are related to the configuration of the virtual host, .htaccess and / or the application that they are trying to integrate. You must understand very well how these web servers work in order for your project to work well with the Laravel application.
My advice: create a subfolder inside your project and create your Laravel application on it. Set up a virtual host alias that indicates the base URL of your Laravel application to this folder, and you should be good. For example:
This will be an alias for subapp (Laravel) myapp:
Alias /subapp "/var/www/myapp/subapp/public" <Directory /var/www/myapp/subapp> Options Indexes Includes FollowSymLinks MultiViews AllowOverride AuthConfig FileInfo Order allow,deny Allow from all </Directory>
And .htaccess:
<IfModule mod_rewrite.c>
Then you can have your urls:
http:
and
http:
You can even force Laravel to import some of your classes by requiring them directly in your Laravel code:
require "../../../classes/Class.php";
If your application is based on Composer, such as Laravel, you can automatically load your classes by doing the following:
require "../../../vendor/autoload.php";
But if you need real integration between Laravel and your application, you have two (or more) options:
1) Convert one of them to an API (or create an API inside it), and the other in the client to this API.
2) Create a completely new Laravel project and bring your legacy code to your Laravel application, which, like blasically, will create the application from scratch.
Antonio Carlos Ribeiro
source share