[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8344":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":15,"starSnapshotCount":15,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},8344,"browsershot","spatie\u002Fbrowsershot","spatie","Convert HTML to an image, PDF or string","https:\u002F\u002Fspatie.be\u002Fdocs\u002Fbrowsershot",null,"PHP",5223,511,55,0,3,14,1,67.03,"MIT License",false,"main",[24,25,26,27],"hacktoberfest","phantomjs","php","screenshot","2026-06-12 04:00:38","\u003Cdiv align=\"left\">\n    \u003Ca href=\"https:\u002F\u002Fspatie.be\u002Fopen-source?utm_source=github&utm_medium=banner&utm_campaign=browsershot\">\n      \u003Cpicture>\n        \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fspatie.be\u002Fpackages\u002Fheader\u002Fbrowsershot\u002Fhtml\u002Fdark.webp\">\n        \u003Cimg alt=\"Logo for Browsershot\" src=\"https:\u002F\u002Fspatie.be\u002Fpackages\u002Fheader\u002Fbrowsershot\u002Fhtml\u002Flight.webp\">\n      \u003C\u002Fpicture>\n    \u003C\u002Fa>\n\n\u003Ch1>Render web pages to an image or PDF with Puppeteer\u003C\u002Fh1>\n    \n[![Latest Version](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Fspatie\u002Fbrowsershot.svg?style=flat-square)](https:\u002F\u002Fgithub.com\u002Fspatie\u002Fbrowsershot\u002Freleases)\n[![MIT Licensed](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![run-tests](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Fspatie\u002Fbrowsershot\u002Frun-tests.yml?label=tests&style=flat-square)](https:\u002F\u002Fgithub.com\u002Fspatie\u002Fbrowsershot\u002Factions)\n[![Total Downloads](https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fdt\u002Fspatie\u002Fbrowsershot.svg?style=flat-square)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fspatie\u002Fbrowsershot)\n    \n\u003C\u002Fdiv>\n\nThe package can convert a web page to an image or PDF. The conversion is done behind the scenes by [Puppeteer](https:\u002F\u002Fgithub.com\u002FGoogleChrome\u002Fpuppeteer) which runs a headless version of Google Chrome.\n\nHere's a quick example:\n\n```php\nuse Spatie\\Browsershot\\Browsershot;\n\n\u002F\u002F an image will be saved\nBrowsershot::url('https:\u002F\u002Fexample.com')->save($pathToImage);\n```\n\nIt will save a PDF if the path passed to the `save` method has a `pdf` extension.\n\n```php\n\u002F\u002F a pdf will be saved\nBrowsershot::url('https:\u002F\u002Fexample.com')->save('example.pdf');\n```\n\nYou can also use an arbitrary html input, simply replace the `url` method with `html`:\n\n```php\nBrowsershot::html('\u003Ch1>Hello world!!\u003C\u002Fh1>')->save('example.pdf');\n```\n\nIf your HTML input is already in a file locally use the :\n\n```php\nBrowsershot::htmlFromFilePath('\u002Flocal\u002Fpath\u002Fto\u002Ffile.html')->save('example.pdf');\n```\n\nBrowsershot also can get the body of an html page after JavaScript has been executed:\n\n```php\nBrowsershot::url('https:\u002F\u002Fexample.com')->bodyHtml(); \u002F\u002F returns the html of the body\n```\n\nIf you wish to retrieve an array list with all of the requests that the page triggered you can do so:\n\n```php\n$requests = Browsershot::url('https:\u002F\u002Fexample.com')\n    ->triggeredRequests();\n\nforeach ($requests as $request) {\n    $url = $request['url']; \u002F\u002Fhttps:\u002F\u002Fexample.com\u002F\n}\n```\n\nTo use Chrome's new [headless mode](https:\u002F\u002Fdevelopers.google.com\u002Fweb\u002Fupdates\u002F2017\u002F04\u002Fheadless-chrome) pass the `newHeadless` method:\n\n```php\nBrowsershot::url('https:\u002F\u002Fexample.com')->newHeadless()->save($pathToImage);\n```\n\n## Support us\n\nLearn how to create a package like this one, by watching our premium video course:\n\n[![Laravel Package training](https:\u002F\u002Fspatie.be\u002Fgithub\u002Fpackage-training.jpg)](https:\u002F\u002Flaravelpackage.training)\n\nWe invest a lot of resources into creating [best in class open source packages](https:\u002F\u002Fspatie.be\u002Fopen-source). You can support us by [buying one of our paid products](https:\u002F\u002Fspatie.be\u002Fopen-source\u002Fsupport-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https:\u002F\u002Fspatie.be\u002Fabout-us). We publish all received postcards on [our virtual postcard wall](https:\u002F\u002Fspatie.be\u002Fopen-source\u002Fpostcards).\n\n## Documentation\n\nAll documentation is available [on our documentation site](https:\u002F\u002Fspatie.be\u002Fdocs\u002Fbrowsershot).\n\n## Testing\n\nFor running the testsuite, you'll need to have Puppeteer installed. Pleaser refer to the Browsershot requirements [here](https:\u002F\u002Fspatie.be\u002Fdocs\u002Fbrowsershot\u002Fv4\u002Frequirements). Usually `npm -g i puppeteer` will do the trick.\n\nAdditionally, you'll need the `pdftotext` CLI which is part of the poppler-utils package. More info can be found in in the [spatie\u002Fpdf-to-text readme](https:\u002F\u002Fgithub.com\u002Fspatie\u002Fpdf-to-text?tab=readme-ov-file#requirements). Usually `brew install poppler-utils` will suffice.\n\nFinally run the tests with:\n\n```bash\ncomposer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https:\u002F\u002Fgithub.com\u002Fspatie\u002F.github\u002Fblob\u002Fmain\u002FCONTRIBUTING.md) for details.\n\n## Security\n\nIf you've found a bug regarding security please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker.\n\n## Alternatives\n\nIf you're not able to install Node and Puppeteer, take a look at [v2 of browsershot](https:\u002F\u002Fgithub.com\u002Fspatie\u002Fbrowsershot\u002Ftree\u002F2.4.1), which uses Chrome headless CLI to take a screenshot. `v2` is not maintained anymore, but should work pretty well.\n\nIf using headless Chrome does not work for you take a look at at `v1` of this package which uses the abandoned `PhantomJS` binary.\n\n## Credits\n\n- [Freek Van der Herten](https:\u002F\u002Fgithub.com\u002Ffreekmurze)\n- [All Contributors](..\u002F..\u002Fcontributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","spatie\u002Fbrowsershot 是一个用于将网页转换为图片或PDF的PHP库。它通过Puppeteer运行无头版本的Google Chrome来实现这一功能，支持从URL、HTML字符串或本地HTML文件生成图像或PDF文档。此外，该库还能够获取执行JavaScript后的页面主体内容及触发的所有请求列表，提供了`newHeadless`等方法以适应不同的使用需求。适用于需要自动化生成网页截图或PDF文档的各种场景，如报表生成、网页存档等。",2,"2026-06-11 03:17:27","top_language"]