ChromePdfBundle requires a Chrome or Chromium browser binary on the machine. It communicates with it via the Chrome DevTools Protocol (CDP) using the chrome-php/chrome PHP library.
No Docker needed. The browser runs as a local process, controlled directly by PHP.
When you call ->generate(), the bundle:
Page.printToPDF or Page.captureScreenshot via CDPThe underlying library chrome-php/chrome handles process management, WebSocket communication, and all CDP protocol details.
# Install Chromium (recommended for servers)
sudo apt update
sudo apt install -y chromium-browser
# Or install Google Chrome
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt update
sudo apt install -y google-chrome-stable
Binary paths:
/usr/bin/chromium-browser or /usr/bin/chromium/usr/bin/google-chrome or /usr/bin/google-chrome-stable# Install Chromium
sudo dnf install -y chromium
# Or install Google Chrome
sudo dnf install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
Binary paths:
/usr/bin/chromium-browser/usr/bin/google-chrome-stableapk add --no-cache chromium
Binary path: /usr/bin/chromium-browser
sudo pacman -S chromium
Binary path: /usr/bin/chromium
# Chromium
brew install --cask chromium
# Or Google Chrome
brew install --cask google-chrome
Binary paths:
/Applications/Chromium.app/Contents/MacOS/Chromium/Applications/Google Chrome.app/Contents/MacOS/Google ChromeDownload from google.com/chrome and install.
# Google Chrome
choco install googlechrome
# Or Chromium
choco install chromium
scoop install chromium
Download from google.com/chrome and install.
Common binary paths:
C:\Program Files\Google\Chrome\Application\chrome.exeC:\Program Files (x86)\Google\Chrome\Application\chrome.exeC:\Users\<username>\AppData\Local\Chromium\Application\chrome.exeBy default, the bundle will try to find Chrome/Chromium automatically on your system. The chrome-php/chrome library searches common binary paths.
# config/packages/daif_chrome_pdf.yaml
daif_chrome_pdf:
assets_directory: '%kernel.project_dir%/assets'
If auto-detection doesn't find your browser, or if you have multiple versions, specify the path explicitly:
# Linux
daif_chrome_pdf:
chrome_binary: '/usr/bin/google-chrome-stable'
# macOS
daif_chrome_pdf:
chrome_binary: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
# Windows
daif_chrome_pdf:
chrome_binary: 'C:\Program Files\Google\Chrome\Application\chrome.exe'
You can also use an environment variable for flexibility across environments:
daif_chrome_pdf:
chrome_binary: '%env(CHROME_BINARY)%'
# .env.local
CHROME_BINARY=/usr/bin/chromium-browser
To check that Chrome is installed and accessible:
# Linux / macOS
google-chrome --version
# or
chromium --version
# or
chromium-browser --version
# Windows
& "C:\Program Files\Google\Chrome\Application\chrome.exe" --version
You should see output like: Google Chrome 120.0.6099.109
On headless servers (no display), Chrome runs fine in headless mode -- the bundle always launches Chrome with --headless and --no-sandbox flags.
If you encounter errors related to missing system libraries, install the required dependencies:
# Debian / Ubuntu
sudo apt install -y \
libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 \
libxkbcommon0 libxcomposite1 libxrandr2 libgbm1 \
libpango-1.0-0 libcairo2 libasound2
# RHEL / CentOS / Fedora
sudo dnf install -y \
nss atk at-spi2-atk cups-libs libXcomposite \
libXrandr libgbm pango alsa-lib
This bundle uses the chrome-php/chrome PHP library under the hood. It provides:
The library is installed automatically as a Composer dependency of this bundle.
How can I help you explore Laravel packages today?