Download the PHP package codewithkyrian/chromadb-laravel without Composer

On this page you can find all versions of the php package codewithkyrian/chromadb-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 chromadb-laravel

ChromaDB PHP for Laravel

A Laravel convenient wrapper for the ChromaDB PHP library, used to interact with Chroma vector database seamlessly.

MIT Licensed GitHub Tests Action Status Latest Version on Packagist

Note: This package is a wrapper around the ChromaDB PHP library. It is meant to be used in Laravel applications. If you are looking for a standalone or framework-agnostic way of interacting with Chroma in PHP, check out the ChromaDB PHP library instead.

Installation

You can install the package via composer:

After installing the package, you can publish the configuration file using the following command:

This will publish a chromadb.php file in your config directory with the following content:

As you can see, all configuration options are retrieved from environment variables, so you can easily set them in your .env file without having to modify the configuration file itself.

Usage

Of course, you need to have the ChromaDB server running before you can use this package. Instructions on how to run ChromaDB can be found in the ChromaDB website.

For more usage examples, check out the ChromaDB PHP library.

Working with Eloquent Models

This package comes with a trait that you can use to associate your Eloquent models with a ChromaDB collection and automatically sync them to ChromaDB. To get started, add the ChromaModel interface and HasChromaCollection trait to your model.

After that, there are a few methods that you need to implement in your model.

After implementing the methods above (only two are required), you model now has a getChromaCollection() method that you can use to get the ChromaDB collection associated with your model.

Syncing Models to ChromaDB

By default, the package will automatically sync your models to ChromaDB whenever they are created, updated or deleted provided there was a change in the attributes since the last sync. You can disable this by setting the chromadb.sync.enabled config option to false or better still, set the CHROMA_SYNC_ENABLED to false.

The syncing of models is queued so be sure to set up your queue and workers the Laravel recommended way. You can set the queue, connection and the number tries for the job in the config or using the CHROMA_SYNC_QUEUE, CHROMA_SYNC_CONNECTION and CHROMA_SYNC_TRIES respectively. However, you can set the CHROMA_SYNC_QUEUE to false to disable using queues to perform the sync.

Querying the collection

While you can still query the collection after getting it from the getChromaCollection() method, you can also query the collection using the model. The model has a queryChromaCollection() scope that you can use to query the collection.

The arguments for the queryChromaCollection() method are the same as the query() method in the ChromaDB PHP library. Also, this meethod sorts the results by the distance field in the results.

Truncating the collection

You can truncate the collection associated with a model using the truncateChromaCollection() method on the model.

Testing

Contributors

License

This project is licensed under the MIT License. See the LICENSE file for more information.


All versions of chromadb-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^9.5.0|^10.34.2
codewithkyrian/chromadb-php Version ^0.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 codewithkyrian/chromadb-laravel contains the following files

Loading the files please wait ....