Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

wonder95's avatar

Composer minimum stability issue with forked repo

In upgrading my Laravel/Vue app from Laravel 10 to 11, I attempted to convert our Slack notification functionality from using nathanheffley/laravel-slack-blocks to the same functionality now built in to Laravel core slack-notification-channel. However, due to a couple issues, my choice for now is to go back to the nathanheffley repo (which is much easier to use, FWIW). However, since a) it is archived, and b) the supported version of illuminate/notifications stopped at ^8.0, I did what we've done in other cases, and just forked it to our own organization, added it as a vcs repo in composer.json`

      "type": "vcs",
      "url": "[email protected]:MyOrg/laravel-slack-blocks.git"
    },

and updated the illuminate/notifications dependency in composer.json to go up to 11 (yes, that's a Spinal Tap reference)

"illuminate/notifications": "~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",

When I ran composer require nathanheffley/laravel-slack-blocks, I got this error

In PackageDiscoveryTrait.php line 327:
                                                                                                                                                     
  Package nathanheffley/laravel-slack-blocks exists in composer repo (https://repo.packagist.org) and vcs repo (github [email protected]:MyOrg/lara  
  vel-slack-blocks.git) which has a higher repository priority. The packages from the higher priority repository do not match your minimum-stabilit  
  y and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcompo  
  ser.org/repoprio for details and assistance.    

so since minimum-stability was set to dev in my new fork, I updated it to stable (to match what's in our parent project that is using this),

    "minimum-stability": "stable",
    "prefer-stable": true

but when I now run composer require nathanheffley/laravel-slack-blocks:^2, I get a similar error:

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

  Problem 1
    - Root composer.json requires nathanheffley/laravel-slack-blocks ^2, it is satisfiable by nathanheffley/laravel-slack-blocks[v2.0.0, ..., v2.3.0] from composer repo (https://repo.packagist.org) but nathanheffley/laravel-slack-blocks[2.0.x-dev] from vcs repo (github [email protected]:MyOrg/laravel-slack-blocks.git) has higher repository priority. The packages from the higher priority repository do not match your minimum-stability and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.

What else do I need to do to resolve this, since I can't access/update the original repo I forked from?

0 likes
6 replies
LaryAI's avatar
Level 58

To resolve the issue with Composer's minimum stability and repository priority, you need to ensure that your forked repository is recognized correctly and that the stability settings align with your requirements. Here are the steps to achieve this:

  1. Update the composer.json of your forked repository:

    • Ensure that the minimum-stability is set to stable and prefer-stable is set to true in your forked repository's composer.json.
    {
        "name": "myorg/laravel-slack-blocks",
        "minimum-stability": "stable",
        "prefer-stable": true,
        "require": {
            "illuminate/notifications": "~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0"
        }
    }
    
  2. Add your forked repository to your main project's composer.json:

    • Specify the VCS repository and ensure it has a higher priority than Packagist.
    {
        "repositories": [
            {
                "type": "vcs",
                "url": "[email protected]:MyOrg/laravel-slack-blocks.git"
            }
        ],
        "require": {
            "myorg/laravel-slack-blocks": "^2.0"
        },
        "minimum-stability": "stable",
        "prefer-stable": true
    }
    
  3. Require the package using your forked repository's name:

    • Instead of using nathanheffley/laravel-slack-blocks, use the name defined in your forked repository's composer.json.
    composer require myorg/laravel-slack-blocks:^2.0
    
  4. Clear Composer's cache:

    • Sometimes, Composer's cache can cause issues. Clear the cache to ensure Composer fetches the latest information.
    composer clear-cache
    
  5. Run Composer update:

    • After making these changes, run composer update to install the package from your forked repository.
    composer update
    

By following these steps, you ensure that Composer prioritizes your forked repository and respects the stability settings, allowing you to install the package without conflicts.

wonder95's avatar

Well, Larry, I have already done steps 1, 2, and 4, but when I do 3 (use the forked repo name), there are a couple problems: First, the org name has caps (e.g. MyOrg, so If I run composer require MyOrg/laravel-slack-blocks:^2, I get

 require.MyOrg/laravel-slack-blocks is invalid, it should not contain uppercase characters. Please use myorg/laravel-slack-blocks instead.

but when I do exactly that, I get

Problem 1
    - Root composer.json requires myorg/laravel-slack-blocks, it could not be found in any version, there may be a typo in the package name.
martinbean's avatar

@wonder95

This reply was automagically generated by our local A.I. Think of it as a one-off attempt to instantly solve your problem. It will not respond to further replies.

wonder95's avatar

Yes, I am very aware of LarryAI, I a) just have some fun with it, and b) I know other people can still respond here, so my response is for them.

rodrigo.pedra's avatar

Have you tried changing the package name under your fork? So composer doesn't think it is a duplicate

wonder95's avatar
wonder95
OP
Best Answer
Level 5

Ok, to avoid being DenverCoder9, here is what I ended up doing to fix this.

  1. The value it uses is not the namespace, but the name value in composer.json. I made sure it was
"name":"myorg/laravel-slack-blocks"
  1. Apparently when you fork a repo, it doesn't bring over the tags and releases. Once I manually created a tag and then a release pointing to that tag, I was able to install it via composer require.

Please or to participate in this conversation.