Download the PHP package maeandrew/laya-laravel without Composer
On this page you can find all versions of the php package maeandrew/laya-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maeandrew/laya-laravel
More information about maeandrew/laya-laravel
Files in maeandrew/laya-laravel
Package laya-laravel
Short Description Laya as a first-class classification provider for laravel/ai: typed choice, score and yes/no decisions from a self-hosted, multilingual System 1 model.
License MIT
Homepage https://github.com/maeandrew/laya-laravel
Informations about the package laya-laravel
Laya Laravel
An unofficial Laravel AI provider for Laya. It lets laravel/ai send typed classification questions to a self-hosted laya-serve server.
This is a community package. It is not affiliated with or endorsed by Laravel, Convai Innovations/Laya, or TypeSafe.
The provider supports Laya's choice, score, and noul answers and uses Laya's automatic script and language routing by default.
Requirements
- PHP 8.3 or newer
- Laravel 12 or 13
laravel/ai1.x with its Classification API (currently a development release)- A reachable Laya server exposing
POST /v1/systemone
The Classification API is not available in the latest tagged laravel/ai release yet. Composer applies your application's stability policy to transitive dependencies, so explicitly require the 1.x-dev branch while it remains untagged.
Install
Until the first Packagist release, add the GitHub repository to your application's composer.json and require its main branch:
Laravel discovers the service provider automatically. To publish its configuration file, run:
Configure
Set the connection in .env:
The provider is registered as laya in laravel/ai. Pass it to classify() explicitly, or set ai.default_for_classification to laya in your application's config/ai.php. If you also add a laya entry under providers in config/ai.php, the values it sets override config/laya.php; values it leaves empty or null fall back to it.
Use
Use the same fake API provided by laravel/ai in application tests:
Laya server
The package is a client; it does not install or start the Python model server. Install and run Laya with its optional HTTP dependencies on a machine reachable by Laravel:
The default URL is http://localhost:8000/v1. Set LAYA_URL to the corresponding base URL in your Laravel environment. If the server uses LAYA_API_KEY, set the same value in Laravel; the package adds the matching bearer token. With no key configured, it omits the Authorization header.
Keep LAYA_PRELOAD=1 for multilingual routing in a production service. The Router otherwise keeps one checkpoint loaded and may need to cold-load another after a language switch, which can exceed the Laravel AI classification request's default 30-second timeout. The multilingual checkpoint's accuracy is weaker than the English checkpoint on some tasks; evaluate it on your own data before relying on automated decisions.
By default, LAYA_MODEL=auto lets Laya route each request based on its state. Set it to english, multilingual, or typed-decisions only when you need to pin a checkpoint.
Development
The Testbench suite fakes HTTP and makes no model downloads or external API calls.
License
MIT. See LICENSE.
All versions of laya-laravel with dependencies
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
laravel/ai Version ^1.0@dev