Fatal error: Uncaught Error: Class 'HeadlessChromium\BrowserFactory' not found in C:\OPS\OSPanel\domains\localhost\test.php:5 Stack trace: #0 {main} thrown in C:\OPS\OSPanel\domains\localhost\test.php on line 5
Устанавливаю в папку с файлом test.php,
composer require chrome-php/chrome
В чем проблема
use HeadlessChromium\BrowserFactory;
$browserFactory = new BrowserFactory();
// starts headless chrome
$browser = $browserFactory->createBrowser();
try {
// creates a new page and navigate to an url
$page = $browser->createPage();
$page->navigate('http://example.com')->waitForNavigation();
// get page title
$pageTitle = $page->evaluate('document.title')->getReturnValue();
// screenshot - Say "Cheese"!
$page->screenshot()->saveToFile('/foo/bar.png');
// pdf
$page->pdf(['printBackground' => false])->saveToFile('/foo/bar.pdf');
} finally {
// bye
$browser->close();
}