Download the PHP package atelier/rasterizer without Composer

On this page you can find all versions of the php package atelier/rasterizer. 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 rasterizer

Rasterize SVG to PNG, JPEG or WebP from PHP, through a rendering binary you choose.

PHP Version Version Tests PHPUnit PHPStan License

A typed PHP abstraction over a rasterizer binary. It does not render SVG itself, and that is the point: rendering SVG correctly is a browser-sized problem, so this package delegates it to resvg or rsvg-convert and gives you a stable API on top.

Input is markup, any \Stringable such as an atelier/svg document, or an SvgInput built from a file or a stream. Nothing here depends on atelier/svg. Backed by an extensive test suite and PHPStan at its highest level.

Input · Documentation

Installation

Requires PHP 8.3 or later, plus one rasterizer binary on the host:

Other platforms, package sources, and the binaries' own licences are in Installation.

Quick start

Rasterizer::create() picks the first adapter available on the host. See Usage.

Adapters

Adapter Binary Selected by
resvg resvg Rasterizer::resvg()
rsvg-convert rsvg-convert Rasterizer::rsvgConvert()

create() tries them in that order and returns the first one it finds, which is convenient in development and unpredictable in production. Naming the adapter explicitly is what makes output reproducible across machines, because two renderers do not agree on every edge case.

Adapters implement RasterizerInterface, so a third one is a class rather than a fork. See Adapters.

Options

BitmapOptions is a single immutable value: format, width, height, keepAspectRatio, scale, background, and timeout.

Give one dimension and the other follows the SVG's ratio. Give both, and keepAspectRatio (on by default) fits the drawing inside that box rather than distorting it. See Options.

Input and output

Input is whatever you already have:

Output is a BitmapResult carrying contents, format, width, height and mimeType, so it can go to a file, a response, or object storage without touching the disk. Formats are PNG, JPEG and WebP, subject to what the selected adapter supports.

When it fails

Rasterizing shells out, which means it can fail in ways pure PHP cannot: a missing binary, a non-zero exit, a timeout, an unsupported format. Each is a typed exception rather than a false, and timeout is an option because a runaway render is a production incident.

Testing

Tests that shell out to a binary are slow and depend on the host. The package documents how to substitute an adapter so a consumer's own suite does not need resvg installed. See Testing.

Documentation

The full documentation is published at ateliersvg.com/rasterizer.

Contributing

Contributions are welcome. Visit the project on GitHub to report a bug, suggest a feature, or open a pull request.

Before submitting code, run:

Changes to public behaviour need a test and a documentation update.

Support

Bug reports, security disclosures, and contribution guidelines are collected at ateliersvg.com/support.

Sharing the package or starring it on GitHub helps more than you would think.

License

Atelier Rasterizer is released under the MIT License.


All versions of rasterizer with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
psr/log Version ^3.0
symfony/process Version ^7.3|^8.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 atelier/rasterizer contains the following files

Loading the files please wait ...