rollbar / rollbar-php-laravel

Rollbar error monitoring integration for Laravel projects
https://docs.rollbar.com/docs/laravel
140 stars 39 forks source link

Cannot install Rollbar using Laravel 9.19 #158

Closed ericmp33 closed 1 month ago

ericmp33 commented 1 month ago

I'm following each step in the guide - https://docs.rollbar.com/docs/laravel#laravel-6-through-10

But seems some classes doesn't exist. For example, the docs say: Screenshot 2024-10-09 at 16 06 46

But the \Rollbar\Laravel\MonologHandler::class doesn't exist in the vendor. Screenshot 2024-10-09 at 16 13 08

Screenshot 2024-10-09 at 16 07 59

Some details of my composer.json:

        "php": "^8.0.2",
        "laravel/framework": "^9.19",
        "rollbar/rollbar-laravel": "^1.3",

In other projects using Laravel 10 and higher PHP versions, I just followed the steps and it worked. Not sure what is happening in this case. But this is how the vendor looks like in other projects, the \Rollbar\Laravel\MonologHandler::class exists in the vendor. Screenshot 2024-10-09 at 16 10 38

How can I fix it?

danielmorell commented 1 month ago

Hey @ericmp33,

Try using rollbar/rollbar-laravel v7 or even better v8. The version you are using (v1) is not compatible with Laravel 9.

ericmp33 commented 1 month ago

@danielmorell thanks for the answer. But I cannot install neither v7 nor v8. There are dependency conflicts.

composer require rollbar/rollbar-laravel:^7.0:

./composer.json has been updated
Running composer update rollbar/rollbar-laravel
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - rollbar/rollbar-laravel v7.1.0 requires rollbar/rollbar ^2 -> satisfiable by rollbar/rollbar[v2.0.0, v2.1.0].
    - rollbar/rollbar-laravel v7.2.0 requires rollbar/rollbar ^2.0 | ^3.1 -> satisfiable by rollbar/rollbar[v2.0.0, v2.1.0, v3.1.0, ..., v3.1.4].
    - rollbar/rollbar-laravel[v7.0.0, ..., v7.1.0-RC1] require illuminate/support ^6.0|^7.0|^8.0 -> found illuminate/support[v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
    - rollbar/rollbar[v2.0.0, ..., v2.1.0] require psr/log ^1 -> found psr/log[1.0.0, ..., 1.1.4] but the package is fixed to 3.0.0 (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.
    - rollbar/rollbar[v3.1.0, ..., v3.1.4] require psr/log ^1 || ^2 -> found psr/log[1.0.0, ..., 1.1.4, 2.0.0] but the package is fixed to 3.0.0 (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.
    - Root composer.json requires rollbar/rollbar-laravel ^7.0 -> satisfiable by rollbar/rollbar-laravel[v7.0.0, v7.1.0-RC1, v7.1.0, v7.2.0].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

composer require rollbar/rollbar-laravel:^8.0:

./composer.json has been updated
Running composer update rollbar/rollbar-laravel
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - rollbar/rollbar-laravel[v8.0.0-RC1, ..., v8.0.0] require illuminate/support ^10.0 -> found illuminate/support[v10.0.0, ..., 10.x-dev] but these were not loaded, likely because it conflicts with another require.
    - rollbar/rollbar-laravel v8.0.1 requires illuminate/support ^10.0|^11.0 -> found illuminate/support[v10.0.0, ..., 10.x-dev, v11.0.0, ..., 11.x-dev] but these were not loaded, likely because it conflicts with another require.
    - Root composer.json requires rollbar/rollbar-laravel ^8.0 -> satisfiable by rollbar/rollbar-laravel[v8.0.0-RC1, v8.0.0, v8.0.1].

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

I tried to fix them but I haven't get it so far. What would you do?

danielmorell commented 1 month ago

You can install rollbar/rollbar-laravel v7 by running...

composer require rollbar/rollbar-laravel:^7 -W

This will downgrade your psr/log interface from v3 to v2 and install rollbar/rollbar-laravel v7 and rollbar/rollbar v3.

To be able to install the latest Rollbar packages with support for psr/log v3, you will need to first upgrade to Laravel v10 or above.

Note: psr/log v3 adds simply void return types to the log methods.

ericmp33 commented 1 month ago

You can install rollbar/rollbar-laravel v7 by running...

composer require rollbar/rollbar-laravel:^7 -W

This will downgrade your psr/log interface from v3 to v2 and install rollbar/rollbar-laravel v7 and rollbar/rollbar v3.

To be able to install the latest Rollbar packages with support for psr/log v3, you will need to first upgrade to Laravel v10 or above.

Note: psr/log v3 adds simply void return types to the log methods.

Thanks @danielmorell ! Oh I see. Now just works! Appreciate your help.