{"id":89077,"date":"2018-07-26T02:21:24","date_gmt":"2018-07-26T02:21:24","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/wp-composer-sync\/"},"modified":"2018-07-26T02:49:21","modified_gmt":"2018-07-26T02:49:21","slug":"wp-composer-sync","status":"publish","type":"plugin","link":"https:\/\/azb.wordpress.org\/plugins\/wp-composer-sync\/","author":10075157,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0","stable_tag":"trunk","tested":"4.7.33","requires":"4.6","requires_php":"7.0","requires_plugins":"","header_name":"WP Composer Sync","header_author":"Craig Harman","header_description":"Automatically keeps your composer.json file in sync with plugins installed via wp-admin.","assets_banners_color":"","last_updated":"2018-07-26 02:49:21","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/wordpress.org\/#","header_author_uri":"http:\/\/harmoinc.com.au\/","rating":0,"author_block_rating":0,"active_installs":0,"downloads":1197,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["installation","changelog","description","faq"],"tags":[],"upgrade_notice":[],"ratings":[],"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.1"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1082],"plugin_category":[],"plugin_contributors":[92238],"plugin_business_model":[],"class_list":["post-89077","plugin","type-plugin","status-publish","hentry","plugin_tags-composer","plugin_contributors-harmonicnewmedia","plugin_committers-harmonicnewmedia"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/wp-composer-sync.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=installation-->\n<p>Regardsless of installation method the machine where you are running Wordpress requires Subversion to be installed to allow access to Wordpress's SVN repositories. On *NIX based servers you can simply:<\/p>\n\n<pre><code>`\n<\/code><\/pre>\n\n<p>apt -yq install subversion\n    `<\/p>\n\n<h3>New Wordpress Install<\/h3>\n\n<p>You can use composer to create your new Wordpress instance and include WP Composer Sync. In the root of your project folder simply create a <strong>composer.json<\/strong> file containing:<\/p>\n\n<pre><code>`\n<\/code><\/pre>\n\n<p>{\n    \"name\": \"The name of your WordPress site\",\n    \"extra\": {\n        \"composer-wp\": {\n            \"repositories\": [],\n            \"vendors\": {},\n            \"installer\": {\n                \"wordpress-path\": \"web\"\n            }\n        }\n    },\n    \"require\": {\n        \"wordpress\/wordpress\": \"^4.9.7\",\n        \"wordpress-plugin\/wp-composer-sync\": \"*\"\n    },\n    \"scripts\": {\n        \"pre-cmd\": [\n            \"composer global require balbuf\/composer-wp &amp;&amp; composer global update balbuf\/composer-wp\"\n        ],\n        \"pre-install-cmd\": \"@pre-cmd\",\n        \"pre-update-cmd\": \"@pre-cmd\"\n    }\n}\n    `<\/p>\n\n<p>This will install wordpress in a web\/ sub-directory (recommended, but you can change the web root by modifying the \"wordpress-path\"). It will also globally install <a href=\"https:\/\/github.com\/balbuf\/composer-wp\" title=\"Balbuf's Composer-WP\">link<\/a>.<\/p>\n\n<h3>Existing Wordpress Install<\/h3>\n\n<p>If you wish to install WP Composer Sync into an existing (composer managed) Wordpress install start by installing <a href=\"https:\/\/github.com\/balbuf\/composer-wp\" title=\"Balbuf's Composer-WP\">link<\/a>:<\/p>\n\n<pre><code>`\n<\/code><\/pre>\n\n<p>$ composer global require balbuf\/composer-wp\n    `<\/p>\n\n<p>Now you need to add WP Composer Sync to your Wordpress install either via wp-admin or via composer:<\/p>\n\n<pre><code>`\n<\/code><\/pre>\n\n<p>$ composer global require wordpress\/wp-composer-sync\n    `<\/p>\n\n<!--section=changelog-->\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial version<\/li>\n<\/ul>\n\n<!--section=description-->\n<p>WP Composer Sync is a Wordpress plugin that keeps a Wordpress installation's composer.json synchronised with the plugins installed.<\/p>\n\n<h3>Usage<\/h3>\n\n<p>Once installed the plugin should be largely set and forget, however there a couple of gotchas.<\/p>\n\n<p>1) Commercial plugins that are not available from the Wordpress.org plugins repository <strong>will still be added<\/strong> you will need to manually modify the repository (eg. wpackagist, wp-premium or using a custom installer or repository) or add your custom plugins first. WP Composer Sync will then honor these repositories and keep them synchronised as well.\n2) When composer installs a package, it completely empties the target directory before installing the new files. As such, the WordPress path should be designated for WordPress core files only, as anything else (e.g. plugins, themes, and wp-config.php) will be wiped away on install or update. It is recommended that you <em>keep your wp-config.php file in the parent directory of the WordPress path<\/em> (WordPress can find it there automatically) and <em>replace the wp-content directory with a symlink<\/em> to your real wp-content folder. See  <a href=\"https:\/\/github.com\/balbuf\/composer-wp\" title=\"Balbuf's Composer-WP\">link<\/a> for more details.\n3) Compposer require versioning wildcards (eg. *, 1.*, etc) will not be honoured (as Wordpress does not adhere to this). They will be replaced by the exact version number in use by Wordpress.<\/p>\n\n<h3>About<\/h3>\n\n<h3>Why?<\/h3>\n\n<p>Composer is a great way to manage Wordpress and its plugins. However in real life it runs the risk of becoming outdated with the actual contents of the website when admin users are installing plugins via wp-admin or S\/FTP.<\/p>\n\n<h3>How?<\/h3>\n\n<p>Using Wordpress's \"plugins_loaded\" action and <a href=\"https:\/\/github.com\/balbuf\/composer-wp\" title=\"Balbuf's Composer-WP\">link<\/a>, this plugin will check your composer.json file for any outdated or unfound plugins and will automatically add them to the require section.<\/p>\n\n<h4>Roadmap<\/h4>\n\n<p>The plugin is production ready however there are some additional functions and features which will be added in the future:<\/p>\n\n<p>1) Add ability to select bewteen https:\/\/github.com\/balbuf\/composer-wp and wpackagist\n2) Currently only syncs plugin and wordpress core, add ability to sync themes\n3) Research some ways to monitor plugin-uploads and changes more effectively (eg. <a href=\"https:\/\/codex.wordpress.org\/Plugin_API\/Action_Reference\/upgrader_process_complete\" title=\"Upgrader_Process_complete\">link<\/a> <a href=\"https:\/\/github.com\/WordPress\/WordPress\/blob\/master\/wp-admin\/includes\/class-plugin-upgrader.php\" title=\"2\">link<\/a>,  <a href=\"https:\/\/www.sitepoint.com\/wordpress-plugin-updates-right-way\/\" title=\"Wordpress Updates\">link<\/a> and <a href=\"https:\/\/codex.wordpress.org\/Creating_Tables_with_Plugins#Adding_an_Upgrade_Function\" title=\"Adding an upgrade function\">link<\/a> or Transients <a href=\"https:\/\/code.tutsplus.com\/tutorials\/a-guide-to-the-wordpress-http-api-automatic-plugin-updates--wp-25181\" title=\"1\">link<\/a> <a href=\"https:\/\/stackoverflow.com\/questions\/32196219\/my-plugin-not-updating-properly-issue-with-upgrader-process-complete\/50914655#50914655\" title=\"2\">link<\/a> or <a href=\"https:\/\/wordpress.stackexchange.com\/questions\/123732\/get-latest-plugin-version-from-wp-api\" title=\"Plugins API\">link<\/a>)<\/p>\n\n<!--section=faq-->\n<dl>\n<dt>Installation Instructions<\/dt>\n<dd><p>Regardsless of installation method the machine where you are running Wordpress requires Subversion to be installed to allow access to Wordpress's SVN repositories. On *NIX based servers you can simply:<\/p>\n\n<pre><code>`\n<\/code><\/pre>\n\n<p>apt -yq install subversion\n    `<\/p>\n\n<h3>New Wordpress Install<\/h3>\n\n<p>You can use composer to create your new Wordpress instance and include WP Composer Sync. In the root of your project folder simply create a <strong>composer.json<\/strong> file containing:<\/p>\n\n<pre><code>`\n<\/code><\/pre>\n\n<p>{\n    \"name\": \"The name of your WordPress site\",\n    \"extra\": {\n        \"composer-wp\": {\n            \"repositories\": [],\n            \"vendors\": {},\n            \"installer\": {\n                \"wordpress-path\": \"web\"\n            }\n        }\n    },\n    \"require\": {\n        \"wordpress\/wordpress\": \"^4.9.7\",\n        \"wordpress-plugin\/wp-composer-sync\": \"*\"\n    },\n    \"scripts\": {\n        \"pre-cmd\": [\n            \"composer global require balbuf\/composer-wp &amp;&amp; composer global update balbuf\/composer-wp\"\n        ],\n        \"pre-install-cmd\": \"@pre-cmd\",\n        \"pre-update-cmd\": \"@pre-cmd\"\n    }\n}\n    `<\/p>\n\n<p>This will install wordpress in a web\/ sub-directory (recommended, but you can change the web root by modifying the \"wordpress-path\"). It will also globally install <a href=\"https:\/\/github.com\/balbuf\/composer-wp\" title=\"Balbuf's Composer-WP\">link<\/a>.<\/p>\n\n<h3>Existing Wordpress Install<\/h3>\n\n<p>If you wish to install WP Composer Sync into an existing (composer managed) Wordpress install start by installing <a href=\"https:\/\/github.com\/balbuf\/composer-wp\" title=\"Balbuf's Composer-WP\">link<\/a>:<\/p>\n\n<pre><code>`\n<\/code><\/pre>\n\n<p>$ composer global require balbuf\/composer-wp\n    `<\/p>\n\n<p>Now you need to add WP Composer Sync to your Wordpress install either via wp-admin or via composer:<\/p>\n\n<pre><code>`\n<\/code><\/pre>\n\n<p>$ composer global require wordpress\/wp-composer-sync\n    `<\/p><\/dd>\n\n<\/dl>","raw_excerpt":"WP Composer Sync is a Wordpress plugin that keeps a Wordpress installation&#039;s composer.json synchronised with the plugins installed.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/89077","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=89077"}],"author":[{"embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/harmonicnewmedia"}],"wp:attachment":[{"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=89077"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=89077"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=89077"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=89077"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=89077"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/azb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=89077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}