rvtraveller / composerize-wordpress
Convert a non-Composer managed WordPress application into a Composer-managed application.
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 2
Open Issues: 0
Type:composer-plugin
pkg:composer/rvtraveller/composerize-wordpress
Requires
- php: >=5.6
- composer-plugin-api: ^1.0.0
- ext-curl: *
- ext-json: *
- composer/semver: ^1.4
- grasmash/composerize-drupal: ^1.2
- symfony/finder: ^3.4
- symfony/yaml: ^3.4
- webmozart/path-util: ^2.3
Requires (Dev)
- alchemy/zippy: ^0.4.8
- composer/composer: ^1.0.0
- phpunit/phpunit: ^5.7
- satooshi/php-coveralls: ^2.0
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2025-10-23 11:17:38 UTC
README
Composerize WordPress is a Composer plugin that converts a non-Composer-managed WordPress application (e.g., one created via tarball) to a Composer-managed WordPress application. It is based on Composerize Drupal by Grasmash.
It is not for creating new WordPress applications.
Functionality
The composerize-wordpress command will perform the following operations:
- Remove all
composer.jsonandcomposer.lockfiles, should they exist - Generate a new
composer.jsonin the[composer-root]directory based on template.composer.json.- Populate
requirewith an entry forpantheon-systems/wordpress-composer - Populate
requirewith an entry for each project in:[core-root]/wp-content/plugins[core-root]/wp-content/themes
- Populate
- Create or modify
[composer-root]/.gitignorewith entries for Composer-managed contributed projects as per best practices. You can modify.gitignoreafter composerization if you'd prefer not to follow this practice. - Execute
composer updateto generatecomposer.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 and Wpackagist.org packages, you may also use any package from asset packagist, which makes NPM packages available to Composer.
Installation
composer global require rvtraveller/composerize-wordpress
Usage:
cd path/to/wordpress/project/repo
composer composerize-wordpress --composer-root=[repo-root] --core-root=[core-root]
The [composer-root] should be the root directory of your project, where .git is located.
The [core-root] should be the WordPress root, where wp-load.php is located.
Examples:
# WordPress is located in a `docroot` subdirectory.
composer composerize-wordpress --composer-root=. --core-root=./docroot
# WordPress is located in a `web` subdirectory.
composer composerize-wordpress --composer-root=. --core-root=./web
# WordPress is located in a `public_html` subdirectory (cPanel compatible).
composer composerize-wordpress --composer-root=. --core-root=./public_html
# WordPress is located in the repository root, not in a subdirectory.
composer composerize-wordpress --composer-root=. --core-root=.
Options
--composer-root: Specifies the root directory of your project wherecomposer.jsonwill be generated. This should be the root of your Git repository, where.gitis located.--core-root: Specifies the WordPress root directory wherewp-load.phpis located.--no-update: Preventscomposer updatefrom being automatically run aftercomposer.jsonis generated.--no-gitignore: Prevents modification of the root .gitignore file.--exact-versions: Will cause WordPress core and contributed projects (plugins, themes) to be be required with exact verions constraints incomposer.json, rather than using the default caret operator. E.g., awordpress/corewould be required as5.0rather than^5.0. 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.