Download the PHP package anam/phantommagick without Composer

On this page you can find all versions of the php package anam/phantommagick. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phantommagick

PhantomMagick

For PhantomMagick version 1, please use the 1.0.2 branch!

PhantomMagick provides a simple API to ease the process of converting HTML to PDF or images. It's especially handy for things like generating invoices or capturing screenshots of websites. It's framework agnostic but it does provide a facade for simple use in Laravel 4/5.

Features

Requirements

Installation

PhantomMagick is available via Composer:

Dependencies

PhantomJS must be installed to use PhantomMagick.

There are few ways to install PhantomJS:

Install binary manually

You can download the official PhantomJS binary from the following link:

http://phantomjs.org/download.html.

Install binary through Composer

Simply pull in the anam/phantomjs-linux-x86-binary package to get the up-to-date PhantomJS binary for 64-bit Linux systems.

Integrations

Laravel 4 and Laravel 5 integrations

Although PhantomMagick is framework agnostic, it does support Laravel out of the box and comes with a Service provider and Facade for easy integration.

After you have installed the PhantomMagick, open the config/app.php file which is included with Laravel and add the following lines.

In the $providers array add the following service provider.

Add the facade of this package to the $aliases array.

You can now use this facade in place of instantiating the converter yourself in the following examples.

Usage

PDF conversion

Multipage PDFs

Please note with multipage PDFs:

Image conversion

PhantomMagick supports HTML to PNG/JPG/GIF conversion.

HTML to PNG
HTML to JPG
HTML to GIF

Download file

To display in the browser instead of forcing the file to be download, you can pass a second parameter to the method.

or just simply call:

Save to cloud

PhantomMagick leverages Flysystem to save converted files in the cloud.

PhantomMagick currently supports:

Amazon S3

First install the required S3 dependencies through Composer.

Dropbox

First install the required Dropbox dependencies through Composer.

Rackspace

First install the required Rackspace dependencies through Composer.

Settings

Global options

Binary

You can set the path of the phantomjs binary if you've installed it yourself manually, or the phantomjs command is not available in your shell. If you installed it through Composer (with the anam/phantomjs-linux-x86-binary package) PhantomMagick will be smart enough to find the file automatically.

Data Source

PhantomMagick only supports HTML and data can be provided via an URL or from the local disk. If you need to use raw HTML data, you can use multipage PDF conversion. However raw data does have some limitations; it does not support relative paths and it only supports inline styles and internal CSS.

For raw HTML:

PDF options

Format

Format is optional. Supported formats are: 'A3', 'A4', 'A5', 'Legal', 'Letter', 'Tabloid'.

Margin

Margin is optional and defaults to 1cm.

Orientation

Orientation ('portrait', 'landscape') is optional and defaults to 'portrait'.

zoomFactor

zoomFactor is optional and defaults to 1 (where 1 is 100% zoom).

Custom width and height

Custom dimension is optional. Supported formats are cm, px and in.

Example

Image options

Width

Width is optional and defaults to 1280px (720p) and only intergers are accepted.

Height

Height is optional and only integers are accepted.

Note: If only width is given full webpage will be rendered. However, if both width and height is given the image will be clipped to the given width and height.

Quality

Quality is optional and defaults to 80. The quality must be between 1-100.

Example

Credits

License

The MIT License (MIT). Please see LICENSE for more information.


All versions of phantommagick with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
league/flysystem Version ~1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package anam/phantommagick contains the following files

Loading the files please wait ....