Integrating an existing project using the laravel framework?

I cloned a project from github, and now I need to integrate this project, so how to do with the laravel framework. Should I create a new project, then you will need to replace folders or any other alternatives? because I am new to this structure. Get rid of me.

+5
php laravel
source share
2 answers

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> #Options -MultiViews RewriteEngine On RewriteBase / RewriteRule ^(.*)/$ /$1 [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /subapp/index.php?/$1 [L] </IfModule> 

Then you can have your urls:

 http://myapp 

and

 http://myapp/subapp 

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.

+4
source share

Go to www folder

 cd /var/www 

Git clone your application (note that the directory should not exist here):

 git clone https://github.com/antonioribeiro/application 

Change directory to folder

 cd application 

Performing a composer update (if you are in a development environment)

 composer update 

Or install the composer (if you are in a working environment)

 composer install 

Please note that for composer install or composer update there may be files in the folder and even the supplierโ€™s folder, there is no such obstacle.

+1
source share

All Articles