Marc Reichel’s LayaPHP connects PHP applications to Laya, a self-hosted text decision engine. It sends Jev-shaped requests to /v1/systemone and converts the answers into application objects. The code includes evaluation and review-routing tools alongside the client.

A decision class defines the questions

  • Constructor attributes supply questions; enum cases supply the available labels.
  • Booleans map to yes/no questions, while ordered levels support urgency or severity scores.
  • A nullable field can become null when its answer confidence falls below a configured threshold.
  • decideWithResult() keeps the typed object beside the underlying probabilities and truncation report.

These checks make application behavior explicit. A correctly constructed object can still contain a wrong classification.

Measure the review boundary

The evaluation command reads labeled CSV or JSON Lines examples and compares them with raw model answers. It reports accuracy, confusion tables, confidence buckets, and yes/no precision and recall.

Its implementation suggests a confidence cutoff by scanning the observed scores until retained answers meet the requested precision. For yes/no questions, it also searches for the threshold with the best F1, a measure balancing precision and recall.

Both searches use the same supplied rows that produce the report. Treat those rows as tuning data, then evaluate the chosen policy on separate examples. The README’s sample report is an illustration, not a result reproduced here.

Compatibility has limits

The repository targets Laya’s server. Its automated contract checks compare request and fixture-response fields with TypeSafe’s OpenAPI description. The README explicitly says the hosted Jev API has not been tested.

Laya’s answer_confidence is an extension. When it is absent, the client falls back to ordinary confidence. That preserves the API surface while changing the signal behind a review threshold. Our Laya migration capture explains why thresholds need fresh evidence after a backend change.

Check the surrounding policy

  • Laravel’s validation rule rejects unavailable or busy inference by default; passWhenUnavailable() explicitly changes that behavior.
  • Optional revision-aware caching separates answers after checkpoint updates, but falls back to ordinary keys when revision lookup fails.
  • Prediction events omit source text by default; applications can explicitly include it.
  • Self-hosting removes a hosted-model dependency while leaving compute, operations, and data handling with the operator.

Caveat: source and test code were inspected at commit 2d06cafae84c9200c0833589e71777ddbc108e4e; PHP tests and live inference were not run.