DirectoryTree / LdapRecord-Laravel

Multi-domain LDAP Authentication & Management for Laravel.
https://ldaprecord.com/docs/laravel/v3
MIT License
512 stars 54 forks source link

[Bug] PSR-SimpleCache >= v2.0 not available in Laravel 8 #541

Closed ubay25 closed 1 year ago

ubay25 commented 1 year ago

Environment:

When I try to install using the command below, it throws an error.

composer require directorytree/ldaprecord-laravel

Using version ^3.0 for directorytree/ldaprecord-laravel
./composer.json has been updated
Running composer update directorytree/ldaprecord-laravel
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - directorytree/ldaprecord v3.0.0 requires psr/simple-cache ^2.0|^3.0 -> found psr/simple-cache[dev-master, 2.0.0, 2.x-dev, 3.0.0, 3.0.x-dev (alias of dev-master)] but the package is fixed to 1.0.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - directorytree/ldaprecord-laravel[v3.0.0, ..., v3.0.1] require directorytree/ldaprecord v3.0 -> satisfiable by directorytree/ldaprecord[v3.0.0].
    - Root composer.json requires directorytree/ldaprecord-laravel ^3.0 -> satisfiable by directorytree/ldaprecord-laravel[v3.0.0, v3.0.1].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require directorytree/ldaprecord-laravel:*" to figure out if any version is installable, or "composer require directorytree/ldaprecord-laravel:^2.1" if you know which you need.

I also tried to delete the composer.lock as you suggested on a previous post and this is what I get.

Using version ^3.0 for directorytree/ldaprecord-laravel
./composer.json has been updated
Running composer update directorytree/ldaprecord-laravel
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires directorytree/ldaprecord-laravel ^3.0 -> satisfiable by directorytree/ldaprecord-laravel[v3.0.0, v3.0.1].
    - Root composer.json requires hakkahio/laravel-azure-ad-oauth-laravel-8 ^1.3 -> satisfiable by hakkahio/laravel-azure-ad-oauth-laravel-8[v1.3.0].
    - hakkahio/laravel-azure-ad-oauth-laravel-8 v1.3.0 requires laravel/framework >5.4 -> satisfiable by laravel/framework[v8.75.0, ..., 8.x-dev].
    - laravel/framework[v8.75.0, ..., 8.x-dev] require psr/simple-cache ^1.0 -> satisfiable by psr/simple-cache[1.0.0, 1.0.1].
    - Conclusion: don't install psr/simple-cache 1.0.1 (conflict analysis result)

You can also try re-running composer require with an explicit version constraint, e.g. "composer require directorytree/ldaprecord-laravel:*" to figure out if any version is installable, or "composer require directorytree/ldaprecord-laravel:^2.1" if you know which you need.

Any ideas? Thanks!

stevebauman commented 1 year ago

Hi @ubay25,

I didn't realize that Laravel 8 requires psr-simple-cache v1.0:

https://github.com/laravel/framework/blob/99fa2e33da0e6534bdc698bc6e6e685303111d5f/composer.json#LL33C14-L33C14

Where Laravel >= 9 allows psr-simple-cache v1.0|v2.0|v3.0:

https://github.com/laravel/framework/blob/e217dca49e20cd2840970f8d307c8392012bc5be/composer.json#L40

I'll see if there's a way around this in LdapRecord-Laravel so that v1.0 can be used. It may not be possible due to the major differences between v1.0 and v2.0.

ubay25 commented 1 year ago

Thanks Steve! I'm really looking forward to using this package and just stuck on this. Would really appreciate if you can get this fixed. :)

stevebauman commented 1 year ago

Hi @ubay25! This should now be resolved 🎉

Can you try requiring directorytree/ldaprecord-laravel again? Let me know if you encounter issues, thanks for the report! 🙏

ubay25 commented 1 year ago

Hi @stevebauman thanks for the update, much appreciated!

Below is what I still get when I now do -- composer require directorytree/ldaprecord-laravel

Using version ^3.0 for directorytree/ldaprecord-laravel
./composer.json has been updated
Running composer update directorytree/ldaprecord-laravel
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - directorytree/ldaprecord v3.0.0 requires psr/simple-cache ^2.0|^3.0 -> found psr/simple-cache[dev-master, 2.0.0, 2.x-dev, 3.0.0, 3.0.x-dev (alias of dev-master)] but the package is fixed to 1.0.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - directorytree/ldaprecord-laravel[v3.0.0, ..., v3.0.3] require directorytree/ldaprecord v3.0 -> satisfiable by directorytree/ldaprecord[v3.0.0].
    - Root composer.json requires directorytree/ldaprecord-laravel ^3.0 -> satisfiable by directorytree/ldaprecord-laravel[v3.0.0, v3.0.1, v3.0.2, v3.0.3].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require directorytree/ldaprecord-laravel:*" to figure out if any version is installable, or "composer require directorytree/ldaprecord-laravel:^2.1" if you know which you need.

Sorry if this is not the result you want to see :( Happy to assist if you need anything, thank you!

stevebauman commented 1 year ago

Hey @ubay25! No worries at all -- do you have directorytree/ldaprecord v3.0.0 specified in your composer.json file? If so, can you remove it completely and just require directorytree/ldaprecord-laravel?

ubay25 commented 1 year ago

Hi @stevebauman I've checked my composer.json file and it does not have any entry for directorytree/ldaprecord.

Thanks!

stevebauman commented 1 year ago

Ah you're right @ubay25! Please try again 🙏 -- this should now be fixed. composer.json constraints were incorrect.

ubay25 commented 1 year ago

Hi @stevebauman thank you for the help so far! The issue with PSR-SimpleCache has now disappeared, so thank you for that! :)

Now, below is what it's showing now when I require directorytree/ldaprecord-laravel.

Using version ^3.0 for directorytree/ldaprecord-laravel
./composer.json has been updated
Running composer update directorytree/ldaprecord-laravel
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - nette/schema v1.2.2 requires php >=7.1 <8.2 -> your php version (8.2.7) does not satisfy that requirement.
    - league/commonmark 2.3.6 requires league/config ^1.1.1 -> satisfiable by league/config[v1.1.1].
    - laravel/framework v8.83.25 requires league/commonmark ^1.3|^2.0.2 -> satisfiable by league/commonmark[2.3.6].
    - league/config v1.1.1 requires nette/schema ^1.2 -> satisfiable by nette/schema[v1.2.2].
    - laravel/framework is locked to version v8.83.25 and an update of this package was not requested.

It looks like my PHP version doesn't meet the nette/schema requirement. Do I need to downgrade my PHP version in this case?

stevebauman commented 1 year ago

Happy to help @ubay25!

Can you post your composer.json file?

ubay25 commented 1 year ago

Hi @stevebauman sure no problem :)

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^7.3|^8.0",
        "barryvdh/laravel-dompdf": "^2.0",
        "doctrine/dbal": "^3.5",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "hakkahio/laravel-azure-ad-oauth-laravel-8": "^1.3",
        "intervention/image": "^2.7",
        "laravel/framework": "^8.75",
        "laravel/sanctum": "^2.11",
        "laravel/tinker": "^2.5",
        "laravelcollective/html": "^6.3",
        "maatwebsite/excel": "^3.1",
        "spatie/laravel-permission": "^5.5",
        "stackkit/laravel-database-emails": "^6.0"
    },
    "require-dev": {
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^5.10",
        "phpunit/phpunit": "^9.5.10"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        },
        "files": [
            "app/helpers.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}
stevebauman commented 1 year ago

This issue doesn't appear to be associated with LdapRecord-Laravel. Can you try deleting your composer.lock file and running composer update again?

It looks like it's attempting to download v1.2.2 of nette/schema which requires PHP < 8.2:

https://github.com/nette/schema/blob/9a39cef03a5b34c7de64f551538cbba05c2be5df/composer.json#L18

Hopefully clearing the composer.lock attempts to download the latest v1.2.3 which requires PHP < 8.3:

https://github.com/nette/schema/blob/abbdbb70e0245d5f3bf77874cea1dfb0c930d06f/composer.json#L18

ubay25 commented 1 year ago

That did the trick! Thank you very much @stevebauman , you're the man!!! :)

stevebauman commented 1 year ago

Excellent! Glad you were able to resolve this @ubay25, and thank you! 😄