Add Composer Package from GitHub Repository Using VCS Method

A quick guide to pulling private or in-development packages directly into your Drupal project with Composer.
statue
Jean Paul Wettstein / Pexels

A new blog post by jofitz explains how to add a Composer package directly from a GitHub repository—a common need for private or in-development packages not published on drupal.org or Asset Packagist. The method relies on using a vcs repository type in composer.json.

Developers can either add the repository entry manually or via command line using composer config. Once set, the package is installed with the standard composer require command. The tutorial highlights that the package name comes from its own composer.json, which may differ from the repo name.

The post cautions that editing VCS packages directly introduces risks: they won’t stay in sync with composer.lock, which can lead to inconsistencies or lost changes. Composer may warn about unsaved modifications, but version control hygiene remains essential.

While the example uses GitHub, the same process applies to GitLab and Bitbucket repositories. For more details, see the full guide on jofitz.co.uk or refer to the official Composer VCS repository documentation.

Disclosure: This content is produced with the assistance of AI.

Disclaimer: The opinions expressed in this story do not necessarily represent that of TheDropTimes. We regularly share third-party blog posts that feature Drupal in good faith. TDT recommends Reader's discretion while consuming such content, as the veracity/authenticity of the story depends on the blogger and their motives. 

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related Organizations

Related People

Upcoming Events

Latest Opportunities