Download the PHP package tekkenking/tinypeexi without Composer
On this page you can find all versions of the php package tekkenking/tinypeexi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tekkenking/tinypeexi
More information about tekkenking/tinypeexi
Files in tekkenking/tinypeexi
Package tinypeexi
Short Description A fluent Laravel package for integrating with the Lossless Media Service (aipeexi).
License MIT
Informations about the package tinypeexi
๐ผ๏ธ TinyPeexi โ Laravel Plugin for Lossless Media Service
Upload, transform, and deliver images from your Laravel app in minutes.
TinyPeexi is a Laravel package that gives you a clean, fluent PHP API to interact with a self-hosted aipeexi / Lossless Media Service instance. Upload images, generate optimized variants, apply effects, create e-commerce product shots, and get CDN-ready delivery URLs โ all without leaving your Laravel codebase.
๐ฆ Installation
1. Require via Composer
2. Publish the Config File
This creates config/tinypeexi.php in your Laravel project.
3. Add Your Credentials to .env
That's it. You're ready to use TinyPeexi.
๐ Quick Start
๐ Full API Reference
Uploading Assets
Upload from a Form Request
Upload from a File Path
The upload() method returns an AssetDto with the asset's sha (SHA-256 hash), which you'll use as the identifier for all future operations on this image.
Uploading Multiple Files at Once
TinyPeexi supports uploading multiple files in a single HTTP request (the backend defaults to a max of 10 files per request).
The uploadMany() method returns an array of AssetDto objects.
๐จ Blade & View Helpers
TinyPeexi includes a global helper function tinypeexi() to natively integrate into your views. Furthermore, the Variant builder automatically converts directly into a URL string when echoed, keeping your Blade templates incredibly clean.
1. The Fluent Way (Cleanest)
You don't need to call ->url(). Just echo the builder directly!
2. The Array Shorthand (Shortest)
Pass parameters dynamically if you prefer:
3. Using Config Presets
Instantly apply predefined transformations from your tinypeexi.php config:
Bulk Asset Migration
TinyPeexi includes a powerful Artisan command to migrate your existing local files into the Lossless Media Service. It is memory-safe, supports batching, queue-based variant generation, and uses a CSV file (storage/app/tinypeexi_migration_results.csv) for idempotency, meaning if the process dies, you can run the exact same command again and it will pick up right where it left off!
--path: Pipe-separated list of directories to scan.--ext: Pipe-separated list of extensions to include.--starts-with: Optional pipe-separated list of filename prefixes to include.--variants: Optional pipe-separated list of variant dimensions to generate in the background (dispatchesGenerateTinyPeexiVariantJob).--batch: Number of originals to upload per HTTP request (default: 50).
Deleting Assets
Returns true on success, throws TinyPeexiException on failure.
Generating Variants
The heart of TinyPeexi is the fluent Variant Builder. You start with TinyPeexi::variant($sha) and chain methods to describe the transformation you want.
Basic Resize
Resize with Exact Dimensions
Available Fit Modes
| Mode | Behavior |
|---|---|
cover |
Crop to fill exact dimensions |
contain |
Fit within dimensions, letterbox if needed |
fill |
Stretch to exact dimensions (may distort) |
inside |
Fit inside, never upscale (default) |
outside |
Fit outside, may upscale to cover |
Retina / HiDPI Support
Cropping
Smart Crop
Available Crop Positions
| Position | Description |
|---|---|
center |
Center of image (default) |
top |
Top edge |
bottom |
Bottom edge |
left |
Left edge |
right |
Right edge |
topleft |
Top-left corner |
topright |
Top-right corner |
bottomleft |
Bottom-left corner |
bottomright |
Bottom-right corner |
face |
AI face detection (Pro tier) |
entropy |
Smart crop using entropy analysis |
attention |
Smart crop using saliency/attention |
Manual Crop Rectangle
Auto-Trim Whitespace
Orientation
| Rotate Values | Flip Values |
|---|---|
0, 90, 180, 270, -90 |
h (horizontal), v (vertical), both |
Effects
Grayscale
E-Commerce Product Images
This is where TinyPeexi really shines. Creating uniform, professional product images is a single method call.
Using the Fluent Builder
Using the Shorthand Helper
If you use the same e-commerce settings repeatedly, use the shorthand:
Custom E-Commerce Settings
With AI Background Removal
Watermarks
Image Watermark
Available Watermark Positions
| Position | Description |
|---|---|
center |
Center of image |
topleft |
Top-left corner |
topright |
Top-right corner |
bottomleft |
Bottom-left corner |
bottomright |
Bottom-right corner (default) |
tile |
Tile across entire image |
Using Presets
Define reusable transformation presets in config/tinypeexi.php:
Then use them in your code:
You can define as many presets as you need (e.g., hero_banner, avatar, og_image, etc.).
Batch Variant Generation
Generate multiple sizes at once:
Output Formats
| Format | Extension | Notes |
|---|---|---|
jpeg |
.jpg |
Best for photos |
png |
.png |
Lossless, supports transparency |
webp |
.webp |
Modern, smaller files (default) |
avif |
.avif |
Newest, smallest files |
gif |
.gif |
Animated images |
tiff |
.tiff |
Print-quality |
ico |
.ico |
Favicons |
svg |
.svg |
Vector graphics |
โ๏ธ Configuration Reference
After publishing, edit config/tinypeexi.php:
Environment Variables
| Variable | Default | Description |
|---|---|---|
TINYPEEXI_API_URL |
http://localhost:8080 |
Base URL of aipeexi instance |
TINYPEEXI_DELIVERY_URL |
Same as API URL | CDN/delivery URL |
TINYPEEXI_TENANT_SLUG |
dev |
Your tenant slug |
TINYPEEXI_API_KEY |
(empty) | Your API key |
TINYPEEXI_TIMEOUT |
10 |
HTTP timeout (seconds) |
TINYPEEXI_RETRIES |
3 |
Retry count for failed requests |
TINYPEEXI_RETRY_DELAY |
500 |
Delay between retries (ms) |
TINYPEEXI_MAX_UPLOAD_SIZE |
26214400 |
Max upload size (bytes) |
TINYPEEXI_STRIP_METADATA |
true |
Strip EXIF on upload |
TINYPEEXI_AUTO_OPTIMIZE |
false |
Auto-optimize on upload |
๐งโ๐ป Real-World Examples
Profile Avatar Upload
Product Image Upload (E-Commerce)
Responsive Image Set
Blog Post with Watermarked Images
๐ง Error Handling
All errors throw TinyPeexiException:
๐งช Testing
When writing tests, you can mock the TinyPeexi facade:
๐ Method Cheat Sheet
| Method | Description |
|---|---|
TinyPeexi::upload($file) |
Upload an image, returns AssetDto |
TinyPeexi::uploadMany(array $files) |
Upload multiple images, returns AssetDto[] |
TinyPeexi::delete($sha) |
Delete an asset |
TinyPeexi::variant($sha) |
Start building a variant |
->resize($w, $h?) |
Set target dimensions |
->fit($mode) |
Set fit mode |
->dpr($ratio) |
Set device pixel ratio |
->format($fmt) |
Set output format |
->quality($q) |
Set compression quality |
->progressive() |
Enable progressive JPEG |
->stripMetadata() |
Strip EXIF metadata |
->crop($position) |
Set crop anchor |
->cropRect($x,$y,$w,$h) |
Manual crop rectangle |
->trim($threshold?) |
Auto-trim whitespace |
->rotate($degrees) |
Rotate image |
->flip($direction) |
Flip image |
->autoOrient() |
Auto-fix EXIF orientation |
->blur($sigma) |
Apply Gaussian blur |
->sharpen($amount) |
Apply sharpening |
->brightness($value) |
Adjust brightness |
->contrast($value) |
Adjust contrast |
->saturation($value) |
Adjust saturation |
->grayscale() |
Convert to grayscale |
->canvas($size) |
Set square canvas size |
->pad($px) |
Set canvas padding |
->background($color) |
Set background color |
->removeBg() |
AI background removal |
->ecommerce() |
Flag as e-commerce operation |
->ecommerceVariant(...) |
Shorthand for e-commerce variant |
->watermark(...) |
Add image watermark |
->preset($name) |
Apply a config preset |
->batch($sizes, $fmt?) |
Generate multiple sizes |
->generate() |
Execute and return VariantDto |
->toArray() |
Debug: get params as array |
๐ License
MIT License. See LICENSE for details.
๐ค Contributing
Pull requests are welcome! Please open an issue first to discuss what you'd like to change.
Built with โค๏ธ for Laravel developers by tekkenking.
All versions of tinypeexi with dependencies
illuminate/support Version ^10.0|^11.0
illuminate/http Version ^10.0|^11.0
guzzlehttp/guzzle Version ^7.8