Composer is an open-source one stop shop tool for updating (or reverting) Drupal core, modules, and patches that will also manage all of their dependencies while also help improving your site’s security. This presentation will show you how you can use this powerful tool for your project and what you need to do to use Composer with your current Drupal site.
Composer makes the developer life easier by managing all the external libraries/dependencies for a project. Developer talks to composer for the external libraries he needs; Composer gets these dependencies and organizes them. Using composer in your project alleviates the pain of maintaining and managing the modules and its dependencies. We need to follow certain steps to migrate our existing Drupal project to a composer-based Drupal project.
Things to take away after the end of this session:
- Understand the Composer functionality.
- Start using Composer workflow in your project.
- Understand how to migrate your Drupal site structure to a composer-based Drupal template.
- Generate a thought over implementing better development workflows with composer in your project.
Overview of Discussion:
1.What is Composer and Why should we use Composer?
- What is a dependency management tool?
- How does Composer alleviate the process of managing and maintaining the 3rd party code/External Libraries?
- How Composer makes it easy installing, updating and removing modules and its dependencies?
2. Advantages of Using Composer
- Understand what differentiates Composer from Drush and Drush-makefile.
- Recursive dependency management.
- Composer autoloading.
- Drawbacks and work-arounds of Composer.
3.Composer Installation Process
- Composer can be installed globally or can be installed locally per project.
- Learn all about the Composer functionality.
- Setup a project with drupal-composer/drupal-project template.
- Understand the structure of the drupal-composer/drupal-project template and the reasons on why this structure is different from the usual structure of a Drupal project.
- Do’s and Don’t with Composer. Good Practices.
- Understand the different version constraints used to download the package dependencies.
- Understand why the version constraints really matter.
- Tilde vs caret, release tags.
5. Applying Patches using composer
- Learn how to apply patches to contributed modules or Drupal/core using a composer plugin and persist the patch even after an update.
- How not to create a patch.
6.How to migrate your current Drupal site to composer-based Drupal site.
- The challenges we face while migrating our Drupal site to drupal-composer/drupal-project template.
- Steps to be followed to migrate your current Drupal structure to a drupal-composer/drupal-project template structure.
7. Development workflow
- Learn some of the best practices used for managing drupal sites using composer and for managing deployments.
I started applying composer functionality in my project by realizing its importance from the Drupal community. During this process, my project had modules/themes installed both from the UI and the Composer. Instead of handling both types, I converted everything into a composer-based module structure. I realized the Importance of having the composer-based Drupal project Structure and migrated my site to the same.
In this presentation I introduce the composer approach and share my experiences during the migration of Drupal project to a Composer-based Drupal Project, specifying it's importance.