PHPackages                             aimatchfun/laravel-runware - 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. aimatchfun/laravel-runware

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

aimatchfun/laravel-runware
==========================

A Laravel wrapper for the PHP Runware SDK - AI image generation made easy

v4.0.1(2mo ago)1291↓50%MITPHPPHP ^8.4CI passing

Since Dec 8Pushed 2mo agoCompare

[ Source](https://github.com/aimatchfun/laravel-runware)[ Packagist](https://packagist.org/packages/aimatchfun/laravel-runware)[ Docs](https://github.com/aimatchfun/laravel-runware)[ RSS](/packages/aimatchfun-laravel-runware/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (15)Used By (0)

Laravel Runware
===============

[](#laravel-runware)

[![Latest Stable Version](https://camo.githubusercontent.com/f24b407e3198345358cff01fc05d1b60dbbcaa18535e70dc21acdae365bee05a/68747470733a2f2f706f7365722e707567782e6f72672f61696d6174636866756e2f6c61726176656c2d72756e776172652f762f737461626c65)](https://packagist.org/packages/aimatchfun/laravel-runware)[![Total Downloads](https://camo.githubusercontent.com/f6d7bd62f18d69d09e3c3b71d4c3f5c87d98465289ff76b677d719a285886064/68747470733a2f2f706f7365722e707567782e6f72672f61696d6174636866756e2f6c61726176656c2d72756e776172652f646f776e6c6f616473)](https://packagist.org/packages/aimatchfun/laravel-runware)[![License](https://camo.githubusercontent.com/d301b8e23ebdbfb0590157e1a2da48352da93c2ee6de7bfcc774cdbc71120059/68747470733a2f2f706f7365722e707567782e6f72672f61696d6174636866756e2f6c61726176656c2d72756e776172652f6c6963656e7365)](https://packagist.org/packages/aimatchfun/laravel-runware)

A Laravel wrapper for the [PHP Runware SDK](https://github.com/aimatchfun/php-runware-sdk), providing a simple and elegant way to integrate Runware AI services into your Laravel applications.

Features
--------

[](#features)

- 🚀 Easy integration with Laravel
- 🎨 Full support for Runware AI image generation capabilities
- 🖼️ **Inpainting**: Selective image editing by modifying specific regions
- ⚙️ Simple configuration via environment variables
- 🔧 Service Provider and Facade included
- 📦 Compatible with Laravel 12.x

Requirements
------------

[](#requirements)

- PHP ^8.4
- Laravel ^12.0
- A valid Runware API key

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

[](#installation)

You can install the package via Composer:

```
composer require aimatchfun/laravel-runware
```

Configuration
-------------

[](#configuration)

After installation, publish the configuration file:

```
php artisan vendor:publish --provider="AiMatchFun\LaravelRunware\LaravelRunwareServiceProvider"
```

This will create a `config/runware.php` configuration file in your application.

Add your Runware API key to your `.env` file:

```
RUNWARE_API_KEY=your-api-key-here
```

Usage
-----

[](#usage)

### Using the Facades

[](#using-the-facades)

The package provides two facades: `RunwareImageInference` and `RunwareInpainting`. You can use them directly:

```
use RunwareImageInference;
use RunwareInpainting;
use AiMatchFun\PhpRunwareSDK\RunwareModel;
use AiMatchFun\PhpRunwareSDK\OutputType;

// Example: Generate an image using ImageInference
$imageUrl = RunwareImageInference::positivePrompt('A beautiful sunset over the mountains')
    ->negativePrompt('blur, distortion')
    ->width(512)
    ->height(512)
    ->model(RunwareModel::REAL_DREAM_SDXL_PONY_14)
    ->outputType(OutputType::URL)
    ->run();

// Example: Inpainting
$inpaintedImage = RunwareInpainting::seedImage('image-uuid')
    ->maskImage('mask-uuid')
    ->positivePrompt('a serene beach at sunset')
    ->strength(0.8)
    ->run();
```

### Using Dependency Injection

[](#using-dependency-injection)

You can also inject the Runware instance directly:

```
use AiMatchFun\PhpRunwareSDK\ImageInference;
use AiMatchFun\PhpRunwareSDK\Inpainting;
use AiMatchFun\PhpRunwareSDK\RunwareModel;
use AiMatchFun\PhpRunwareSDK\OutputType;

class ImageController extends Controller
{
    public function __construct(
        private ImageInference $runware,
        private Inpainting $inpainting
    ) {}

    public function generate()
    {
        $imageUrl = $this->runware
            ->positivePrompt('A futuristic cityscape')
            ->negativePrompt('blur')
            ->model(RunwareModel::REAL_DREAM_SDXL_PONY_14)
            ->outputType(OutputType::URL)
            ->run();

        return response()->json(['imageUrl' => $imageUrl]);
    }
}
```

### Using the Service Container

[](#using-the-service-container)

```
use AiMatchFun\PhpRunwareSDK\RunwareModel;
use AiMatchFun\PhpRunwareSDK\OutputType;

// ImageInference
$runware = app('runware.imageInference');
$imageUrl = $runware->positivePrompt('A magical forest')
    ->negativePrompt('blur')
    ->model(RunwareModel::REAL_DREAM_SDXL_PONY_14)
    ->outputType(OutputType::URL)
    ->run();

// Inpainting
$inpainting = app('runware.inpainting');
$inpaintedImage = $inpainting->seedImage('image-uuid')
    ->maskImage('mask-uuid')
    ->positivePrompt('A serene beach at sunset')
    ->negativePrompt('blur, distortion')
    ->strength(0.8)
    ->run();
```

Available Methods
-----------------

[](#available-methods)

This package provides access to all methods available in the PHP Runware SDK. Some of the main features include:

- **Text-to-Image**: Create AI-generated images from text prompts
- **Inpainting**: Selective image editing by modifying specific regions of an image
- **Image Enhancement**: Upscale and enhance existing images
- **Background Removal**: Remove backgrounds from images
- **Image-to-Image**: Transform images based on prompts
- **ControlNet**: Advanced image generation with control
- And many more...

For a complete list of available methods and their parameters, please refer to the [PHP Runware SDK documentation](https://github.com/aimatchfun/php-runware-sdk).

Examples
--------

[](#examples)

### Basic Image Generation (Text-to-Image)

[](#basic-image-generation-text-to-image)

```
use RunwareImageInference;
use AiMatchFun\PhpRunwareSDK\RunwareModel;
use AiMatchFun\PhpRunwareSDK\OutputType;

$imageUrl = RunwareImageInference::positivePrompt('A serene lake with mountains in the background')
    ->negativePrompt('blur, distortion')
    ->width(1024)
    ->height(1024)
    ->model(RunwareModel::REAL_DREAM_SDXL_PONY_14)
    ->outputType(OutputType::URL)
    ->numberResults(4)
    ->run();

echo $imageUrl;
```

### Inpainting

[](#inpainting)

Inpainting allows you to selectively edit specific regions of an image by providing a seed image and a mask image:

```
use RunwareInpainting;
use AiMatchFun\PhpRunwareSDK\RunwareModel;
use AiMatchFun\PhpRunwareSDK\OutputType;

$inpaintedImage = RunwareInpainting::seedImage('59a2edc2-45e6-429f-be5f-7ded59b92046') // Image UUID or URL
    ->maskImage('5988e195-8100-4b91-b07c-c7096d0861aa') // Mask UUID or URL
    ->positivePrompt('a serene beach at sunset')
    ->negativePrompt('blur, distortion')
    ->strength(0.8) // Strength of the inpainting effect (0.0 to 1.0)
    ->maskMargin(64) // Extra context pixels around masked region (32-128)
    ->model(RunwareModel::REAL_DREAM_SDXL_PONY_14)
    ->width(1024)
    ->height(1024)
    ->outputType(OutputType::URL)
    ->run();

echo $inpaintedImage;
```

**Inpainting Parameters:**

- `seedImage()`: The original image you wish to edit (UUID or URL)
- `maskImage()`: Defines the area to be modified (UUID or URL)
- `positivePrompt()`: Describes the desired outcome for the masked area
- `strength()`: Strength of the inpainting effect (0.0 to 1.0, default: 0.8)
- `maskMargin()`: Adds extra context pixels around the masked region (32-128 pixels)

For more details about inpainting, see the [Runware Inpainting Documentation](https://runware.ai/docs/en/image-inference/inpainting).

### Image Upload

[](#image-upload)

You can upload images to Runware for use in various operations. The package provides two methods for uploading images:

**Upload from Local File Path:**

```
use RunwareImageUpload;

// Upload an image from a local file path (automatically converts to base64)
$imageUUID = RunwareImageUpload::uploadFromLocalPath('/path/to/image.jpg')
    ->run();

echo $imageUUID; // Use this UUID in inpainting or other image operations
```

**Upload from URL:**

```
use RunwareImageUpload;

// Upload an image from a public URL
$imageUUID = RunwareImageUpload::uploadFromURL('https://example.com/image.jpg')
    ->run();

echo $imageUUID; // Use this UUID in inpainting or other image operations
```

**Upload Methods:**

- `uploadFromLocalPath(string $path)`: Upload an image from a local file path. The file is automatically converted to base64 format.
- `uploadFromURL(string $url)`: Upload an image from a public URL.
- The uploaded image can be referenced by its UUID in subsequent operations like inpainting, image enhancement, etc.

**Using Dependency Injection:**

```
use AiMatchFun\PhpRunwareSDK\ImageUpload;

$imageUpload = app('runware.imageUpload');

// From local path
$imageUUID = $imageUpload->uploadFromLocalPath('/path/to/image.jpg')
    ->run();

// From URL
$imageUUID = $imageUpload->uploadFromURL('https://example.com/image.jpg')
    ->run();
```

For more details about image upload, see the [Runware Image Upload Documentation](https://runware.ai/docs/en/image-inference/image-upload).

Error Handling
--------------

[](#error-handling)

The package throws exceptions for API errors. It's recommended to wrap your calls in try-catch blocks:

```
use RunwareImageInference;
use AiMatchFun\PhpRunwareSDK\RunwareModel;
use AiMatchFun\PhpRunwareSDK\OutputType;
use Illuminate\Support\Facades\Log;

try {
    $imageUrl = RunwareImageInference::positivePrompt('A beautiful landscape')
        ->negativePrompt('blur')
        ->model(RunwareModel::REAL_DREAM_SDXL_PONY_14)
        ->outputType(OutputType::URL)
        ->run();
} catch (\Exception $e) {
    // Handle the error
    Log::error('Runware API error: ' . $e->getMessage());
}
```

Testing
-------

[](#testing)

When writing tests for code that uses this package, you can mock the Runware facade:

```
use RunwareImageInference;
use RunwareInpainting;

// Mock ImageInference
RunwareImageInference::shouldReceive('positivePrompt')
    ->once()
    ->with('Test prompt')
    ->andReturnSelf();

RunwareImageInference::shouldReceive('run')
    ->once()
    ->andReturn('https://example.com/test-image.jpg');

// Mock Inpainting
RunwareInpainting::shouldReceive('seedImage')
    ->once()
    ->with('image-uuid')
    ->andReturnSelf();

RunwareInpainting::shouldReceive('run')
    ->once()
    ->andReturn('https://example.com/inpainted-image.jpg');
```

For more detailed testing examples, see the [tests documentation](tests/README.md).

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Credits
-------

[](#credits)

- [Diego Avelar](https://github.com/daavelar)
- [All Contributors](../../contributors)

Support
-------

[](#support)

If you encounter any issues or have questions, please [open an issue](https://github.com/aimatchfun/laravel-runware/issues) on GitHub.

See Also
--------

[](#see-also)

- [PHP Runware SDK](https://github.com/aimatchfun/php-runware-sdk) - The underlying PHP SDK this package wraps
- [Runware Documentation](https://docs.runware.ai/) - Official Runware API documentation

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance84

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 83% 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 ~6 days

Recently: every ~12 days

Total

14

Last Release

80d ago

Major Versions

1.0.1 → v2.0.02025-12-08

v2.0.0 → 3.0.02025-12-11

v3.3.2 → v4.0.02026-02-11

PHP version history (3 changes)1.0.0PHP ^8.2

v2.0.0PHP ^8.3

v3.1.0PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/209401277?v=4)[AIMatch Fun](/maintainers/aimatchfun)[@aimatchfun](https://github.com/aimatchfun)

---

Top Contributors

[![aimatchfun](https://avatars.githubusercontent.com/u/209401277?v=4)](https://github.com/aimatchfun "aimatchfun (39 commits)")[![diegolist](https://avatars.githubusercontent.com/u/110676997?v=4)](https://github.com/diegolist "diegolist (7 commits)")[![daavelar](https://avatars.githubusercontent.com/u/7144672?v=4)](https://github.com/daavelar "daavelar (1 commits)")

---

Tags

phplaravelsdkaiartificial intelligenceimage-generationrunware

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aimatchfun-laravel-runware/health.svg)

```
[![Health](https://phpackages.com/badges/aimatchfun-laravel-runware/health.svg)](https://phpackages.com/packages/aimatchfun-laravel-runware)
```

###  Alternatives

[gemini-api-php/laravel

Gemini API client for Laravel

8915.7k](/packages/gemini-api-php-laravel)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[nikkanetiya/laravel-color-palette

Laravel Wrapper for `ksubileau/color-thief-php`. Grabs the dominant color or a representative color palette from an image. Uses PHP and GD or Imagick.

3312.6k](/packages/nikkanetiya-laravel-color-palette)[softcreatr/php-mistral-ai-sdk

A powerful and easy-to-use PHP SDK for the Mistral AI API, allowing seamless integration of advanced AI-powered features into your PHP projects.

1517.9k](/packages/softcreatr-php-mistral-ai-sdk)[softcreatr/php-perplexity-ai-sdk

A powerful and easy-to-use PHP SDK for the pplx (Perplexity) API, allowing seamless integration of advanced AI-powered features into your PHP projects..

149.1k](/packages/softcreatr-php-perplexity-ai-sdk)

PHPackages © 2026

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