Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Composer support #16

Closed
Rarst opened this issue Apr 24, 2013 · 4 comments
Closed

Add Composer support #16

Rarst opened this issue Apr 24, 2013 · 4 comments

Comments

@Rarst
Copy link
Contributor

@Rarst Rarst commented Apr 24, 2013

Minimal effort:

  • add composer.json information
  • start versioning/tagging releases

Medium effort:

  • break out definitions into separate files
  • set up autoload for Composer use
  • tweak bootstrap file for non-Composer use

Optional:

  • register on Packagist or set up custom Composer repo

Opinions? I can get this done easy, just don't want to bother if there is no interest in adopting it.

@markjaquith
Copy link
Owner

@markjaquith markjaquith commented May 1, 2013

Is the idea that people who bundle this into plugins could keep up with updates this way? That is, it would be for devs who use it, not end users?

@Rarst
Copy link
Contributor Author

@Rarst Rarst commented May 1, 2013

Yep. Composer is dependency management so dev stuff. It replaces committing a copy of library into your plugin or adding it as subrepository with listing it as dependency in its composer.json configuration file.

So in plugin I work on right now I have something like this in its composer.json (I set up stub definition for TLC Transients in my custom Composer repo http://www.rarst.net/packages.json ):

    "require"     : {
        "markjaquith/wp-tlc-transients": "dev-master"
    },
    "repositories": [
        {
            "type": "composer",
            "url" : "http://rarst.net"
        }
    ],

So when I install my plugin with Composer copy of TLC Transients is automagically downloaded (or checked out from GitHub depending on command, settings and environment) and made available to plugin.

I am still exploring Composer with WordPress and it's not all smooth (mostly due to WP being legacy code base from the view point of PHP 5.3+ world), however it's fantastic tool and is quickly becoming de-facto standard for sharing and reusing PHP libraries.

@markjaquith
Copy link
Owner

@markjaquith markjaquith commented May 7, 2013

It replaces committing a copy of library into your plugin or adding it as subrepository with listing it as dependency in its composer.json configuration file.

But users aren't going to have this so wouldn't you have to commit the copy to your plugin? Just you could use this to keep the dependency up-to-date?

@Rarst
Copy link
Contributor Author

@Rarst Rarst commented May 7, 2013

But users aren't going to have this so wouldn't you have to commit the copy to your plugin?

Quick comparison to subrepo approach. With subrepo:

  • dependency is fixed at specific VC revision
  • build is performed by VC (multiple VC if we are mixing)
  • dependency can only come from VC
  • each package using dependency does so independently

With Composer:

  • dependency is fixed at specific version or described by version logic (wildcard, range, etc)
  • build is performed by composer (which transparently calls VC if needed)
  • dependency can come from VC or HTTP download
  • if we are building larger project (whole site stack) single copy of dependency is shared between packages that require it

There aren't many Composer-powered plugins for WP around yet. For example I have recently released Laps (composer.json)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.