All Projects → verumconsilium → laravel-browsershot

verumconsilium / laravel-browsershot

Licence: MIT license
Browsershot wrapper for Laravel 5

Programming Languages

PHP
23972 projects - #3 most used programming language
Blade
752 projects

Projects that are alternatives of or similar to laravel-browsershot

Phpchrometopdf
A slim PHP wrapper around google-chrome to convert url to pdf or to take screenshots , easy to use and clean OOP interface
Stars: ✭ 127 (+17.59%)
Mutual labels:  screenshot, pdf-generation, headless-chrome
Laravel Pdf
A Simple package for easily generating PDF documents from HTML. This package is specially for laravel but you can use this without laravel.
Stars: ✭ 79 (-26.85%)
Mutual labels:  laravel-5-package, pdf-generation, laravel5
Auth Tests
Always-current tests for Laravel's authentication system. Curated by the community.
Stars: ✭ 230 (+112.96%)
Mutual labels:  laravel-5-package, laravel5
Laravel Database Encryption
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Stars: ✭ 238 (+120.37%)
Mutual labels:  laravel-5-package, laravel5
Page2image
📷 page2image is a npm package for taking screenshots which also provides CLI command
Stars: ✭ 66 (-38.89%)
Mutual labels:  screenshot, headless-chrome
Laravel Email Verification
Laravel package to handle user verification using an activation mail
Stars: ✭ 63 (-41.67%)
Mutual labels:  laravel-5-package, laravel5
Eye
Eyewitness.io package for Laravel 5 applications
Stars: ✭ 114 (+5.56%)
Mutual labels:  laravel-5-package, laravel5
Gowitness
🔍 gowitness - a golang, web screenshot utility using Chrome Headless
Stars: ✭ 996 (+822.22%)
Mutual labels:  screenshot, headless-chrome
Angular5.2 Laravel5.6
Angular 5.2 and Laravel 5.6 Authentication and CRUD
Stars: ✭ 17 (-84.26%)
Mutual labels:  laravel-5-package, laravel5
Api
API that uncovers the technologies used on websites and generates thumbnail from screenshot of website
Stars: ✭ 189 (+75%)
Mutual labels:  screenshot, headless-chrome
Dhalang
Generate PDFs and make screenshots of HTML using Puppeteer in Ruby
Stars: ✭ 41 (-62.04%)
Mutual labels:  screenshot, pdf-generation
Notifier
NO LIBRARIES socket per page bridge for your Laravel application. (CLIENT PART INCLUDED)
Stars: ✭ 57 (-47.22%)
Mutual labels:  laravel-5-package, laravel5
Larrock Core
Core components for LarrockCMS
Stars: ✭ 46 (-57.41%)
Mutual labels:  laravel-5-package, laravel5
Laravel Settings
Simple Settings package for a laravel application
Stars: ✭ 45 (-58.33%)
Mutual labels:  laravel-5-package, laravel5
api2pdf.php
PHP client library for the Api2Pdf.com REST API - Convert HTML to PDF, URL to PDF, Office Docs to PDF, Merge PDFs, HTML to Image, URL to Image, HTML to Docx, HTML to Xlsx, PDF to HTML, Thumbnail preview of office files
Stars: ✭ 42 (-61.11%)
Mutual labels:  pdf-generation, headless-chrome
siteshooter
📷 Automate full website screenshots and PDF generation with multiple viewport support.
Stars: ✭ 63 (-41.67%)
Mutual labels:  screenshot, pdf-generation
Nova-Dark-Theme
A dark theme for Laravel Nova
Stars: ✭ 72 (-33.33%)
Mutual labels:  laravel-5-package, laravel5
Laravel Widgetize
A minimal package to help you make your laravel application cleaner and faster.
Stars: ✭ 791 (+632.41%)
Mutual labels:  laravel-5-package, laravel5
Puppeteer Dart
A Dart library to automate the Chrome browser over the DevTools Protocol. This is a port of the Puppeteer API
Stars: ✭ 92 (-14.81%)
Mutual labels:  screenshot, headless-chrome
puppet-master
Puppeteer as a service hosted on Saasify.
Stars: ✭ 25 (-76.85%)
Mutual labels:  screenshot, headless-chrome

Browsershot wrapper for Laravel 5

This package takes advantage of Google Chrome's Headless mode to take screenshots and generate PDFs from websites, views and raw html

Build Status Coverage Status Latest Stable Version Latest Unstable Version Total Downloads License

Requirements

You can install Puppeteer in your project via NPM:

npm install puppeteer

Or you could opt to just install it globally

npm install puppeteer --global

On a Forge provisioned Ubuntu 16.04 server you can install the latest stable version of Chrome like this:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
sudo npm install --global --unsafe-perm puppeteer
sudo chmod -R o+rx /usr/lib/node_modules/puppeteer/.local-chromium

Installation

Install the package through composer

composer require verumconsilium/laravel-browsershot

After the package is installed the service provider will be automatically discovered and two new Facades PDF and Screenshot will be available

Usage

The recommended way to use this package is through its Facades

PDF

Generating a PDF from a view and returning it inline

  
  use VerumConsilium\Browsershot\Facades\PDF;
  
  ...
  
  return PDF::loadView('view.name', $data)
            ->inline();
  

You can chain all the methods available in the browsershot master library

Returning the PDF as a download

  use VerumConsilium\Browsershot\Facades\PDF;
  
  ...
  
  return PDF::loadView('view.name', $data)
            ->margins(20, 0, 0, 20)
            ->download();

You can pass the custom file name and additional headers the response will have to the inline and download methods like

  PDF::loadHtml('<h1>Awesome PDF</h1>') 
      ->download('myawesomepdf.pdf', [
        'Authorization' => 'token'
      ]);

Persisting PDF to disk

If you would like to save the generated pdf file to your storage disk you can call the store or storeAs method

  $pdfStoredPath = PDF::loadUrl('https://google.com')
                      ->store('pdfs/')

This will use the default storage driver to store the pdf in the pdfs/ folder giving it a unique name. If you would like to specify the name you can call de storeAs method

  $pdfStoredPath = PDF::loadUrl('https://google.com')
                      ->storeAs('pdfs/', 'google.pdf')

Screenshots

Screenshots are created the same way as PDFs just change the facade to Screenshot

Generating screenshots as JPG/JPEG

By default screenshots will be taken as PNG format if you would like to use JPG instead call the useJPG() method

use VerumConsilium\Browsershot\Facades\Screenshot;

Screenshot::loadView('view.name', $data)
           ->useJPG()
           ->margins(20, 0, 0, 20)
           ->download();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].