{"id":13594171,"url":"https://github.com/rialto-php/puphpeteer","last_synced_at":"2025-10-01T00:31:58.234Z","repository":{"id":41283686,"uuid":"118182130","full_name":"rialto-php/puphpeteer","owner":"rialto-php","description":"A Puppeteer bridge for PHP, supporting the entire API.","archived":true,"fork":false,"pushed_at":"2023-01-01T15:05:38.000Z","size":2602,"stargazers_count":1340,"open_issues_count":64,"forks_count":188,"subscribers_count":29,"default_branch":"dev","last_synced_at":"2024-05-19T12:25:40.150Z","etag":null,"topics":["automation","developer-tools","headless-chrome","php","puppeteer","testing","web"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rialto-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-19T21:48:19.000Z","updated_at":"2024-05-17T16:47:01.000Z","dependencies_parsed_at":"2023-01-31T23:15:47.841Z","dependency_job_id":null,"html_url":"https://github.com/rialto-php/puphpeteer","commit_stats":null,"previous_names":["nesk/puphpeteer","extractr-io/puphpeteer"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rialto-php%2Fpuphpeteer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rialto-php%2Fpuphpeteer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rialto-php%2Fpuphpeteer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rialto-php%2Fpuphpeteer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rialto-php","download_url":"https://codeload.github.com/rialto-php/puphpeteer/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234803446,"owners_count":18889256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","developer-tools","headless-chrome","php","puppeteer","testing","web"],"created_at":"2024-08-01T16:01:29.700Z","updated_at":"2025-10-01T00:31:57.547Z","avatar_url":"https://github.com/rialto-php.png","language":"PHP","readme":"# 🚨 This project is not maintained anymore\n\nAs I write these lines, it's been nearly two years since the latest release of PuPHPeteer. Despite the enthusiasm around this project, I no longer have the motivation to support its development, mainly because it never really had any use to me. So its time to be honest with you, PuPHPeteer is no longer maintained.\n\nHowever, here's a list of forks maintained by the community:\n\n- [zoonru/puphpeteer](https://github.com/zoonru/puphpeteer)\n- [NigelCunningham/puphpeteer](https://github.com/NigelCunningham/puphpeteer)\n\nIf you create a fork and plan to maintain it, let me know and I will link it here.\n\n# PuPHPeteer\n\n\u003cimg src=\"https://user-images.githubusercontent.com/817508/100672192-dd258500-3361-11eb-845f-e8b5109752e4.png\" style=\"max-width:100%;\" width=\"190px\" align=\"right\"\u003e\n\n[![PHP Version](https://img.shields.io/packagist/php-v/nesk/puphpeteer.svg?style=flat-square)](http://php.net/)\n[![Composer Version](https://img.shields.io/packagist/v/nesk/puphpeteer.svg?style=flat-square\u0026label=Composer)](https://packagist.org/packages/nesk/puphpeteer)\n[![Node Version](https://img.shields.io/node/v/@nesk/puphpeteer.svg?style=flat-square\u0026label=Node)](https://nodejs.org/)\n[![NPM Version](https://img.shields.io/npm/v/@nesk/puphpeteer.svg?style=flat-square\u0026label=NPM)](https://www.npmjs.com/package/@nesk/puphpeteer)\n[![Build Status](https://img.shields.io/travis/nesk/puphpeteer.svg?style=flat-square\u0026label=Build%20Status)](https://travis-ci.org/nesk/puphpeteer)\n\nA [Puppeteer](https://github.com/GoogleChrome/puppeteer/) bridge for PHP, supporting the entire API. Based on [Rialto](https://github.com/nesk/rialto/), a package to manage Node resources from PHP.\n\nHere are some examples [borrowed from Puppeteer's documentation](https://github.com/GoogleChrome/puppeteer/blob/master/README.md#usage) and adapted to PHP's syntax:\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```php\nuse Nesk\\Puphpeteer\\Puppeteer;\n\n$puppeteer = new Puppeteer;\n$browser = $puppeteer-\u003elaunch();\n\n$page = $browser-\u003enewPage();\n$page-\u003egoto('https://example.com');\n$page-\u003escreenshot(['path' =\u003e 'example.png']);\n\n$browser-\u003eclose();\n```\n\n**Example** - evaluate a script in the context of the page:\n\n```php\nuse Nesk\\Puphpeteer\\Puppeteer;\nuse Nesk\\Rialto\\Data\\JsFunction;\n\n$puppeteer = new Puppeteer;\n\n$browser = $puppeteer-\u003elaunch();\n$page = $browser-\u003enewPage();\n$page-\u003egoto('https://example.com');\n\n// Get the \"viewport\" of the page, as reported by the page.\n$dimensions = $page-\u003eevaluate(JsFunction::createWithBody(\"\n    return {\n        width: document.documentElement.clientWidth,\n        height: document.documentElement.clientHeight,\n        deviceScaleFactor: window.devicePixelRatio\n    };\n\"));\n\nprintf('Dimensions: %s', print_r($dimensions, true));\n\n$browser-\u003eclose();\n```\n\n## Requirements and installation\n\nThis package requires PHP \u003e= 7.3 and Node \u003e= 8.\n\nInstall it with these two command lines:\n\n```shell\ncomposer require nesk/puphpeteer\nnpm install @nesk/puphpeteer\n```\n\n## Notable differences between PuPHPeteer and Puppeteer\n\n### Puppeteer's class must be instantiated\n\nInstead of requiring Puppeteer:\n\n```js\nconst puppeteer = require('puppeteer');\n```\n\nYou have to instantiate the `Puppeteer` class:\n\n```php\n$puppeteer = new Puppeteer;\n```\n\nThis will create a new Node process controlled by PHP.\n\nYou can also pass some options to the constructor, see [Rialto's documentation](https://github.com/nesk/rialto/blob/master/docs/api.md#options). PuPHPeteer also extends these options:\n\n```php\n[\n    // Logs the output of Browser's console methods (console.log, console.debug, etc...) to the PHP logger\n    'log_browser_console' =\u003e false,\n]\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e⏱ Want to use some timeouts higher than 30 seconds in Puppeteer's API?\u003c/strong\u003e\u003c/summary\u003e \u003cbr\u003e\n\nIf you use some timeouts higher than 30 seconds, you will have to set a higher value for the `read_timeout` option (default: `35`):\n\n```php\n$puppeteer = new Puppeteer([\n    'read_timeout' =\u003e 65, // In seconds\n]);\n\n$puppeteer-\u003elaunch()-\u003enewPage()-\u003egoto($url, [\n    'timeout' =\u003e 60000, // In milliseconds\n]);\n```\n\u003c/details\u003e\n\n### No need to use the `await` keyword\n\nWith PuPHPeteer, every method call or property getting/setting is synchronous.\n\n### Some methods have been aliased\n\nThe following methods have been aliased because PHP doesn't support the `$` character in method names:\n\n- `$` =\u003e `querySelector`\n- `$$` =\u003e `querySelectorAll`\n- `$x` =\u003e `querySelectorXPath`\n- `$eval` =\u003e `querySelectorEval`\n- `$$eval` =\u003e `querySelectorAllEval`\n\nUse these aliases just like you would have used the original methods:\n\n```php\n$divs = $page-\u003equerySelectorAll('div');\n```\n\n### Evaluated functions must be created with `JsFunction`\n\nFunctions evaluated in the context of the page must be written [with the `JsFunction` class](https://github.com/nesk/rialto/blob/master/docs/api.md#javascript-functions), the body of these functions must be written in JavaScript instead of PHP.\n\n```php\nuse Nesk\\Rialto\\Data\\JsFunction;\n\n$pageFunction = JsFunction::createWithParameters(['element'])\n    -\u003ebody(\"return element.textContent\");\n```\n\n### Exceptions must be caught with `-\u003etryCatch`\n\nIf an error occurs in Node, a `Node\\FatalException` will be thrown and the process closed, you will have to create a new instance of `Puppeteer`.\n\nTo avoid that, you can ask Node to catch these errors by prepending your instruction with `-\u003etryCatch`:\n\n```php\nuse Nesk\\Rialto\\Exceptions\\Node;\n\ntry {\n    $page-\u003etryCatch-\u003egoto('invalid_url');\n} catch (Node\\Exception $exception) {\n    // Handle the exception...\n}\n```\n\nInstead, a `Node\\Exception` will be thrown, the Node process will stay alive and usable.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n## Logo attribution\n\nPuPHPeteer's logo is composed of:\n\n- [Puppet](https://thenounproject.com/search/?q=puppet\u0026i=52120) by Luis Prado from [the Noun Project](http://thenounproject.com/).\n- [Elephant](https://thenounproject.com/search/?q=elephant\u0026i=954119) by Lluisa Iborra from [the Noun Project](http://thenounproject.com/).\n\nThanks to [Laravel News](https://laravel-news.com/) for picking the icons and colors of the logo.\n","funding_links":[],"categories":["Chrome DevTools Protocol","PHP"],"sub_categories":["Libraries for driving the protocol (or a layer above)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frialto-php%2Fpuphpeteer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frialto-php%2Fpuphpeteer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frialto-php%2Fpuphpeteer/lists"}