Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8888761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:06:29+00:00 2026-06-14T22:06:29+00:00

The Background I’m trying to use Composer to manage dependencies for WordPress plugins. I’ve

  • 0

The Background

I’m trying to use Composer to manage dependencies for WordPress plugins. I’ve built several PHP libraries (RESTian & Sidecar) I want to include in subdirectories for each of several plugins we are building and those PHP libraries are hosted on GitHub. The WordPress plugins are (currently) hosted in private BitBucket repos as they are for clients but those plugins will also get published to WordPress plugin repository when we are ready to release them.

The Problem

I want a directory structure of /libraries/restian/ and /libraries/sidecar/ relative to the root of the plugin. For those who know WordPress they would ultimately look like this installed:

/wp-content/plugins/my-wp-plugin/libraries/restian/
/wp-content/plugins/my-wp-plugin/libraries/sidecar/

Problem is I’ve only been able to get Composer to put them within a /newclarity/ subdirectory which is more complexity than I want to add to the directory structure of the plugin ('newclarity' is our GitHub account):

/wp-content/plugins/my-wp-plugin/libraries/newclarity/restian/
/wp-content/plugins/my-wp-plugin/libraries/newclarity/sidecar/

The Source

Here is the composer.json file that I am using to research and test this:

{
  "name":"mikeschinkel/my-wp-plugin",
  "description":"My WordPress Plugin",
  "type":"wordpress-plugin",
  "config":{
    "vendor-dir":"libraries/"
  },
  "require": {
    "newclarity/restian":"dev-master",
    "newclarity/sidecar":"dev-master"
  },
  "repositories":[
    {
      "type":"git",
      "url":"https://github.com/newclarity/restian.git"
    },
    {
      "type":"git",
      "url":"https://github.com/newclarity/sidecar.git"
    }
  ]
}

And here are the current composer.json files from the libraries hosted at GitHub:

{
  "name": "newclarity/restian",
  "description": "RESTian: A base class library to simplify building RESTful/Web API clients in PHP",
  "require": {
      "php": ">=5.2.4"
  }
}

And:

{
  "name": "newclarity/sidecar",
  "description": "Sidecar: The Missing Plugin API for WordPress",
  "require":{
    "php":">=5.2.4"
  }
}

I’ve been researching this for over 4 hours now. Any help would be appreciated.

-Mike

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:06:30+00:00Added an answer on June 14, 2026 at 10:06 pm

    So I came up with a solution that works, but it’s inelegant and I was really hoping for a simple and elegant solution hence why I posted my question here on StackOverflow.

    After no better answer here I posted on the Composer forum as a feature request and had the request closed because “where code is installed in most cases should not matter.” It’s sad that some people feel that what they value are the only things worth valuing.

    Since it seems like there’s no official way to do this and no interest on behalf of the Composer team to make it easier I decided to go ahead and post my solution in case others are beating their head against the wall in same way. It’s ugly but it works.

    Instead of referencing a Git repo create an “inline package” for each repo; here’s what it looks like (NOTE: I added '#' comments which are of course not valid JSON but only here to callout what I changed.):

    {
      "name":"mikeschinkel/my-wp-plugin",
      "description":"My WordPress Plugin",
      "type":"wordpress-plugin",
      "config":{
        "vendor-dir":"libraries"
      },
      "require": {
        "restian":"dev-master",  # Short name 'restian' used here.
        "sidecar":"dev-master"   # Short name 'sidecar' used here.
      },
      "repositories":[
        {
          "type":"package",      # type=package vs. type=git
          "package":{
            "name":"sidecar",    # Short name 'sidecar' used here.
            "version":"dev-master",
            "source":{           # This could be "dist" or "source"
              "type":"git",
              "url":"https://github.com/newclarity/sidecar",
              "reference":"master"
            }
          }
        },
        {
          "type":"package",      # type=package vs. type=git
          "package":{
            "name":"restian",    # Short name 'restian' used here.
            "version":"dev-master",
            "source":{           # This could be "dist" or "source"
              "type":"git",
              "url":"https://github.com/newclarity/restian",
              "reference":"master"
            }
          }
        }
      ]
    }
    

    Given that I’m new to Composer there might be numerous ways I could improve this; any suggestions are welcome. Either way I hope this helps others trying to achieve the same goal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background Hi All, I'm trying to use Boost::MPI, at the moment I'm just trying
Background : I'm trying to convert some JavaScript code which uses the the Crossfilter
Background I am working with a monad built of a stack of transformers one
Background info I am trying to upgrade a custom CMS to support the HTML5
Background: I have several builds running on a Windows Server 2003 R2 machine via
Background We currently use OpenID for authentication of users, and use the Claimed Identity
Background Information I'm trying to build the GAUL library according to this Instructions .
Background: Some time ago, I built a system for recording and categorizing application crashes
Background I am trying to create a copy of a business object I have
Background: I am using HtmlAgilityPack (.Net), so I'm forced to use XPath 1.0, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.