Download the PHP package isaacdew/industry without Composer

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

Industry

Industry is still a work in progress and the API may change. If you're interested in this project, give it a try and feel free to provide some suggestions or open a PR!

Industry is a composer package that allows you to integrate your Laravel Eloquent Factories with AI to seed your database with realistic string data. This can be useful for product demos and manual QA.

It's built using Prism (you should check it out).

Installation

You can install Industry via composer:

Quick Start

Update your .env file to set your provider, model and any related variables for your provider:

Add the WithIndustry trait to your factory class, define a protected $prompt with your factory's base prompt and then call $this->industry->describe passing a description for each field you need generated text for. See Usage for an example.

Then call your factory as you normally would!

Configuration

You can set Industry defaults in your .env file:

If you need to, you can publish Industry's config:

And publish Prism's config to set provider config:

Overriding defaults for specific factories

You can override your config for specifc factories by defining a configureIndustry method on your factory that takes an Isaacdew\Industry\Industry instance. Then, inside of that method, calling the ->setConfig() method on the instance. Here's an example:

You can also override the default config for specifc factory calls using the ->tapIndustry() method.

Usage

To use Industry, use the WithIndustry trait on your factory, define a $prompt property with the factory's base prompt and then call $this->industry->describe passing a description for each field you need generated text for.

For example:

Running with tests

Industry will never make calls to your LLM during tests. By default, the field description is used as its value. You can set state specifically for tests by using the ->fallback() method like so:

Caching

By default, Industry caches the data returned from your provider to avoid repeat calls with each re-seed. The cache for your factory is invalidated automatically when changes are made to its prompt and/or field descriptions.

Not recommended: If you want to disable caching by default, you can set the INDUSTRY_CACHE_ENABLED env variable to false. You can also disable/enable it in certain situations using the ->tapIndustry() method like so:

Strategies

There are two caching strategies that Industry supports: recycle and lazy_load. You can set your default strategy with the INDUSTRY_CACHE_STRATEGY env variable.

recycle

This is the default and the safest option. It takes whatever your LLM provides and will reuse existing cached entries in a round-robin fashion.

For example, if there are 10 menu items in the cache and you call MenuItem::factory(20)->create(), another call will not be made to the LLM for the missing 10. Instead, the second 10 items will be a repeat of the first.

lazy_load

This strategy will always ask your LLM for more data if there's not enough in the cache to satisfy the call unless you specify a limit. You can set a global limit via the INDUSTRY_CACHE_LAZY_LOAD_UNTIL in your env file. You can also set it with the ->setConfig() method on the Industry instance:

Clearing the cache

You can clear the cache for a factory by running the industry:clear-cache command. It will ask which factory the cache should be cleared for. To clear all caches, use the --all flag.

Some notes on prompts & structured output

  1. Be sure to use a model that supports structured output. Industry depends on structured output from the LLM which not all models are great at.

  2. You may have to adjust the prompt to get only the structured data back. Sometimes you may run into issues where your model generates the structured data perfectly well but returns some extraneous text like "Here you go:".

Modifying the Prism request

You can modify the request that Prism makes to your LLM provider using the beforeRequest method on the industry instance. See the Prism docs for more on what's possible.

FAQ

Does Industry make calls to my LLM for tests?

No. See Running with tests.

Does Industry make a call to my LLM for each model created by the factory?

No. Industry will make a request to your LLM for an array of the values it needs to generate all the models in a single call. For example, if you call MenuItem::factory(10)->create(), Industry will build a request to your LLM asking for an array of 10 objects containing the fields you defined on your factory with $this->industry->describe().

Can I use Industry to generate non-string data in my factory?

No. Industry doesn't support anything other than string data. Industry tries to make your LLM do as little work as possible while still getting realistic data. For any non-strings (and even some types of strings), faker can provide data just as realistic, much more efficiently.

Does Industry cache results from the LLM?

Yes. Caching is enabled by default. See Caching.

Roadmap

Industry is still in the early stages of dev but there are a few more things I hope to add in the coming weeks (10/12/2025):

License

The MIT License (MIT)


All versions of industry with dependencies

PHP Build Version
Package Version
Requires laravel/pint Version ^1.25
prism-php/prism Version ^0.90.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 isaacdew/industry contains the following files

Loading the files please wait ...