PHPackages                             grasmash/composerize-drupal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. grasmash/composerize-drupal

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

grasmash/composerize-drupal
===========================

Convert a non-Composer managed Drupal application into a Composer-managed application.

1.3.0(4y ago)12819.4k20[1 issues](https://github.com/grasmash/composerize-drupal/issues)[2 PRs](https://github.com/grasmash/composerize-drupal/pulls)1PHPPHP &gt;=5.6

Since Feb 1Pushed 3y ago7 watchersCompare

[ Source](https://github.com/grasmash/composerize-drupal)[ Packagist](https://packagist.org/packages/grasmash/composerize-drupal)[ RSS](/packages/grasmash-composerize-drupal/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (11)Versions (19)Used By (1)

[![Build Status](https://camo.githubusercontent.com/0be8628e4dc75274127486e8c7d6583eaaf24d0bc6f848c9d8be2ae445a0003d/68747470733a2f2f7472617669732d63692e6f72672f677261736d6173682f636f6d706f736572697a652d64727570616c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/grasmash/composerize-drupal) [![Coverage Status](https://camo.githubusercontent.com/9c36bd52e13f4b13e34792ccbc45a0b5ec6cb26ad825ea177733c85bf53a1cfa/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f677261736d6173682f636f6d706f736572697a652d64727570616c2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/grasmash/composerize-drupal?branch=master) [![Packagist](https://camo.githubusercontent.com/e282729f0f20dc22d9cc0de642e550ee6a8814cf86dc92b61f871828db585892/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f677261736d6173682f636f6d706f736572697a652d64727570616c2e737667)](https://packagist.org/packages/grasmash/composerize-drupal)

Composerize Drupal
==================

[](#composerize-drupal)

*Composerize Drupal* is a Composer plugin that converts a non-Composer-managed Drupal application (e.g., one created via tarball) to a Composer-managed Drupal application.

It is not for creating new Drupal applications. If you want to create a brand new Drupal application, use [drupal-project](https://github.com/drupal-composer/drupal-project) instead.

Functionality
-------------

[](#functionality)

The `composerize-drupal` command will perform the following operations:

- Remove all vestigial `composer.json` and `composer.lock` files
- Generate a new `composer.json` in the `[composer-root]` directory based on [template.composer.json](template.composer.json).
    - Populate `require` with entries for `drupal/core-recommended` and `drupal/core-composer-scaffold`
    - Populate `require` with an entry for each project in:
        - `[drupal-root]/modules`
        - `[drupal-root]/modules/contrib`
        - `[drupal-root]/themes/contrib`
        - `[drupal-root]/profiles/contrib`
    - Require and configure suggested Composer plugins:
        - Add `drupal/composer-scaffold` file paths to `extra` configuration to ensure that Drupal projects are downloaded to the correct locations.
        - Create and populate `extra.patches` object to facilitate patching with [Composer Patches](https://github.com/cweagans/composer-patches). Patches to profiles, themes, and modules will be automatically discovered and moved to the a new \[repo-root\]/patches directory.
        - Add entries to `repositories`:
            - `https://packages.drupal.org/8` for installing packages from Drupal.org
            - [`https://asset-packagist.org/`](https://asset-packagist.org/) to permit installing NPM packages.
- Create or modify `[composer-root]/.gitignore` with entries for Composer-managed contributed projects as [per best practices](https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md). You can modify `.gitignore` after composerization if you'd prefer not to follow this practice.
- Execute `composer update` to generate `composer.lock`, autoload files, and install all dependencies in the correct locations.

It will NOT add any contributed projects in `docroot/libraries` to `composer.json`. You must add those to your `composer.json` file manually. In addition to [packagist](https://packagist.org/) and Drupal.org packages, you may also use any package from [asset packagist](https://asset-packagist.org/), which makes NPM packages available to Composer.

Installation
------------

[](#installation)

```
composer global require grasmash/composerize-drupal

```

Usage:
------

[](#usage)

```
cd path/to/drupal/project/repo
composer composerize-drupal --composer-root=[repo-root] --drupal-root=[drupal-root]

```

The `[composer-root]` should be the root directory of your project, where `.git` is located.

The `[drupal-root]` should be the Drupal root, where `index.php` is located.

Examples:

```
# Drupal is located in a `docroot` subdirectory.
composer composerize-drupal --composer-root=. --drupal-root=./docroot

# Drupal is located in a `web` subdirectory.
composer composerize-drupal --composer-root=. --drupal-root=./web

# Drupal is located in a `public_html` subdirectory (cPanel compatible).
composer composerize-drupal --composer-root=. --drupal-root=./public_html

# Drupal is located in the repository root, not in a subdirectory.
composer composerize-drupal --composer-root=. --drupal-root=.

```

Options
-------

[](#options)

- `--composer-root`: Specifies the root directory of your project where `composer.json` will be generated. This should be the root of your Git repository, where `.git` is located.
- `--drupal-root`: Specifies the Drupal root directory where `index.php` is located.
- `--no-update`: Prevents `composer update` from being automatically run after `composer.json` is generated.
- `--no-gitignore`: Prevents modification of the root .gitignore file.
- `--exact-versions`: Will cause Drupal core and contributed projects (modules, themes, profiles) to be be required with exact verions constraints in `composer.json`, rather than using the default caret operator. E.g., a `drupal/core` would be required as `8.4.4` rather than `^8.4.4`. This prevents projects from being updated. It is not recommended as a long-term solution, but may help you convert to using Composer more easily by reducing the size of the change to your project.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 88.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~152 days

Recently: every ~204 days

Total

9

Last Release

1810d ago

Major Versions

1.2.1 → 2.0.x-dev2019-06-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f0a67482f1db7967656e00f2671283ce1aa4ee8ecb934104bfaf39774a9d563?d=identicon)[grasmash](/maintainers/grasmash)

---

Top Contributors

[![grasmash](https://avatars.githubusercontent.com/u/539205?v=4)](https://github.com/grasmash "grasmash (71 commits)")[![mohammadzo](https://avatars.githubusercontent.com/u/31045460?v=4)](https://github.com/mohammadzo "mohammadzo (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![rahulsonar-acquia](https://avatars.githubusercontent.com/u/74297357?v=4)](https://github.com/rahulsonar-acquia "rahulsonar-acquia (1 commits)")[![Alexj12](https://avatars.githubusercontent.com/u/7288499?v=4)](https://github.com/Alexj12 "Alexj12 (1 commits)")[![simon-olsen](https://avatars.githubusercontent.com/u/21236463?v=4)](https://github.com/simon-olsen "simon-olsen (1 commits)")[![HongPong](https://avatars.githubusercontent.com/u/114027?v=4)](https://github.com/HongPong "HongPong (1 commits)")[![lbainbridge](https://avatars.githubusercontent.com/u/41346784?v=4)](https://github.com/lbainbridge "lbainbridge (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/grasmash-composerize-drupal/health.svg)

```
[![Health](https://phpackages.com/badges/grasmash-composerize-drupal/health.svg)](https://phpackages.com/packages/grasmash-composerize-drupal)
```

###  Alternatives

[orchestra/canvas

Code Generators for Laravel Applications and Packages

20917.2M158](/packages/orchestra-canvas)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

96374.6k23](/packages/friendsoftypo3-content-blocks)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)[altis/local-server

Local Server module for Altis

18208.4k2](/packages/altis-local-server)[aeliot/todo-registrar

Register TODOs from source code in issue tracker

153.0k](/packages/aeliot-todo-registrar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
