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

Lozza's avatar
Level 4

composer update

I have a laravel 10 project with various packages, such as filament, livewire3,pusher, stripe, jetstream. The project is pre-release at the moment and generally runs very well although I do have the odd weird glitches in the livewire components, usually when running in debug mode with the toolbar.

Anyway.. I want to try running with the latest version of the components and wondered what people generally do regarding updating?

I have run a composer update and npm update in my development environment and everything appears to be running fine but I'm just interested what other developers do regarding keeping components up to date while developing and in production?

Many thanks :)

0 likes
1 reply
LaryAI's avatar
Level 58

When it comes to updating dependencies in a Laravel project, it's important to follow best practices to ensure that your application remains stable and secure. Here's a general approach that you can take:

  1. Backup Your Application: Before making any changes, ensure you have a backup of your code and database. This allows you to revert to a working state if something goes wrong.

  2. Use Version Control: Always use version control (such as Git) for your project. Commit your current state before updating so you can easily revert if needed.

  3. Update in Development Environment: Perform updates in your local development environment, not on your production server. This allows you to test changes without affecting your live application.

  4. Check the Changelogs: Before updating, review the changelogs for the packages you're updating. This will give you an idea of what has changed and if there are any breaking changes or important deprecations.

  5. Composer Update: Run composer update to update your PHP packages. This command will update the packages according to the version constraints specified in your composer.json file.

composer update
  1. NPM/Yarn Update: If you're using NPM or Yarn for your front-end dependencies, run the update command for those as well.
npm update
# or
yarn upgrade
  1. Run Tests: If you have automated tests, run them to ensure that the updates haven't broken anything.

  2. Manual Testing: Manually test your application, especially the areas where updated packages are used.

  3. Check for Deprecated Features: Ensure that you're not using any deprecated features from the packages that could be removed in future updates.

  4. Update Dependencies Regularly: Keep your dependencies updated regularly rather than waiting for a long time. This makes the update process easier and less risky.

  5. Semantic Versioning: Pay attention to semantic versioning. If a package follows semantic versioning, updates within the same major version should not break your application. Be cautious with major version updates as they may introduce breaking changes.

  6. Read the Docs: For major updates or if you encounter issues, read the updated documentation of the packages.

  7. Stage Your Changes: Once everything works in development, push the changes to a staging environment that mirrors production as closely as possible.

  8. Monitor After Deployment: After updating in production, closely monitor the application for any issues.

Here's a sample workflow using Git and Composer:

# Ensure you're on the correct branch and your working directory is clean
git checkout develop
git pull origin develop

# Backup your database if necessary

# Update Composer dependencies
composer update

# Update NPM dependencies
npm update

# Run your test suite
php artisan test

# Manually test your application

# If everything is fine, commit your changes
git add composer.lock package-lock.json
git commit -m "Update dependencies"
git push origin develop

# After thorough testing, merge to your main branch and deploy to production

Remember, updating dependencies is a critical part of maintaining a healthy codebase, but it should be done carefully to avoid introducing new issues.

Please or to participate in this conversation.