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.
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/
You now know how to :
composer install.composer update.composer require.composer remove.composer dump-autoload -o for better performance.composer show.composer clear-cache.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! 💬
Ask the LWS team and the community. Answers are published after moderation.