Download the PHP package jpcaparas/laravel-faker-openai without Composer

On this page you can find all versions of the php package jpcaparas/laravel-faker-openai. 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 laravel-faker-openai

Laravel Faker OpenAI Provider

Tests

A Laravel package that extends FakerPHP by adding an AI-powered data generator using OpenAI. This allows you to generate more realistic and context-aware fake data in your Laravel applications.

Installation

Install the package via Composer:

The package will automatically register its service provider if you're using Laravel's package auto-discovery.

Configuration

  1. Next, execute the install command:

This will create a config/openai.php configuration file in your project, which you can modify to your needs using environment variables.

  1. Make sure you have your OpenAI API key set in your .env file:

  2. The package uses gpt-3.5-turbo model by default.

Usage

The package adds a new promptAI() method to the Faker generator. You can use it in several ways:

Basic Usage

... you can also use the built-in fake() helper:

With Fallback Values

You can provide fallback values that will be used if the AI request fails:

Error Handling

By default, errors are logged and the fallback value is returned. You can make it throw exceptions instead:

How It Works

The package works by:

  1. Intercepting FakerPHP method calls through a prompt
  2. Sending them to OpenAI's GPT model
  3. Returning AI-generated responses that match FakerPHP's expected output format

Testing

Run the test suite:

License

MIT


All versions of laravel-faker-openai with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
fakerphp/faker Version ^1.24
laravel/framework Version ^10.0 || ^11.0
nyholm/psr7 Version ^1.8
openai-php/laravel Version ^0.10.2
symfony/http-client Version ^7.2
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 jpcaparas/laravel-faker-openai contains the following files

Loading the files please wait ....