Download the PHP package milivojsa/laravel-chrome without Composer
On this page you can find all versions of the php package milivojsa/laravel-chrome. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-chrome
A Chrome Headless wrapper for Laravel
Get the DOM of any webpage by using headless Chrome.
💡 This is a Laravel wrapper of milivojsa/chrome-php.
Requirements
This package requires the Puppeteer Chrome Headless Node library.
If you want to install it on Ubuntu 16.04 you can do it like this:
Installation
You can install this package via composer by running:
After that, the package will automatically register itself.
To publish the configuration file, you need to run:
This will create a config file at config/chrome.php
.
Configuration
The configuration can be found at config/chrome.php
.
Custom Chrome Path
You can specify a custom path to your Chrome installation.
Custom User Agent
You can specify a custom user agent. By default the standard Chrome Headless user agent will be used.
Timeout
You can specify a timeout after which the process will be killed. The timeout should be given in seconds.
If the process runs out of time a Symfony\Component\Process\Exception\ProcessTimedOutException
will be thrown.
Viewport
You can specify a custom viewport that will be used when you make a request. By default the Chrome Headless standard of 800x600px will be used.
Blacklist
You can specify a list of regular expressions for files that should not be loaded when you request a website. These expressions will be checked against the url of the file.
Custom Headers
You can specify custom headers which will be used for the request.
Usage
Here is a quick example how to use this package:
Instead of getting the DOM as a string, you can also use thegetDOMCrawler()
method, which will return a Symfony\Component\DomCrawler\Crawler
instance.
This makes it easy to filter the DOM for specific elements. Check the full documentation here.
Testing
You can run the tests by using