Download the PHP package fahimhossain/laravel-ai-tryon without Composer

On this page you can find all versions of the php package fahimhossain/laravel-ai-tryon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-ai-tryon

Laravel AI Try-On

A reusable Laravel Composer package that adds an ecommerce "Try Out" button and modal to product detail pages. Shoppers upload their own photo, the package sends that photo plus the product image to an AI image-editing provider, and the generated virtual try-on preview is displayed in the modal.

The default provider is Google Gemini image generation through the Gemini API. Model names are configuration values, so you can use Nano Banana / Gemini Flash Image variants, newer Gemini image models, OpenAI, Replicate, or your own provider implementation without changing application code.

Installation

Publish the package files:

Or publish everything at once:

Environment

Google currently documents Gemini image generation through generateContent with text and inline image parts. Nano Banana model names can change, so keep GEMINI_IMAGE_MODEL in your environment or config rather than hardcoding a provider class.

Blade Usage

Place the component below your product image:

Supported product types are configurable and include shirt, t-shirt, pant, cap, dress, shoes, accessory, and other.

The component renders a button, upload modal, selected-photo preview, loading state, generated image, and clear error messages. It uses plain JavaScript and CSS published to public/vendor/ai-tryon.

Configuration

Publish config/ai-tryon.php and update:

To add a custom provider, bind your implementation to:

The provider must return a FahimHossain\LaravelAiTryon\Data\TryOnResult.

Usage Limits and Premium CTA

The package tracks usage in ai_tryon_usages, not the external provider quota. This is intentional because AI providers do not reliably expose package-level free quota state to your Laravel app.

Limits are checked by authenticated user_id, with guest fallback to IP address:

When a limit is exceeded, the endpoint returns JSON with code: limit_exceeded and the configured premium_url so the frontend can show an upgrade CTA.

Queue Setup

Queueing is enabled by default:

For the database queue:

Set ai-tryon.queue.enabled to false for synchronous local testing.

Privacy Notes

The package validates MIME type and max file size, never exposes API keys to the frontend, and uses Laravel CSRF protection on the upload endpoint.

User photos are stored temporarily so queued jobs can process them. By default, uploads are deleted after generation and the stored user-photo path is cleared:

Show shoppers a clear consent and accuracy notice. AI try-on previews may be inaccurate and should not be treated as a guaranteed product fit.

Provider Details

Gemini requests send:

Generated images are saved to the configured Laravel storage disk.

OpenAI and Replicate provider classes are included as configurable starting points. Production Replicate models vary by schema, so adjust providers.replicate.input_keys or pass custom input options from your application if needed.

Routes

The package registers:

You can change prefix and middleware in config.

Local Development and Testing

The tests use Orchestra Testbench and SQLite in memory.

Packagist Publishing

  1. Use your real package name in composer.json, for example fahimhossain/laravel-ai-tryon.
  2. Keep the namespace consistent with your autoload mapping, for example FahimHossain\\LaravelAiTryon.
  3. Push the repository to GitHub.
  4. Create a Packagist package pointing to the GitHub repository.
  5. Tag releases with SemVer, for example v1.0.0.

License

MIT.


All versions of laravel-ai-tryon with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/bus Version ^10.0|^11.0|^12.0
illuminate/cache Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/contracts Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/filesystem Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/queue Version ^10.0|^11.0|^12.0
illuminate/routing Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/validation Version ^10.0|^11.0|^12.0
illuminate/view Version ^10.0|^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fahimhossain/laravel-ai-tryon contains the following files

Loading the files please wait ...