Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

aufawibowo's avatar

composer install without 'composer.json', is that possible?

I got a laravel project which I'm about to clone, but the problem is, it contains no 'composer.json'. Only 'composer.lock'. Is that possible to do

composer install

without 'composer.json'? How then?

Any solution will be much-appreciated!

0 likes
5 replies
cmdobueno's avatar

Thats like running php without php installed.

1 like
Snapey's avatar

Yes, I think you can composer install with only the lock file, but you will not be able to upgrade or change any packages

Snapey's avatar
Snapey
Best Answer
Level 122

I think I would put the repo in a new folder, remove composer.lock, copy composer.json from a vanilla project that is the same Laravel release, run composer install and then run the project and see what issues it throws up.

You'll quickly start hitting missing classes which you can then composer require to pull them into your project

Once you know what classes are missing, you can refer to the previous lock file to determine the version you specified

jlrdw's avatar

As an alternative, just build a new composer.json file as needed. Get the information from lock file.

Please or to participate in this conversation.