Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer - adding git repository without composer.json

I try to add repository from github (designmodo/Flat-UI), play with config and get errors No valid composer.json was found in any branch or..., Your requirements could not be resolved to an installable set of packages., The requested package designmodo/flat-ui could not be found in any version

What mistake I made in config:

"repositories": {
   "flat-ui": {
     "type": "package",
     "package": {
       "name": "designmodo/Flat-UI", 
       "version": "1.3.0", // Don't know is it important? Where get this number in repo?
       "source": {
         "url": "https://github.com/designmodo/Flat-UI",
         "type": "git",
         "reference": "dev-master" // reference is branch name? 
       }
     }
   }
 },

 "require": {
   "twbs/bootstrap-sass": "~3.2",
   "designmodo/Flat-UI": "dev-master" // branch again (/minimum-stability?)
 },

At some point composer download package but return error (i don't know when he did it, I lookup in vendor folder and designmodo folder was be there).

like image 716
Sonique Avatar asked Oct 03 '14 14:10

Sonique


People also ask

How do I create a composer JSON file?

To configure Composer for your PHP app json file specifies required packages. Verify that a composer. json file is present in the root of your git repository. Run composer install (on your local machine) to install the required packages and generate a composer.

What is repositories in composer json?

A repository is a package source. It's a list of packages/versions. Composer will look in all your repositories to find the packages your project requires. By default, only the Packagist.org repository is registered in Composer. You can add more repositories to your project by declaring them in composer.

Where is the composer JSON file?

composer. json is a JSON file placed in the root folder of PHP project. Its purpose is to specify a common project properties, meta data and dependencies, and it is a part of vast array of existing projects.


Video Answer


1 Answers

Problem solved. Play around and changed reference to master and version to any * in "designmodo/Flat-UI": "*" section. After that composer download package via git and update composer.lock without problems. Should work for any github repos.

Working config:

{
    "repositories": {
      "flat-ui": {
        "type": "package",
        "package": {
          "name": "designmodo/Flat-UI",
          "version": "1.3.0",
          "source": {
            "url": "https://github.com/designmodo/Flat-UI",
            "type": "git",
            "reference": "master"
          }
        }
      }
    },
    "require": {
        "twbs/bootstrap-sass": "~3.2",
        "designmodo/Flat-UI": "*"
    },
}

https://getcomposer.org/doc/05-repositories.md

like image 191
Sonique Avatar answered Sep 19 '22 05:09

Sonique