3

This package nesk/puphpeteer has been archived and doesn't work with Laravel 9 anymore. There are however forks that I believe will work with Laravel 9 since the dependencies in the composer errors have been updated in the forks. I tried these steps in the composer docs but can't seem to install a fork as a composer dependency. Any guidance in the right direction would be appreciated.

In my composer.json I have these new entries.

{
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/NigelCunningham/puphpeteer.git"
    }
],
"require": {
    "nesk/puphpeteer": "dev-dev"
}

}

When I run composer update I get the following error:

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

Problem 1
    - Root composer.json requires nesk/puphpeteer dev-dev -> satisfiable by nesk/puphpeteer[dev-dev]."
steven7mwesigwa
  • 5,701
  • 3
  • 20
  • 34
dfeva
  • 81
  • 2
  • 11
  • What **exactly** have you tried so far? – Nico Haase Feb 04 '23 at 11:57
  • @NicoHaase, I added steps to reproduce above in the edit. – dfeva Feb 04 '23 at 17:09
  • 2
    ttps://github.com/NigelCunningham/puphpeteer does not contain any branch named `dev-dev`, nor any such tag. Neither does the other repository – Nico Haase Feb 05 '23 at 12:45
  • NigelCunningham/puphpeteer says Defauly branch = dev and the other is zoon. The composer docs above say to prefix custom branch names with "dev-". I'm not sure what I'm doing wrong. I'm just trying to use https://github.com/NigelCunningham/puphpeteer fork default branch. – dfeva Feb 05 '23 at 23:28
  • The document just teaching you how to fork a branch for custom maintain version not solution. – Charlie Feb 06 '23 at 13:02
  • And it link to two forks maintained by the community, so either you install `zoonru/puphpeteer` or `NigelCunningham/puphpeteer`. – Charlie Feb 06 '23 at 13:04
  • You can use this version https://github.com/sietzekeuning/puphpeteer which he send a pull request "Support Laravel 9" but not accepted, origin from https://github.com/rialto-php/puphpeteer/pull/166. – Charlie Feb 06 '23 at 13:14

3 Answers3

4

Summary

At the time of writing this post, https://github.com/NigelCunningham/puphpeteer.git isn't ready for Laravel 9.

Explanation

I tried installing it on the first stable version of Laravel v9.0.0 (composer create-project laravel/laravel example-app 9.0.0).

composer.json (new entries)

{
    "repositories": [
        {
            "url": "https://github.com/NigelCunningham/puphpeteer.git",
            "type": "git"
        }
    ],
    "require": {
        "nigelcunningham/puphpeteer": "^2.0.0"
    },

    "minimum-stability": "dev"
}

You may need to install or enable PHP's sockets extension.

It threw the error below: composer update

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

  Problem 1
    - symfony/process[v4.0.0-BETA1, ..., v4.4.10] require php ^7.1.3 -> your php version (8.1.6) does not satisfy that requirement.
    - symfony/process[v5.0.0-BETA1, ..., v5.0.0-RC1] require php ^7.2.9 -> your php version (8.1.6) does not satisfy that requirement.
    - symfony/process[v5.0.0, ..., v5.1.0-RC1] require php ^7.2.5 -> your php version (8.1.6) does not satisfy that requirement.
    - Root composer.json requires laravel/framework ^9.0 -> satisfiable by laravel/framework[v9.0.0-beta.1, ..., 9.x-dev].
    - Root composer.json requires nigelcunningham/puphpeteer ^2.0.0 -> satisfiable by nigelcunningham/puphpeteer[2.0.0].
    - Conclusion: don't install symfony/console[v6.0.19] | install symfony/process[v5.4.19] (conflict analysis result)
    - Conclusion: don't install symfony/console[v6.0.3] | install symfony/process[v5.4.19] (conflict analysis result)
    - Conclusion: don't install nunomaduro/collision[v6.4.0] | install symfony/process[v5.4.19] (conflict analysis result)
    - Conclusion: don't install symfony/process v5.4.19 (conflict analysis result)
    - Conclusion: don't install symfony/console[v6.2.5] | install symfony/process[v5.4.19] (conflict analysis result)
    - nigelcunningham/puphpeteer 2.0.0 requires nesk/rialto ^1.2.0 -> satisfiable by nesk/rialto[1.2.0, 1.2.1, 1.3.0, 1.4.0].
    - nesk/rialto 1.4.0 requires symfony/process ^3.3|^4.0|^5.0 -> satisfiable by symfony/process[v3.3.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev].
    - nesk/rialto[1.2.0, ..., 1.3.0] require symfony/process ^3.3|^4.0 -> satisfiable by symfony/process[v3.3.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev].
    - symfony/console 6.3.x-dev conflicts with symfony/process v5.3.14.
    - symfony/console 6.3.x-dev conflicts with symfony/process v5.3.2.
    - symfony/console 6.3.x-dev conflicts with symfony/process v5.0.11.
    - symfony/console 6.3.x-dev conflicts with symfony/process v4.4.44.
    - symfony/console 6.3.x-dev conflicts with symfony/process v4.4.26.
    - symfony/console 6.3.x-dev conflicts with symfony/process v3.4.47.
    - symfony/console 6.3.x-dev conflicts with symfony/process v3.3.6.
    - nunomaduro/collision[v6.1.0, ..., v6.2.1] require symfony/console ^6.0.2 -> satisfiable by symfony/console[v6.0.2, ..., 6.3.x-dev].
    - Root composer.json requires nunomaduro/collision ^6.1 -> satisfiable by nunomaduro/collision[v6.1.0, ..., v6.x-dev].

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

If you aim your focus on this line below:

- nigelcunningham/puphpeteer 2.0.0 requires nesk/rialto ^1.2.0 -> satisfiable by nesk/rialto[1.2.0, 1.2.1, 1.3.0, 1.4.0].

The package nigelcunningham/puphpeteer requires the dependency nesk/rialto, whose latest version dev-dev requires symfony/process: ^3.3|^4.0|^5.0. Unfortunately, Laravel v9.0.0 (laravel/framework) requires symfony/process: ^6.0 making it incompatible.


Moving forward, in your question, you declared a required dependency in your composer.json file "nesk/puphpeteer": "dev-dev". This follows the same incompatibility issue with Laravel v9.0.0 as explained above.

It threw the error below: composer update

 - nesk/puphpeteer dev-dev requires nesk/rialto ^1.2.0 -> satisfiable by nesk/rialto[1.2.0, 1.2.1, 1.3.0, 1.4.0].
    - nesk/rialto 1.4.0 requires symfony/process ^3.3|^4.0|^5.0 -> satisfiable by symfony/process[v3.3.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev].

Addendum

Comment from the OP (dfeva)

Thanks for the great answer! it looks like this nesk/rialto fork is updated to symphony/process ^6.0. github.com/zoonru/rialto/blob/zoon/composer.json. How can I install that first so then I should be able to install github.com/zoonru/puphpeteer if im understating correctly. Thanks for your help!

To achieve that, you can use:

composer.json (new entries)

{
    "repositories": [
        {
            "url": "https://github.com/zoonru/rialto.git",
            "type": "git"
        },
        {
            "url": "https://github.com/zoonru/puphpeteer.git",
            "type": "git"
        }
    ],
    "require": {
        "nesk/puphpeteer": "dev-master"
    },

    "minimum-stability": "dev"
}

The unfortunate news is that, at the time of writing this post, the latest git tag (Version 1.4.0 released on Apr 12, 2020) for the zoonru/rialto dependency depended on the old "symfony/process": "^3.3|^4.0|^5.0" versions.

The newer changes linked in your comment aiming at supporting new Symfony components ("symfony/process": "^3.3 || ^4.0 || ^5.0 || ^6.0") were made at a later date, Aug 16, 2022. Sadly, a newer git tag reflecting these changes hasn't been officially released yet.

Temporary Solution (use with caution)

If you still insist on wanting to install zoonru/puphpeteer, you may need to fork https://github.com/zoonru/rialto and create a new git tag reflecting the newer changes that were made on the repository.

Steps

  1. Fork the zoonru/rialto repository. Read Forking a repository.
  2. Clone your forked version of the repository. Read Cloning a repository
  3. Create an annotated git tag on your forked repository version. Read Create a tag in a GitHub repository
    • At the root path of your forked repository, open your terminal. Run the command: git tag 1.5.0 -a to create a new git tag. (Include a description with your tag. I.e: Version 1.5.0)
    • Push your new git tag to your remote forked repository using the command: git push origin --tags
  4. You should now be able to see your latest git tag on your remote forked repository. I.e: https://github.com/steven7mwesigwa/rialto/tags
    • https://github.com/YOUR-GITHUB-USERNAME-HERE/rialto/tags
  5. Now, in your Laravel project's composer.json file, instead of https://github.com/zoonru/rialto.git, use your newly forked remote repo version. I.e: https://github.com/steven7mwesigwa/rialto.git

composer.json (new entries)

{
    "repositories": [
        {
            "url": "https://github.com/steven7mwesigwa/rialto.git",
            "type": "git"
        },
        {
            "url": "https://github.com/zoonru/puphpeteer.git",
            "type": "git"
        }
    ],
    "require": {
        "nesk/puphpeteer": "dev-master"
    },

    "minimum-stability": "dev"
}

You may replace https://github.com/steven7mwesigwa/rialto.git with your new forked remote repo URL instead.

  1. At the root of your Laravel project, open the terminal, and run the command composer update which will install zoonru/puphpeteer.

Sample output

A. composer show nesk/rialto -a

PS C:\xampp\htdocs\example-app> composer show nesk/rialto -a
name     : nesk/rialto
descrip. : Manage Node resources from PHP
keywords : php, node, wrapper, communication, bridge, socket
versions : 1.5.0, 1.4.0, 1.3.0, 1.2.1, 1.2.0, 1.1.0, 1.0.2, 1.0.1, 1.0.0, 0.1.2, 0.1.1, 0.1.0, dev-zoon, dev-dev
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage :
source   : [git] https://github.com/steven7mwesigwa/rialto.git c6ffad796941eaaf166c089f116a762f1c79d2e4
dist     : []
names    : nesk/rialto

autoload
psr-4
Nesk\Rialto\ => src/

requires
php ^7.2 || ^8.0
clue/socket-raw ^1.2
psr/log ^1.0 || ^2.0 || ^3.0
symfony/process ^3.3 || ^4.0 || ^5.0 || ^6.0

requires (dev)
monolog/monolog ^1.0 || ^2.0 || ^3.0
phpunit/phpunit ^8.0 || ^9.0

suggests
ext-weakref Required to run all the tests

B. composer update

PS C:\xampp\htdocs\example-app> composer update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 4 installs, 1 update, 0 removals
  - Locking clue/socket-raw (v1.6.0)
  - Locking nesk/puphpeteer (dev-master 52bd425)
  - Locking nesk/rialto (1.5.0)
  - Downgrading psr/log (3.0.0 => 1.1.4)
  - Locking vierbergenlars/php-semver (v3.0.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 4 installs, 1 update, 0 removals
  - Syncing nesk/rialto (1.5.0) into cache
  - Syncing nesk/puphpeteer (dev-master 52bd425) into cache
  - Downgrading psr/log (3.0.0 => 1.1.4): Extracting archive
  - Installing vierbergenlars/php-semver (v3.0.3): Extracting archive
  - Installing clue/socket-raw (v1.6.0): Extracting archive
  - Installing nesk/rialto (1.5.0): Cloning c6ffad7969 from cache
  - Installing nesk/puphpeteer (dev-master 52bd425): Cloning 52bd42570e from cache
1 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   INFO  Discovering packages.

  fruitcake/laravel-cors ........................................................................................ DONE
  laravel/sail .................................................................................................. DONE
  laravel/sanctum ............................................................................................... DONE
  laravel/tinker ................................................................................................ DONE
  nesbot/carbon ................................................................................................. DONE
  nunomaduro/collision .......................................................................................... DONE
  nunomaduro/termwind ........................................................................................... DONE
  spatie/laravel-ignition ....................................................................................... DONE

84 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force

   INFO  No publishable resources for tag [laravel-assets].

No security vulnerability advisories found

Hopefully, you will remember to replace your forked repository URL I.e: https://github.com/steven7mwesigwa/rialto.git with the original https://github.com/zoonru/rialto.git repo URL in your Laravel project's composer.json file and reinstall zoonru/puphpeteer once zoonru/rialto releases a new official git tag when that time comes.

steven7mwesigwa
  • 5,701
  • 3
  • 20
  • 34
  • 1
    Thanks for the great answer! it looks like this nesk/rialto fork is updated to symphony/process ^6.0. https://github.com/zoonru/rialto/blob/zoon/composer.json. How can I install that first so then I should be able to install https://github.com/zoonru/puphpeteer if im understating correctly. Thanks for your help! – dfeva Feb 10 '23 at 19:53
  • @dfeva Please, check the **Addendum** section of my edited answer. – steven7mwesigwa Feb 11 '23 at 01:26
  • 1
    if i had more bounty to give I would. I'm going to implement your solution above asap and let you know my results. I'm also in contact with both fork creators via email, I will inform them of your detailed steps. I'm sure many upgrading to Laravel 9 or 10 will appreciate your answer as well. -Patryk – dfeva Feb 11 '23 at 02:24
  • @dfeva Thanks for the compliment. Did you implement the solution already? Did it resolve your issue? – steven7mwesigwa Feb 12 '23 at 04:51
  • 1
    Thank you! Just implemented it and it works on Laravel 9. psr/log did get downgraded from 3.0.0 to 1.1.4, I'll see what trouble that causes in the framework. Besides pointing new chromium driver version to the path and installing these dependencies https://github.com/puppeteer/puppeteer/issues/5662#issuecomment-775074462 everything is working so far! Thank you thank you! – dfeva Feb 18 '23 at 20:34
  • 1
    @dfeva You're most welcome! I'm very glad I could help. Thank you for sharing your findings with us here. – steven7mwesigwa Feb 18 '23 at 22:12
1

As of writing spatie/browsershot is the best solution for my problem. It supports Laravel 10 and no changes to code are needed to make it work. It does about what nesk/puphpeteer did and has an active community.

dfeva
  • 81
  • 2
  • 11
0

The original Puppeteer is unfortunately no longer maintained and you should now rely on forks to be able to use it on a recent Laravel project.

If you are starting a new Laravel project, I will better recommended to use Panther instead: https://github.com/symfony/panther

Seb33300
  • 7,464
  • 2
  • 40
  • 57