How do I manage Composer for Laravel using the Web Terminal?

Procédure

Composer is a dependency manager for PHP that lets you install, update and manage the libraries needed for your Laravel application. With Composer, you can easily integrate and maintain the required components, ensuring efficient and consistent management of your project's dependencies.

In this documentation, we will explain how to interact with Composer using command lines on the Web Terminal.

Prior to this documentation, we invite you to access your hosting's Web Terminal.

Using the Composer command

Installing dependencies

If you already have a Laravel project and need to install the dependencies listed in the composer.json file, use :

compose install

Updating dependencies

To update all the dependencies in your Laravel project to their latest compatible versions, use :

composer update

Adding new dependencies

To add a new dependency to your project, use the require command. For example, to add guzzlehttp/guzzle:

composer require guzzlehttp/guzzle

Removing dependencies

To remove a dependency from your project, use the remove command. For example, to remove guzzlehttp/guzzle:

composer remove guzzlehttp/guzzle

Optimising automatic loading

To optimise the automatic loading of classes, which can improve the performance of your application, use :

composer dump-autoload -o

Displaying installed dependencies

To see a list of all installed dependencies and their versions, use :

composer show

Delete the Composer cache

To delete the Composer metadata cache

composer clear-cache

Search for packages

Searches for available packages in the Composer registry using a keyword.

composer search [keyword]

Composer documentation: https: //getcomposer.org/

Conclusion

You now know how to :

  • Install the dependencies of your Laravel project with composer install.
  • Update your dependencies to the latest compatible versions with composer update.
  • Easily add new libraries to your project with composer require.
  • Remove unnecessary dependencies with composer remove.
  • Optimise automatic class loading with composer dump-autoload -o for better performance.
  • View the list of installed packages and their versions with composer show.
  • Clear the Composer cache to resolve certain problems using composer clear-cache.
  • Search for specific packages using composer search [keyword].

✨ Thanks to this guide, managing your PHP project's dependencies with Composer becomes child's play! We hope this information will help you maintain and develop your applications more efficiently and confidently. 🚀

Many thanks for reading! Feel free to leave a comment to share your experience with Composer or ask questions if you have any. We want to hear what you think! 💬

Rate this article :

This article was useful to you ?

Article utileYes

Article non utileNo

Vous souhaitez nous laisser un commentaire concernant cet article ?

Si cela concerne une erreur dans la documentation ou un manque d'informations, n'hésitez pas à nous en faire part depuis le formulaire.

Pour toute question non liée à cette documentation ou problÚme technique sur l'un de vos services, contactez le support commercial ou le support technique

MerciMerci ! N'hésitez pas à poser des questions sur nos documentations si vous souhaitez plus d'informations et nous aider à les améliorer.


Vous avez noté 0 étoile(s)

Similar articles

1mn reading

How do I connect to the Web Terminal with LWS Panel? (ssh web console)

4mn reading

How can I use GIT with the Web terminal on my LWS shared hosting?

2mn reading

How to change the PHP version of the LWS Panel Web Terminal

0mn reading

What can I do on my WordPress site using the Web Terminal?


Ask the LWS team and its community a question