ashidid's avatar

How to integrate Laravel in existing framework ??

I have an existing project which is running in PHP. It has it's own directory structure, a composer and tests.

I want to integrate Laravel as a separate directory parallel to other directories in my project. When I install it using composer create_project, it creates a separate directory but it also creates it's own composer and it's own test directories.

I want to use my applications composer and don't want a separate composer. The same case applies to my test directory as well.

I tried to do it but then the artisan commands does not work as expected. Any idea how we can achieve this?

Thanks,

0 likes
3 replies
eszterczotter's avatar

You can just run composer require laravel/framework in order to include laravel in any composer project. How you can utilize the different features depends on your current framework and also depends heavily on what you want to use it for. If you only need some specific feature of Laravel, you can require any of the Illuminate packages Laravel itself uses: https://packagist.org/packages/laravel/framework?query=illuminate%2F

martinbean's avatar

@ashidid Laravel is its own framework, with its own application skeleton. You can’t just magically “integrate” it with an existing PHP-based application.

You’ll need to be a little more diligent and actually plan an integration. For example, what is the end goal? To convert the existing PHP application into a Laravel project?

1 like
jlrdw's avatar

In the past I have done the opposite of what you are trying to do. Ran a php app through laravel. Just used getPdo().

I did this while slowly converting the code completely to laravel.

You might look at it like I piggy backed a php app through laravel.

Please or to participate in this conversation.