Download the PHP package devdojo/ai without Composer

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

AI with PrismPHP

Latest Version on Packagist Total Downloads

This package provides you with a global ai() method to easily get responses from your favorite AI provider. Here are a few examples:

Or capture the streamed response in a callback

Video Example

https://github.com/user-attachments/assets/69c90f9c-b003-4077-900b-c7f3d264f537

Installation

You can install the package via composer:

Usage

After you've installed the package, you'll want to add your AI Provider API Key. Out of the box DevDojo AI uses OpenAI, so you'll want to grab your OpenAI key and add it to your .env

After that, you are ready to use the ai method anywher in your app:

You can also capture the streamed response, by passing a callback as the second argument.

This makes it super easy to return streamed responses in your Livewire components. In fact, this package offers two Single-File Volt component examples.

Examples

You can publish a few examples by running:

This will publish two component examples to your project.

  1. basic-example.blade.php (a basic example of sending a message and getting a streamed response back)
  2. chat-example.blade.php (a chat example to show you how to pass an array of messages to create a conversation)

This will allow you to include those example components anywhere in your application.

You can easily test this out by utilizing the Livewire Starter Kit, Installing this package, Adding your API Key to .env, and then pasting the following into the welcome.blade.php file:

Make sure your asset running is watching via composer dev or npm run dev.

Now you will be able to see the basic and chat example fully functioning and communicating with your favorite AI service.

https://github.com/user-attachments/assets/69c90f9c-b003-4077-900b-c7f3d264f537

Configuration

If you would like to change the AI provider and the AI model, you can specify the following .env variables:

You can also publish the AI config file that will live at config/ai.php:

PrismPHP

This package doesn't really do much else besides providing you with an easy to use global ai() method. Most of the magic comes from PrismPHP, you may wish to abstract this into your own global ai() method. All providers that are available via Prism are also supported in this package.

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of ai with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
illuminate/support Version ^10.0|^11.0|^12.0
prism-php/prism Version ^0.85
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 devdojo/ai contains the following files

Loading the files please wait ...