PHPackages                             smallpics/smallpics-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. smallpics/smallpics-php

ActiveLibrary[Image &amp; Media](/categories/media)

smallpics/smallpics-php
=======================

A PHP client library for generating URLs with Small Pics

1.0.2(4w ago)111.1k↓53.4%1MITPHPPHP &gt;=8.1.0CI passing

Since Nov 12Pushed 4w agoCompare

[ Source](https://github.com/SmallPics/smallpics-php)[ Packagist](https://packagist.org/packages/smallpics/smallpics-php)[ RSS](/packages/smallpics-smallpics-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (8)Versions (5)Used By (1)

smallpics-php
=============

[](#smallpics-php)

A PHP client library for generating URLs with [Small Pics](https://www.smallpics.io). This package provides a simple way to build URLs with Small Pics processing options.

Installation
------------

[](#installation)

```
composer require smallpics/smallpics-php
```

Usage
-----

[](#usage)

### Creating Processing Options

[](#creating-processing-options)

```
use smallpics\smallpics\Options;

// Create a new Options object
$options = new Options();

// Set options with individual setters
$options
    ->setWidth(300)
    ->setHeight(400);

// Generate the query string parameters
echo $options->toString();
// Output: "width=300&height=400"

// Options object can also be used directly in a string context
echo $options;
// Output: "width=300&height=400"
```

### Alternative Initialization

[](#alternative-initialization)

It is possible to initialize the Options object with an associative array. The keys of the array are the option names and the values are the option values.

The values can either be a single value, an array of values, or an associative array of values.

- When a single value is used, it is passed as the first argument to the setter method.
- When an array of values is used, they are destructured as passed as arguments in order to the setter method.
- When an associative array is used, the key/value pairs are destructured and passed in as named arguments to the setter method.

```
// Create Options object with array of values
$options = new Options([
		'width' => 300,
		'height' => 400,
		'fit' => 'fill',
		'watermarkPosition' => 'center',
		'border' => [
			'width' => 10,
			'color' => '000000',
			'borderMethod' => 'overlay',
		],
	]);
```

### Building URLs

[](#building-urls)

```
use smallpics\smallpics\Options;
use smallpics\smallpics\UrlBuilder;

// Create options object
$options = new Options();
$options
    ->setQuality(80)
    ->setFormat('png');

// Create URL builder (without signing, with plain URLs)
$builder = new UrlBuilder('https://images.my-origin.com', null, null, false);

// Build URL
$imageUrl = 'https://example.com/images/image.jpg';
$url = $builder->buildUrl($imageUrl, $options);

echo $url;
// Output: https://images.my-origin.com/images/image.jpg?q=80&fm=png
```

### Signed URLs

[](#signed-urls)

```
// Create URL builder with signing keys
$secret = '0123456789abcdef0123456789abcdef';
$builder = new UrlBuilder('https://images.my-origin.com', $secret);

// Build signed URL
$imageUrl = 'images/image.jpg';
$url = $builder->buildUrl($imageUrl, $options);

echo $url;
// Output will include a signature: https://images.my-origin.com/images/image.jpg?signature=[signature]
```

Development
-----------

[](#development)

### Testing

[](#testing)

This package uses [Pest PHP](https://pestphp.com/) for testing. To run the tests:

```
composer test
```

or

```
vendor/bin/pest
```

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance94

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~90 days

Total

3

Last Release

29d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.2.0

1.0.1PHP &gt;=8.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c8b86130e9f7274fdc9b091bc20252a767b39ba6a25476d51ac0c2ae389b5ca9?d=identicon)[smallpicsio](/maintainers/smallpicsio)

---

Top Contributors

[![johnnynotsolucky](https://avatars.githubusercontent.com/u/4161106?v=4)](https://github.com/johnnynotsolucky "johnnynotsolucky (19 commits)")

---

Tags

imagesphpsmallpicssrcsrcseturl-builderphpprocessinglibraryimagessmallpics

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/smallpics-smallpics-php/health.svg)

```
[![Health](https://phpackages.com/badges/smallpics-smallpics-php/health.svg)](https://phpackages.com/packages/smallpics-smallpics-php)
```

###  Alternatives

[tihiy-production/php-image-compressor

ImageCompressor - this is an easy way to compress images on the fly

244.0k](/packages/tihiy-production-php-image-compressor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
