PHPackages                             solipc2/laravelimagine - 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. solipc2/laravelimagine

ActiveLibrary

solipc2/laravelimagine
======================

Grok Imagine connector for Laravel — image (laravel/ai + xAI) and video (xAI) generation.

v0.1(1mo ago)01MITPHPPHP ^8.3

Since Jul 17Pushed 1mo agoCompare

[ Source](https://github.com/SolipC2/laravelimagine)[ Packagist](https://packagist.org/packages/solipc2/laravelimagine)[ Docs](https://github.com/SolipC2/laravelimagine)[ RSS](/packages/solipc2-laravelimagine/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

solipc2/laravelimagine
======================

[](#solipc2laravelimagine)

**Grok Imagine connector for Laravel** — generate images and videos with xAI Grok Imagine.

This package is **only** a connector (no UI, no demo routes). It integrates via Laravel package auto-discovery.

ModeHowImage[`laravel/ai`](https://github.com/laravel/ai) → xAI `grok-imagine-image`VideoPackage `XaiVideoClient` → xAI `grok-imagine-video`Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 12 or 13 (Illuminate HTTP/Support/Filesystem)
- [`laravel/ai`](https://github.com/laravel/ai) `^0.9` (requires PHP 8.3+ and Illuminate 12|13)
- An [xAI API key](https://console.x.ai/) for live generation

Install
-------

[](#install)

```
composer require solipc2/laravelimagine
```

Laravel auto-discovers `SolipC2\LaravelImagine\ImagineServiceProvider`. No manual provider registration.

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

[](#configuration)

Publish the config (optional):

```
php artisan vendor:publish --tag=imagine-config
```

EnvPurposeDefault`XAI_API_KEY`xAI API key (also used by `laravel/ai`)—`IMAGINE_FAKE`Bind fake video client (offline demos/tests)`false``XAI_VIDEO_MODEL`Video model name`grok-imagine-video``XAI_BASE_URL`xAI API base URL`https://api.x.ai/v1``IMAGINE_STORE_IMAGES`Write image binaries to a disk for a URL`true``IMAGINE_DISK`Filesystem disk for images`public`Ensure `laravel/ai` is configured for xAI (typically `XAI_API_KEY` and `config/ai.php` provider `xai`).

Usage
-----

[](#usage)

```
use SolipC2\LaravelImagine\ImagineService;
use Laravel\Ai\Image;

// Resolve from the container (auto-bound by the service provider)
$imagine = app(ImagineService::class);

// Image (live — requires XAI_API_KEY)
$image = $imagine->generateImage('a red cube on a table');
// $image->base64, $image->url, $image->mime, $image->hasMedia()

// Video (live — requires XAI_API_KEY; uses XaiVideoClient)
$video = $imagine->generateVideo('rocket launch over mars', [
    'duration' => 6,
    'aspect_ratio' => '16:9',
    'resolution' => '480p',
]);
// $video->url, $video->mime

// Unified entry
$result = $imagine->generate('image', 'blue sphere floating');
$result = $imagine->generate('video', 'waves on black sand');
```

### Testing / offline fakes

[](#testing--offline-fakes)

```
use Laravel\Ai\Image;
use SolipC2\LaravelImagine\FakeXaiVideoClient;
use SolipC2\LaravelImagine\ImagineService;

// Images: laravel/ai fake gateway
Image::fake([base64_encode('test-bytes')]);
$image = app(ImagineService::class)->generateImage('test prompt');

// Videos: bind fake client or set IMAGINE_FAKE=true
app()->bind(
    \SolipC2\LaravelImagine\Contracts\VideoClient::class,
    fn () => new FakeXaiVideoClient
);
```

### Result shape

[](#result-shape)

```
$result->type;     // 'image' | 'video'
$result->prompt;
$result->url;      // nullable
$result->base64;   // nullable (images)
$result->mime;
$result->meta;     // array
$result->hasMedia();
$result->toArray();
```

Scope
-----

[](#scope)

This package ships **only** the Grok Imagine connector:

- `ImagineService`, `ImagineResult`
- `XaiVideoClient`, `FakeXaiVideoClient`
- `Contracts\VideoClient`
- Config `imagine` + service provider bindings

It does **not** ship a chat UI, routes, or Docker stack.

Development
-----------

[](#development)

```
composer install
composer test
```

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance90

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7ebd7d55812c8a28998e65ea37525e29635813d30f2104d59919130468a3e380?d=identicon)[SolipC2](/maintainers/SolipC2)

---

Top Contributors

[![SolipC2](https://avatars.githubusercontent.com/u/306040676?v=4)](https://github.com/SolipC2 "SolipC2 (1 commits)")

---

Tags

laravelimagineimage-generationgrokx.aivideo-generation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/solipc2-laravelimagine/health.svg)

```
[![Health](https://phpackages.com/badges/solipc2-laravelimagine/health.svg)](https://phpackages.com/packages/solipc2-laravelimagine)
```

###  Alternatives

[yajra/laravel-datatables-oracle

jQuery DataTables API for Laravel

4.9k37.7M389](/packages/yajra-laravel-datatables-oracle)[psalm/plugin-laravel

Psalm plugin for Laravel

3365.5M359](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.1k6.4M360](/packages/laravel-ai)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45945.2k1](/packages/pressbooks-pressbooks)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.6M91](/packages/unisharp-laravel-filemanager)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

80732.6M270](/packages/laravel-mcp)

PHPackages © 2026

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