laya-php
Laravel-ready PHP SDK for self-hosted Laya that returns typed decisions as PHP enums, ints and bools, with a test fake.
Overview
laya-php lets PHP applications classify text without paying for an LLM API. You describe a decision as a readonly class with enums, call $laya->decide(text, Triage::class), and get an instance back, for example department as Department::Billing and churn as true. Every answer has a confidence you can threshold to send unsure cases to a human, and a built-in fake supports unit tests without a server.
It is an SDK for Laya, which runs in Python, so it talks to laya-serve, Laya's HTTP server, over any PSR-18 client; a compose file pins upstream Laya to a specific version. Text stays on your infrastructure with no per-token fees, and Laya supports 100+ languages. Because laya-serve speaks the same POST /v1/systemone protocol as Jev, CI checks the SDK's requests and responses against TypeSafe's OpenAPI spec on every change and weekly, so other compatible servers work too, though it has not been tested against hosted Jev itself. It requires PHP 8.4+ and includes Laravel integration.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Choice | Which department should handle this message? | — |
| Yes / no | Is the customer at risk of churning? | — |
| Score | How urgent is this message?(inferred) | — |
How it works
- Run laya-serve locally with Docker Compose
- Define a decision as a readonly PHP class with enums
- Call decide(text, Class) through the SDK
- Use typed fields and confidences; route unsure cases to people
Strengths
- Self-hosted with no per-token cost
- Typed PHP results
- Checked against TypeSafe's OpenAPI spec
- Test fake included
Caveats
- Requires running a Python Laya server
- PHP 8.4+ only
- Not tested against hosted Jev
Getting started
composer require marcreichel/laya-php, then docker compose up -d --wait to start laya-serve.At a glance
- Type
- Library
- Status
- beta
- Language
- PHP
- Runtime
- PHP 8.4+ library with Laravel support
- Has code
- yes
- Has tests
- yes
Use cases and integrations
How curated lists describe it
Laravel-ready PHP client for Laya, the open System One model, so a typed decision is a PHP enum rather than a parsed sentence. Self-hosted, no Jev key.
MrJev/awesome-jev
Frequently asked questions
Do I need a Jev key?
No, it targets a self-hosted Laya server.
Will it work with Jev?
Requests follow TypeSafe's spec, but it has not been tested against the hosted Jev API.
How are answers typed?
As PHP enums, ints and bools on a readonly class you define.
Related projects
Community JVM SDK for System One with Java core, Kotlin DSL, Spring Boot and Spring AI; works with Jev and LAYA.
LibrarybetaJava, KotlinAx, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.
PluginproductionTypeScriptEffect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.
ProjectproductionTypeScriptPHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.
ProjectproductionPHPElixir library for unified LLM calls across providers, with an evaluate interface that calls Jev via TypeSafe or OpenRouter.
ProjectproductionElixirSelf-hosted multi-tenant AI agent platform listed as including optional TypeSafe client tools for classification, scoring and yes/no.
LibraryproductionPython