Download the PHP package sirv/sirv-image without Composer
On this page you can find all versions of the php package sirv/sirv-image. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sirv/sirv-image
More information about sirv/sirv-image
Files in sirv/sirv-image
Package sirv-image
Short Description Official PHP SDK for the Sirv dynamic imaging API. This SDK provides a simple way to request any modified image (dimensions, format, quality, sharpen, crop, watermark etc.) using the 100+ image transformation options in Sirv's image optimization service.
License MIT
Homepage https://sirv.github.io/sirv-image-php/
Informations about the package sirv-image
Sirv Image Transformation - PHP
A fluent URL builder for Sirv dynamic image transformations. Build transformed image URLs with an intuitive, chainable API — no API credentials required.
Installation
Quick Start
Constructor
API Reference
All methods return $this for chaining. Call ->toUrl() to get the final URL. Casting to string also works.
Resize
| Method | Parameters | Description |
|---|---|---|
resize($width, $height, $option) |
int\|null, int\|null, string\|null |
Resize with optional scale option |
width($w) |
int |
Set width |
height($h) |
int |
Set height |
scaleByLongest($s) |
int |
Resize by longest dimension |
thumbnail($size = 256) |
int |
Create square thumbnail |
Crop
| Method | Parameters | Description |
|---|---|---|
crop($w, $h, $x, $y, $type, $padW, $padH) |
all nullable | Crop image |
clipPath($name) |
string |
Apply clipping path |
Rotation
| Method | Description |
|---|---|
rotate($degrees) |
Rotate (-180 to 180) |
flip() |
Flip vertically |
flop() |
Flip horizontally |
Format & Quality
| Method | Parameters | Description |
|---|---|---|
format($fmt) |
string |
Output format |
quality($q) |
int |
JPEG quality (0-100) |
webpFallback($fmt) |
string |
WebP fallback |
subsampling($value) |
string |
Chroma subsampling |
pngOptimize($enabled = true) |
bool |
PNG optimization |
gifLossy($level) |
int |
GIF lossy compression |
Color Adjustments
brightness($v), contrast($v), exposure($v), hue($v), saturation($v), lightness($v), shadows($v), highlights($v) — all accept int (-100 to 100).
grayscale(), colorLevel($black, $white), histogram($channel)
Color Effects
| Method | Parameters | Description |
|---|---|---|
colorize($color, $opacity) |
string, int |
Color overlay |
colortone($preset) |
string |
Preset colortone |
colortone(null, $options) |
array |
Custom colortone with color, level, mode |
Effects
blur($v), sharpen($v), vignette($value, $color), opacity($v)
Text Overlay
Watermark
Canvas & Frame
Other
| Method | Description |
|---|---|
page($num) |
PDF page |
profile($name) |
Saved profile |
Examples
E-commerce Product
Vintage Effect
Testing
License
MIT