Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 1, 2024 via composer

knplabs/knp-snappy v1.4.4

PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage.
Package summary
Share
0
issues
1
license
3
MIT
Package created
16 Jan 2012
Version published
13 Sep 2023
Maintainers
1
Total deps
3
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
3 Packages, Including:
knplabs/knp-snappy@v1.4.4
psr/log@3.0.0
symfony/process@v6.4.7
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of knplabs/knp-snappy 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
psr/log3.0.06.77 kBMIT
prod
symfony/processv6.4.7-MIT
prod

Visualizations

Frequently Asked Questions

What does knplabs/knp-snappy do?

KNPLabs' Snappy is a PHP library designed to facilitate the generation of thumbnails, snapshots, or PDFs from a URL or HTML page. The package operates as a wrapper around the powerful 'wkhtmltopdf' and 'wkhtmltoimage' utilities, renowned for their webkit-based conversion capabilities. To benefit from Snappy's functionalities, you'll need to have 'wkhtmltopdf' version '0.12.x' installed on your server. This is readily available to set up on various operating systems, such as OSX, Linux, and Windows.

How do you use knplabs/knp-snappy?

The practical use of Snappy involves the following steps encapsulated in PHP code:

First, install it using composer with the command composer require knplabs/knp-snappy.

Next, the package should be initialized in your script. Here's a snippet on how to do this:

<?php
require __DIR__ . '/vendor/autoload.php';
use Knp\Snappy\Pdf;
$snappy = new Pdf('/usr/local/bin/wkhtmltopdf');

Various features of Knplabs' Snappy can then be exploited for different use-cases, such as displaying a PDF in a browser, downloading a PDF file directly from the browser, merging multiple URLs into one PDF, generating a local PDF file, or even customizing the options for your Snappy instance. Here's an example of generating a local PDF file from HTML:

$snappy = new Pdf('/usr/local/bin/wkhtmltopdf');
$snappy->generateFromHtml('<h1>Bill</h1><p>You owe me money, dude.</p>', '/tmp/bill-123.pdf');

Remember to replace '/usr/local/bin/wkhtmltopdf' with the actual path to your 'wkhtmltopdf' binary.

Where are the knplabs/knp-snappy docs?

The Snappy documentation, inclusive of Frequently Asked Questions, is integrated into the project's readme as found at the GitHub URL 'https://github.com/KnpLabs/snappy.git'. The FAQ section specifically, is located in the 'doc/faq.md' directory. In addition to the main documentation, check out the provided integrations for other popular PHP frameworks like Symfony (knplabs/knp-snappy-bundle), Laravel (barryvdh/laravel-snappy), and Zend Framework (mvlabs/mvlabs-snappy).