php-casbin / laravel-authz

An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.
Apache License 2.0
272 stars 46 forks source link

The requirement does not work in Laravel version 10 #65

Closed NikolayIvanovichGavrilov closed 2 months ago

NikolayIvanovichGavrilov commented 2 months ago

Good afternoon, there was a problem when executing the command: composer require casbin/laravel-authz

Please tell me what could be the problem?

Laravel version: "laravel/framework": "^10.10", Thanks!

Problem 1

  • casbin/laravel-authz[v0.1, ..., v0.2, v1.0.0] require laravel/framework ~5.1 -> found laravel/framework[v5.1.0, ..., v5.8.38] but it conflicts with your root composer.json require (^10.10).
  • casbin/laravel-authz[v1.1.0, ..., v1.2.0] require laravel/framework ~5.1|~6.0 -> found laravel/framework[v5.1.0, ..., v5.8.38, v6.0.0, ..., v6.20.44] but it conflicts with your root composer.json require (^10.10).
  • casbin/laravel-authz v1.3.0 requires laravel/framework ~5.5|~6.0 -> found laravel/framework[v5.5.0, ..., v5.8.38, v6.0.0, ..., v6.20.44] but it conflicts with your root composer.json require (^10.10).
  • casbin/laravel-authz[v1.4.0, ..., v1.5.0] require laravel/framework ~5.5|~6.0|~7.0 -> found laravel/framework[v5.5.0, ..., v5.8.38, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6] but it conflicts with your root composer.json require (^10.10).
  • casbin/laravel-authz[v1.6.0, v2.0.0, ..., v2.5.1, v3.0.0, ..., v3.0.2] require laravel/framework ~5.5|~6.0|~7.0|~8.0 -> found laravel/framework[v5.5.0, ..., v5.8.38, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27] but it conflicts with your root composer.json require (^10.10).
  • casbin/laravel-authz v3.1.0 requires illuminate/support ~5.5|~6.0|~7.0|~8.0 -> found illuminate/support[v5.5.0, ..., v5.8.36, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27] but these were not loaded, likely because it conflicts with another require.
  • casbin/laravel-authz[v3.1.1, ..., v3.1.3] require illuminate/support ~5.5|~6.0|~7.0|~8.0|~9.0 -> found illuminate/support[v5.5.0, ..., v5.8.36, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.16] but these were not loaded, likely because it conflicts with another require.
  • casbin/laravel-authz[v3.1.4, ..., v3.1.5] require casbin/casbin ~3.1 -> found casbin/casbin[v3.1.0, ..., v3.21.5] but it conflicts with your root composer.json require (^0.1.1).
  • Root composer.json requires casbin/laravel-authz * -> satisfiable by casbin/laravel-authz[v0.1, v0.2, v1.0.0, ..., v1.6.0, v2.0.0, ..., v2.5.1, v3.0.0, ..., v3.1.5].

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 casbin/laravel-authz:*" to figure out if any version is installable, or "composer require casbin/laravel-authz:^2.1" if you know which you need.

hsluoyz commented 2 months ago

@leeqvip

leeqvip commented 2 months ago

@NikolayIvanovichGavrilov Please show the complete composer.json file content

NikolayIvanovichGavrilov commented 2 months ago

Hi! This setting helped me, I will be glad if it helps someone else: I configured everything through Docker, the console in Docker apparently did not show me all the errors as shown above. But now I think that the problem was in the composer himself

Along with this I added extensions to php.ini extension=fileinfo extension=sodium That being said, I decided to use composer not in the docker console (exec), but on my PC. And everything worked for me. Composer.json attached

Which was originally:

{ "name": "laravel/laravel", "type": "project", "description": "The skeleton application for the Laravel framework.", "keywords": ["laravel", "framework"], "license": "MIT", "require": { "php": "^8.1", "darkaonline/l5-swagger": "^8.5", "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^10.10", "laravel/sanctum": "^3.3", "laravel/tinker": "^2.8", "php-open-source-saver/jwt-auth": "^2.1", }, "require-dev": { "fakerphp/faker": "^1.9.1", "laravel/pint": "^1.0", "laravel/sail": "^1.18", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^7.0", "phpunit/phpunit": "^10.1", "spatie/laravel-ignition": "^2.0" }, "autoload": { "psr-4": { "App\": "app/", "Database\Factories\": "database/factories/", "Database\Seeders\": "database/seeders/" } }, "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, "allow-plugins": { "pestphp/pest-plugin": true, "php-http/discovery": true } }, "minimum-stability": "stable", "prefer-stable": true }

Thank you!

leeqvip commented 2 months ago

@NikolayIvanovichGavrilov So is the problem solved? If so please close it.