Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error require illuminate/cache Laravel 12 #3295

Closed
hierro59 opened this issue Mar 2, 2025 · 5 comments
Closed

error require illuminate/cache Laravel 12 #3295

hierro59 opened this issue Mar 2, 2025 · 5 comments

Comments

@hierro59
Copy link

hierro59 commented Mar 2, 2025

  • Laravel-mongodb Version: 5.1
  • PHP Version: 8.3
  • Database Driver & Version: NA

Description:

I'm having trouble installing the MongoDB package with composer.

Steps to reproduce

  1. run composer require mongodb/laravel-mongodb

Expected behaviour

install package

Actual behaviour

aborts installation

Logs: Problem 1 - mongodb/laravel-mongodb[5.1.0, ..., 5.1.1] require illuminate/cache ^10.36|^11 -> found illuminate/cache[v10.36.0, ..., v10.48.28, v11.0.0, ..., v11.44.0] but these were not loaded, likely because it conflicts with another require. - Root composer.json requires mongodb/laravel-mongodb ^5.1 -> satisfiable by mongodb/laravel-mongodb[5.1.0, 5.1.1].
@wivaku
Copy link
Contributor

wivaku commented Mar 3, 2025

While waiting for Laravel v12 support (#3283), as Laravel v12 is advertised to be backwards compatible with v11, as a workaround you could fake it by telling composer the required (v11) packages are there:

    "provide": {
        "illuminate/support": "^11.0",
        "illuminate/events": "^11.0",
        "illuminate/database": "^11.0",
        "illuminate/container": "^11.0",
        "illuminate/cache": "^11.0",
        "illuminate/contracts": "^11.0"
    },

But, best to wait for official v12 support.

@hierro59
Copy link
Author

hierro59 commented Mar 3, 2025

While waiting for Laravel v12 support (#3283), as Laravel v12 is advertised to be backwards compatible with v11, as a workaround you could fake it by telling composer the required (v11) packages are there:

    "provide": {
        "illuminate/support": "^11.0",
        "illuminate/events": "^11.0",
        "illuminate/database": "^11.0",
        "illuminate/container": "^11.0",
        "illuminate/cache": "^11.0",
        "illuminate/contracts": "^11.0"
    },

But, best to wait for official v12 support.

This works for me. Now that the Laravel 12 support issue is resolved, I hope a composer update will fix it. Thanks.

@GromNaN
Copy link
Member

GromNaN commented Mar 3, 2025

Laravel 12 is now supported in version 5.2.0.

@GromNaN GromNaN closed this as completed Mar 3, 2025
@hierro59
Copy link
Author

hierro59 commented Mar 3, 2025

Laravel 12 is now supported in version 5.2.0.

It is definitely not possible to use it with Laravel 12. Not even trying to trick it.

Here's what happens:
local.ERROR: Too few arguments to function Illuminate\Database\Grammar::__construct(), 0 passed in C:\laragon\www\quantlas\AteneaMetis\api-metis-multi\vendor\mongodb\laravel-mongodb\src\Connection.php on line 336 and exactly 1 expected {"userId":1,"exception":"[object] (ArgumentCountError(code: 0): Too few arguments to function Illuminate\\Database\\Grammar::__construct(), 0 passed in C:\\laragon\\www\\quantlas\\AteneaMetis\\api-metis-multi\\vendor\\mongodb\\laravel-mongodb\\src\\Connection.php on line 336 and exactly 1 expected at C:\\laragon\\www\\quantlas\\AteneaMetis\\api-metis-multi\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Grammar.php:27)

But I solved it the inelegant way
composer require mongodb/mongodb

@GromNaN
Copy link
Member

GromNaN commented Mar 3, 2025

You need to update to mongodb/laravel-mongodb: ^5.2.

The error you reported is if you try to use the version 5.1.1 with Laravel 12, which is not possible with version constraints in composer.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants