2

I have a symfony project with some bundles.
I have a bundle which is not in github (proprietary in our own server). So, we have a functionnal git repository in our server.
This is a generical bundle, so we need to use it with composer.

I am looking for a way to add the repository in my composer.json (for each Symfony project)
I red this article http://marekkalnik.tumblr.com/post/22929686367/composer-installing-package-from-local-git-repository but it doesn't work...

"require": {
    ...
    "bt/commonbundle": "dev-master"

},
"repositories" : [{
    "type" : "vcs",
    "url" : "/absolute/path/to/my/repo/CommonBundle.git"
}],  

CommonBundle.git is a bare repo (i also tried with the working dir...)
I tried with vcs type and git type

The result is :

[Composer\Repository\InvalidRepositoryException]  
    No valid composer.json was found in any branch or tag of /absolute/path/to/my/repo/CommonBundle.git, could not load a package from it.  

I typed "composer validate" in my bundle and my json is valid

Do you have solution for this kind of problem ?
I would like :

  • Use composer (cmd: composer update)
  • to see my proprietary bundle in the vendor folder

Edit :
Thank to pozs, I forgot to commit my composer.json file....
But now, composer ask me to install symfony/icu, but I don't use this, so why ?
I can't install the php library

Thank you,
Best regards

6
  • 1
    Are you sure, your composer.json file is committed (and even pushed, if the repo is not a local copy)? Commented Jul 8, 2014 at 10:58
  • Yes, my composer.json file is in my bundle directory and in my bare repo. Commented Jul 8, 2014 at 11:43
  • Well, your error specifically says, that the composer.json file cannot be found there (in any branch/tag) -- but it could found the git repo itself. Could you do a fresh clone from /absolute/path/to/my/repo/CommonBundle.git to see what's in there? Commented Jul 8, 2014 at 11:49
  • Arrghhh, I am so stupid. Indeed, I did'nt commit the composer file ....... But now, I have a message that ask me to install symfony/icu, I don't use this, so why ? Commented Jul 8, 2014 at 12:15
  • One/some of your required packages may require it (but in that case composer would just install it, not demand it) ... maybe symfony.com/doc/current/components/intl.html ? Commented Jul 8, 2014 at 12:20

2 Answers 2

2

You must writing another composer.json in your repository, for example:

{
    "name": "nameOfYourBundle",
    "type": "symfony-bundle",
    "description": "some description",
    "authors": [
        {
            "name": "author",
            "homepage": "http://homepage"
        }
    ],
    "require": {
    },
    "require-dev": {
    },
    "autoload": {
        "psr-4": { "path\\to\\your\\bundle": "" } // psr-4/psr-0 is for structure files
    }
}
Sign up to request clarification or add additional context in comments.

Comments

0

Take a look on this snipet

{
    "require": {
        "notihnio/foo": "master"
    },
    "repositories": [
        {
            "type": "vcs",
            "url":  "https://username:[email protected]/notihnio/foo"
        }
    ]
}

i have also created a post for this. https://notihnio.tumblr.com/post/142674566481/using-composer-with-private-packages

1 Comment

Is this an answer? If so, what does the snippet do to solve the OP's original question and/or problem?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.