Download the PHP package brdv/forerunner without Composer

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

Tests Total Downloads Latest Version on Packagist License

Forerunner - Build structured LLM outputs the Laravel way

A Laravel package that provides an elegant, migration-inspired API for defining JSON schemas that ensure your LLM responses are perfectly structured every time.

Installation

You can install the package via composer:

Note: This is a pre-release version (0.x). The API may change as we gather feedback and iterate towards 1.0.0.

The package will automatically register its service provider.

Upgrading from 0.1.x

If you're upgrading from version 0.1.x, please note there are breaking changes. See the v0.2.0 release notes for a complete migration guide.

Quick Start

Using the Artisan Command

Generate a new structure class:

This creates a structure class at app/Structures/UserProfile.php:

Basic Usage

Define a schema using the Struct class or Schema facade:

Or using the facade for a cleaner syntax:

Available Field Types

String Fields

Integer Fields

Float/Number Fields

Boolean Fields

Array Fields

Enum Fields

Object Fields

Field Constraints

String Constraints

Numeric Constraints

Array Constraints

General Constraints

Advanced Features

Helper Methods for Common Formats

Forerunner provides convenient helper methods for commonly used field formats:

String Format Validation

You can also set custom formats on string fields:

Supported formats: email, uri, url, uuid, date, date-time, time, ipv4, ipv6, hostname, and more.

Nullable Fields

Mark fields as nullable to allow both the specified type and null:

Unique Array Items

Ensure array items are unique:

Additional Properties Control

Control whether objects can have properties not defined in the schema:

Strict Mode for LLM APIs

The strict() method is particularly useful for LLM APIs like OpenAI Structured Outputs which require:

  1. additionalProperties: false
  2. All properties in the required array

Important: Call strict() after defining all your fields to ensure all of them are marked as required.

This generates:

Note: By default, additionalProperties is already set to false. Use strict() when you also need all fields to be required (like for OpenAI). Call it after defining fields to ensure all are marked as required.

Schema Metadata

Add metadata to your schemas:

You can also add titles to individual fields:

Complete Advanced Example

This generates:

Complex Examples

User Profile with Nested Objects

Blog Post with Comments

Working with Generated Schemas

The Struct::define() method returns a Struct object that can be converted to an array or JSON.

Convert to Array

JSON Serialization

The Struct object implements JsonSerializable, so you can use it directly with json_encode():

Using Structure Classes

When using the make:struct command, you can create reusable schema classes:

Testing

Run the test suite:

Run tests with coverage:

Code Quality

Run PHPStan analysis:

Format code with Laravel Pint:

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Acknowledgements

This package is a fork of blaspsoft/forerunner, originally created by Blaspsoft. The original package is no longer maintained. Full credit for the initial design and implementation goes to the original authors.

Credits

License

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


All versions of forerunner with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^12.0|^13.0
illuminate/contracts Version ^12.0|^13.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 brdv/forerunner contains the following files

Loading the files please wait ...