Download the PHP package strtob/yii2-ollama without Composer

On this page you can find all versions of the php package strtob/yii2-ollama. 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 yii2-ollama

Yii2 Ollama Component

Yii2 component for Ollama API with optional vector database support (e.g., Qdrant) for Retrieval-Augmented Generation (RAG).

Features


Installation

Install via Composer:

Ensure you have yiisoft/yii2-httpclient and a Qdrant PHP client installed if you want vector DB support.

Migration:

Configuration

Example config/web.php using a Qdrant adapter:

Usage in Controller


Stream Modus

See example:

Yii2 Ollama Component – Events

OllamaComponent supports three main events during generation:

Event When Triggered Data Included
beforeGenerate Before sending a request to the Ollama API prompt, options, request, user
afterGenerate After receiving a successful response prompt, options, request, user, response
generateError When an exception occurs during generation prompt, options, request, user, exception

Event Data Details


Example Usage


Embedding Generation Usage


Document Model (ActiveRecord with Vector DB)

You can use an ActiveRecord model to handle documents and automatically generate embeddings for them in your vector database. Supports PDF, TXT, DOCX uploads.

How It Works

This makes your document storage fully RAG-ready, automatically connecting your database records with vector embeddings.


Vector DB Support

Implement the VectorDbInterface to use any vector database. Example Qdrant adapter:

OllamaComponent will automatically prepend top-K context from the vector DB to the prompt.


Supported LLM Models so far


License

MIT License – see LICENSE


All versions of yii2-ollama with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
yiisoft/yii2 Version ^2.1
yiisoft/yii2-httpclient Version ^2.0
qdrant/qdrant-php Version ^1.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 strtob/yii2-ollama contains the following files

Loading the files please wait ...