SmallPict LogoSmallPict
Official Integration & SDK

Seamless Media Compression for Laravel Applications

Integrate SmallPict into Laravel 10 & 11. Includes Flysystem storage adapter, Blade directives (@smallpict), model traits, and queued background optimization jobs.

Install:composer require smallpict/smallpict-laravel
PHP Package

Implementation Example

php
// In your Controller
use SmallPict\Laravel\Facades\SmallPict;

public function upload(Request $request)
{
    $image = $request->file('banner');
    
    // Automatically compresses and stores to your S3 or Cloudflare R2
    $optimized = SmallPict::optimize($image)
        ->toFormat('webp')
        ->resize(1400)
        ->store('banners', 's3');

    return response()->json(['url' => $optimized->url()]);
}

// In your Blade View
<picture>
    <source srcset="@smallpict($banner->url, ['format' => 'avif'])" type="image/avif">
    <source srcset="@smallpict($banner->url, ['format' => 'webp'])" type="image/webp">
    <img src="@smallpict($banner->url, ['width' => 800])" alt="Banner" loading="lazy" />
</picture>

Integration Steps

11. Install via Composer

Run composer require smallpict/smallpict-laravel in your project.

22. Publish Config

Run php artisan vendor:publish --tag=smallpict-config and set SMALLPICT_API_KEY in .env.

33. Use Facade or Blade Directive

Use SmallPict::optimize() or the @smallpict Blade directive.

Key Benefits

  • Artisan commands for batch media optimization (php artisan smallpict:optimize)
  • Seamless integration with Spatie Media Library
  • Laravel Queue support (Redis, SQS, database)
  • Configurable automatic thumbnail variants
Official Developer Documentation

Need Complete Implementation Guides & API Specs?

Explore parameter references, authentication mechanisms, error codes, and local testing instructions in our official Laravel Package developer guide.

Read Laravel Package Docs

Supercharge Your Laravel Package Image Pipeline

Experience sub-50ms AVIF and WebP image optimization in your application. Zero setup fee, instant sandbox keys, and unlimited scalability.