Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading a composer package through a Github fork

Tags:

composer-php

I forked a library on Github and now want to load my fork into the project without adding the forked library into packagist. I get the following error after adding the repository and require to my composer.json:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package cnizzardini/ssl-certificate could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

Here is my full composer.json

{
    "name": "cakephp/app",
    "description": "CakePHP skeleton app",
    "homepage": "http://cakephp.org",
    "type": "project",
    "license": "MIT",
    "require": {
        "php": ">=5.5.9",
        "cakephp/cakephp": "~3.4",
        "mobiledetect/mobiledetectlib": "2.*",
        "cakephp/migrations": "~1.0",
        "cakephp/plugin-installer": "*",
        "guzzlehttp/guzzle": "^6.2",
        "donatj/phpuseragentparser": "^0.7.0",
        "cnizzardini/ssl-certificate": "dev-master"
    },
    "require-dev": {
        "psy/psysh": "@stable",
        "cakephp/debug_kit": "~3.2",
        "cakephp/bake": "~1.1",
        "phpunit/phpunit": "^5.5"
    },
    "suggest": {
        "phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
        "cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
    },
    "autoload": {
        "psr-4": {
            "App\\": "src",
            "Api\\": "./plugins/Api/src",
            "Channel\\": "./plugins/Channel/src",
            "System\\": "./plugins/System/src",
            "Admin\\": "./plugins/Admin/src"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Test\\": "tests",
            "Cake\\Test\\": "./vendor/cakephp/cakephp/tests",
            "Api\\Test\\": "./plugins/Api/tests",
            "Channel\\Test\\": "./plugins/Channel/tests",
            "System\\Test\\": "./plugins/System/tests",
            "Admin\\Test\\": "./plugins/Admin/tests"
        }
    },
    "scripts": {
        "post-install-cmd": "App\\Console\\Installer::postInstall",
        "post-create-project-cmd": "App\\Console\\Installer::postInstall",
        "post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/cnizzardini/ssl-certificate.git"
        }
    ],
    "minimum-stability": "stable",
    "prefer-stable": true
}

I have tried adding https://github.com/cnizzardini/ssl-certificate with and without the .git. I have also tried setting minimum-stability to dev and prefer-stable to false.

Nothing works :-(

like image 929
cnizzardini Avatar asked Jul 28 '17 15:07

cnizzardini


1 Answers

The composer.json file on your fork still calls the package "spatie/ssl-certificate", so that's the name of the package you need to require.

This should work:

{
    ...
    "require": {
        ...
        "spatie/ssl-certificate": "dev-master"
    },
    ...
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/cnizzardini/ssl-certificate.git"
        }
    ],
    ...
}

If it doesn't, you can rename the package on your own fork by changing the name property in its composer.json file:

{
    "name": "cnizzardini/ssl-certificate",
    "description": "A class to easily query the properties of an ssl certificate ",
    ...
}
like image 163
rickdenhaan Avatar answered Nov 13 '22 15:11

rickdenhaan