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: 2
Forks: 2
Open Issues: 0
Type:composer-plugin
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: 2024-11-23 09:07:13 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.json
andcomposer.lock
files, should they exist - Generate a new
composer.json
in the[composer-root]
directory based on template.composer.json.- Populate
require
with an entry forpantheon-systems/wordpress-composer
- Populate
require
with an entry for each project in:[core-root]/wp-content/plugins
[core-root]/wp-content/themes
- Populate
- Create or modify
[composer-root]/.gitignore
with entries for Composer-managed contributed projects as per best practices. You can modify.gitignore
after composerization if you'd prefer not to follow this practice. - Execute
composer update
to 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.json
will be generated. This should be the root of your Git repository, where.git
is located.--core-root
: Specifies the WordPress root directory wherewp-load.php
is located.--no-update
: Preventscomposer update
from being automatically run aftercomposer.json
is 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/core
would be required as5.0
rather 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.