Download the PHP package liteopensource/gemini-lite-laravel without Composer

On this page you can find all versions of the php package liteopensource/gemini-lite-laravel. 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 gemini-lite-laravel

Gemini Lite for Laravel - Documentation

🦸🏽‍♀️🛠️🪚⚙️🦸🏽 YOU CAN CONTRIBUTE TO THIS PROJECT, CONTACT ME TO: [email protected] 🦸🏽‍♀️🛠️🪚⚙️🦸🏽

Latest Stable Version Total Downloads Stars License

Why use Gemini lite instead other open source Gemini Sdk?

Thanks to its minimalist syntax based on Facades, you can integrate AI functionalities effortlessly. Soon, it will include a ✨token and request limit management system inspired by Laravel Permission✨, perfect for streamlining monetizable projects. Moreover, its support is guaranteed until 2026, as it will be used in two projects set to be launched into production this year.Support the project and help extend its lifespan. If you'd like to contribute, feel free to contact me.

Features

Feature status:

In progress Progress Status
Text prompt support 🟢
Text prompt with file(Image, pdf, etc) support 🟢
Chat history support 🟢
Change model config in runtime 🟢
Change between Gemini models 🟢
JSON mode support 🟢
Easy upload file to get uri and mime type 🟢
Easy get current gemini config function 🟢
Easy get chat history of current chat instance 🟢
✨ Limit tokens and request support ✨ 🟢
Tokens counter before to do prompt 🟢
Gemini flash 2.0 beta 🟢
Automatic unit testing 🟡
Embedding support 🟢
Image generator support 🟣

Table of Contents

Get Started

Requeriments

You have to verify have added in your project:

Installation

To install the Gemini Lite for Laravel package, use or add the following line to your composer.json

Then run:

Configuration

Publish your config file using:

Add your Gemini API key to your file:

GeminiService

GeminiService provides methods to interact with the Gemini AI model.

Creating a New Chat

Example of starting a new chat session:

Sending Prompts

To send a prompt to the Gemini model:

Changing Model Configuration

You can modify the model configuration at runtime:

Using JSON Mode

Changing Gemini Model

You can switch between different Gemini models. The currently available models are:

Stable Models

Experimental Models

Gemini 2.5 Models

Note: The gemini-2.5-pro-preview-03-25 model doesn't have a free quota tier. Google recommends using the experimental version (gemini-2.5-pro-exp-03-25) for free tier access.

Getting Current Model Configuration

You can retrieve the current configuration of the Gemini model:

Getting Chat History

You can retrieve the complete chat history of your conversation with Gemini:

UploadFileToGeminiService

This service allows you to upload files for processing by Gemini.

Processing Files from a Path

To process a file from a local path:

Processing Uploaded Files

This is really useful when you work with Livewire and using

To process an uploaded file:

GeminiTokenCountService

This service is responsible for counting the tokens consumed by a text prompt. It returns an integer indicating the number of tokens consumed by the text prompt.

Token Limit

Token limit is independent of GeminiChat so the use of this feature is not integrated into the use of Gemini

This feature is intended for controlling user token consumption. It uses tables in the database to control usage. Therefore, it is important to publish the respective seeders for its operation.

Command to publish seeder and tables:

To use this feature you need to add the HasGeminiRoles trait to the model user

AssignRole

Can make request?

This function is for check if the user can make request to Gemini according to the established limits. The function returs a boolean value

Is active

This function is for check if the user is active. The function returs a boolean value

The difference between isActive and canMakeRequest is that canMakeRequest works based on the limit of tokens and daily and monthly requests and isActive is a more manual and controlled way of controlling the use.

Update usage

This method updates gemini usage, increments the request counter, and increments the token counter. As a parameter it receives the number of tokens used by a prompt as an integer.

Store Gemini Request

This function is intended to store data from the request to gemini, this function does not affect the tracking of user usage, it only stores data.

EmbeddingService

This service provides text embedding capabilities using Gemini's text-embedding-004 model.

Basic Usage

Examples

Text-Based Chat

You can keep chat history easily:

Image-Based Chat

You can combine image prompt and text prompt in the only one prompt

Changing Configuration at Runtime

JSON Mode Chat

Here's an example of using JSON mode to generate cookie recipes:

Changing Gemini Model Example

You can compare responses from different Gemini models:

Getting Current Model Configuration Example

You can compare responses from different Gemini models:

Count the number of tokens in a given text.

Check if the user can make a request to Gemini.

Check if the user is active in Gemini.

Update the usage tracking for the user.

Assign roles to test users.

Log the requests made by the user.

License

MIT License

Copyright (c) 2025 José López Lara

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “liteopensource/gemini-lite-laravel”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


All versions of gemini-lite-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
guzzlehttp/guzzle Version ^7.0
illuminate/support Version ^9.0 || ^10.0 || ^11.0 || ^12.0
illuminate/console Version ^9.0 || ^10.0 || ^11.0 || ^12.0
illuminate/database Version ^9.0 || ^10.0 || ^11.0 || ^12.0
illuminate/http Version ^9.0 || ^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 liteopensource/gemini-lite-laravel contains the following files

Loading the files please wait ....