justintadlock / members

Members WordPress plugin.
GNU General Public License v2.0
405 stars 97 forks source link

Add a composer.json file ? #116

Closed jlambe closed 7 years ago

jlambe commented 7 years ago

We do a lot of our WordPress development through the use of Composer. It would be nice to add a composer.json file to your plugin and specify its "type:wordpress-plugin" like found in the Composer Installers documentation: https://github.com/composer/installers#current-supported-types

This won't break the plugin in any manner but help developers manage your plugin in their project through Composer.

Thanks in advance for this feature consideration.

justintadlock commented 7 years ago

Sure thing. If you set up a PR against the dev branch, I can add it.

jlambe commented 7 years ago

Great 👍 Will send you the PR this week.

justintadlock commented 7 years ago

@jlambe or anyone else with Composer knowledge, can you check that last commit and let me know if I need to change anything?

trsenna commented 7 years ago

Hi, I think your composer.json is good enough now, but I would add the wordpress-plugin type

Do you want me to send you a pull-request? I have here a working sample https://github.com/trsenna/Mezu-jetpack-friendly/blob/master/composer.json

justintadlock commented 7 years ago

That's already in there: https://github.com/justintadlock/members/blob/25201caad65d19671ea9f0cd8ec3a3891bca2afa/composer.json#L7

trsenna commented 7 years ago

sorry, now I saw the type is already there. Once I'm home I can test it for you!

trsenna commented 7 years ago

I could successfully install your members plugin in my WordPress using composer only. Here are some evidences:

My project composer file who defines members as a dependency

{
  "name": "trsenna/localWP",
  "description": "Easily vagrant up my WordPress stack locally.",
  "type": "project",
  "license": "GPL-2.0+",
  "authors": [
    {
      "name": "Thiago Senna",
      "homepage": "http://thremes.com.br"
    }
  ],
  "support": {
    "issues": "https://github.com/trsenna/localWP/issues",
    "source": "https://github.com/trsenna/localWP"
  },
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    },
    {
      "type": "vcs",
      "url": "https://github.com/justintadlock/members"
    }
  ],
  "require": {
    "php": ">=5.5.9",
    "johnpbloch/wordpress": ">=4.8",
    "trsenna/mezu-jetpack-friendly": "0.1.1",
    "trsenna/mezu-sorry-no-comments": "0.1.1",
    "trsenna/wpplugin-functionality": "0.1.0",
    "justintadlock/members": "dev-dev",
    "wpackagist-plugin/regenerate-thumbnails": ">=2.2.6",
    "wpackagist-plugin/wordpress-importer": ">=0.6.3",
    "wpackagist-theme/twentytwelve": ">=2.3"
  },
  "require-dev": {
    "trsenna/gozma14": "1.0.0"
  },
  "extra": {
    "installer-paths": {
      "public_html/content/mu-plugins/{$name}/": [
        "type:wordpress-muplugin"
      ],
      "public_html/content/plugins/{$name}/": [
        "type:wordpress-plugin"
      ],
      "public_html/content/themes/{$name}/": [
        "type:wordpress-theme"
      ]
    },
    "wordpress-install-dir": "public_html/wp"
  },
  "minimum-stability": "dev",
  "prefer-stable": true
}

Output for the composer update in my project

Aratakas-MacBook-Air:sandboxWP-01 thiago$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing justintadlock/members (dev-dev a7e9b89): Cloning a7e9b89d1b from cache
Writing lock file
Generating autoload files

Also I added a screenshot with the plugin activated. screen shot 2017-07-05 at 21 19 43

I just don't know if the following require is really needed in your composer.json. I usually don't need them and probably you don't need too.

"composer/installers" : "^1.0",