Download the PHP package aimatchfun/laravel-runware without Composer
On this page you can find all versions of the php package aimatchfun/laravel-runware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aimatchfun/laravel-runware
More information about aimatchfun/laravel-runware
Files in aimatchfun/laravel-runware
Package laravel-runware
Short Description A Laravel wrapper for the PHP Runware SDK - AI image generation made easy
License MIT
Homepage https://github.com/aimatchfun/laravel-runware
Informations about the package laravel-runware
Laravel Runware
A Laravel wrapper for the PHP Runware SDK, providing a simple and elegant way to integrate Runware AI services into your Laravel applications.
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
- PHP ^8.4
- Laravel ^12.0
- A valid Runware API key
Installation
You can install the package via Composer:
Configuration
After installation, publish the configuration file:
This will create a config/runware.php configuration file in your application.
Add your Runware API key to your .env file:
Usage
Using the Facades
The package provides two facades: RunwareImageInference and RunwareInpainting. You can use them directly:
Using Dependency Injection
You can also inject the Runware instance directly:
Using the Service Container
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.
Examples
Basic Image Generation (Text-to-Image)
Inpainting
Inpainting allows you to selectively edit specific regions of an image by providing a seed image and a mask image:
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 areastrength(): 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.
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:
Upload from URL:
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:
For more details about image upload, see the Runware Image Upload Documentation.
Error Handling
The package throws exceptions for API errors. It's recommended to wrap your calls in try-catch blocks:
Testing
When writing tests for code that uses this package, you can mock the Runware facade:
For more detailed testing examples, see the tests documentation.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This package is open-sourced software licensed under the MIT license.
Credits
- Diego Avelar
- All Contributors
Support
If you encounter any issues or have questions, please open an issue on GitHub.
See Also
- PHP Runware SDK - The underlying PHP SDK this package wraps
- Runware Documentation - Official Runware API documentation