Download the PHP package rmh/laravel-openui without Composer

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

laravel-openui

Latest Version on Packagist Tests

OpenUI Generative UI integration for the Laravel AI SDK.

This package connects OpenUI — the open standard for Generative UI — with the Laravel AI SDK. It handles system prompt injection, component library management, caching, and streaming, so your agents can respond with structured, interactive UI instead of plain text.


How It Works

OpenUI works in four steps:

  1. You define which React components the LLM is allowed to generate.
  2. This package injects a system prompt into your agent's instructions describing those components and the OpenUI Lang syntax.
  3. The LLM responds in OpenUI Lang (a compact, streaming-native format).
  4. Your frontend's <Renderer /> from @openuidev/react-lang parses and renders it live.

Installation

Publish the config file:


Quick Start

Option 1: Global Middleware (zero-touch, all agents)

Register the middleware once in your AppServiceProvider and every agent will automatically receive the OpenUI system prompt:

Your agents need no changes. Stream the response back to your OpenUI frontend:


Option 2: GeneratesUI Trait (explicit opt-in per agent)

Add the trait to agents that should produce UI. Rename instructions() to agentInstructions():

Toggle UI per call:


Option 3: Per-agent Middleware

Add the middleware only to specific agents:


Option 4: Anonymous Agents / Inline Calls


Defining Your Component Library

In config/openui.php

Supported prop types: string, int, float, bool, array, ComponentName[], enum:a|b|c. Append ? to mark any type as optional.


Via the Facade (programmatic / runtime)

The cache is automatically invalidated when you add components via the facade.


Via the Artisan Command

Scaffold a typed component definition class:

This generates app/Ai/OpenUI/Components/CardComponent.php. Register it in your service provider:


Export for Frontend

Export your component definitions to TypeScript/Zod for your frontend:

This generates resources/js/openui.ts with Zod schemas:

Export options:

Option Description
--path=... Custom output path (default: resources/js/openui.ts)
--format=zod\|ts\|json Output format (default: zod)
--types TypeScript types only (shorthand for --format=ts)
--force Overwrite existing file

Examples:


Configuration Reference


Frontend Integration

Option 1: Use Exported Schema (Recommended)

Export your component definitions and import them directly:

Then in your frontend:

Option 2: Manual Schema Definition

Define schemas manually on the frontend:


Inspecting the Generated System Prompt


Testing

When writing tests for agents that use OpenUI, you can temporarily disable injection:

Or assert on the generated prompt:


Changelog

Please see CHANGELOG.md.

License

MIT — see LICENSE.md.


All versions of laravel-openui with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version ^12.0
laravel/ai Version ^0.3
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 rmh/laravel-openui contains the following files

Loading the files please wait ...