Download the PHP package noxsi/laravel-gemininano without Composer
On this page you can find all versions of the php package noxsi/laravel-gemininano. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download noxsi/laravel-gemininano
More information about noxsi/laravel-gemininano
Files in noxsi/laravel-gemininano
Informations about the package laravel-gemininano
GeminiNano Laravel ⚡
GeminiNano Laravel is an elegant Laravel SDK for generating images with Google Gemini (e.g. gemini-2.5-flash-image).
It wraps the official Gemini REST API in a clean, resource-based, Laravel-friendly API and can automatically:
- return Base64 image data, or
- store images on your Laravel filesystem and return a public URL – all controlled via config.
Under the hood it calls:
POST https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContentwith a text prompt and extracts the inline base64 image data.
✨ Features
- Modern architecture – clean
Client::factory()->make()API - Resource-based – separate
images()resource for image generation - Laravel integration – service provider + facade out of the box
- Config-driven storage
- store images via Laravel’s filesystem and return URLs
- or return raw Base64 directly (for APIs, tests, etc.)
- Type-safe responses with dedicated response classes
- Framework-first DX – built for Laravel 10/11/12 and PHP 8.2+
📦 Installation
Install the package via Composer:
For local development using a path repository, point your Laravel app’s
composer.jsonto your package directory and then run the command above.
⚙️ Configuration
Publish the config file:
This will create config/gemininano.php.
.env
Add your Gemini API configuration:
Config file overview
🚀 Usage
You can use the package either via the client or the facade.
1. Basic usage with the Facade
2. Using the Client directly (DI-friendly)
🧠 How the image pipeline works
When you call:
the package:
-
Builds a request body compatible with the official Gemini API:
-
Sends a
POSTrequest to:with headers:
x-goog-api-key: <your-api-key>Content-Type: application/json
-
Extracts the base64-encoded image data from the response:
candidates[0].content.parts[*].inlineData.data- (also supports snake_case
inline_data.datafor safety)
-
Wraps everything in a
GenerateResponseobject. -
When you call
->result():-
If
config('gemininano.store') === true
→ the package decodes the base64 string, stores it as a.pngviaStorage::disk(...), and returns the public URL. - If
config('gemininano.store') === false
→ it simply returns the raw base64 string.
-
You can always access the raw data:
🎛 Advanced usage
Passing extra options to Gemini
You can pass additional options like generationConfig, safetySettings, etc. They are merged into the root payload:
Using an input image (multimodal / inline_data)
You can optionally send an input image along with your text prompt.
Internally this builds a payload like:
Example:
Note:
imagePathmust point to a readable image file. The package will base64-encode the file and send it asinline_datato the Gemini API.
Returning base64 for an API endpoint
For API scenarios where you don’t want to store anything:
Then in your controller:
🧪 Testing
If you are testing within your Laravel app that uses the package, you can mock the HTTP layer as usual:
If you’re testing the package itself, you can use Pest; the package is designed to run in a standard Laravel test environment.
🧱 Requirements
- PHP 8.2+
- Laravel 10.x, 11.x, 12.x
ext-mbstringext-json- A valid Google Gemini API key
🔧 Local development (using a path repository)
If you’re developing this package locally, you can hook it into a test Laravel application via a path repository:
In your Laravel app’s composer.json:
Then:
Any changes you make in the package directory will be reflected in your Laravel app (after composer dump-autoload when adding/removing classes).
📜 Changelog
All notable changes to this package will be documented in the CHANGELOG.md file.
🤝 Contributing
Pull requests are welcome!
If you plan something bigger (new resources, breaking changes, etc.), open an issue first to discuss your idea.
Steps:
- Fork the repo
- Create your feature branch:
git checkout -b feature/my-awesome-feature - Run tests & formatter:
composer test/composer lint - Commit your changes and open a PR
📄 License
This package is open-sourced software licensed under the MIT license.
All versions of laravel-gemininano with dependencies
illuminate/filesystem Version ^12.41
illuminate/http Version ^12.41
illuminate/support Version ^12.41