Download the PHP package phoenix1331/laravel-clorian without Composer
On this page you can find all versions of the php package phoenix1331/laravel-clorian. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phoenix1331/laravel-clorian
More information about phoenix1331/laravel-clorian
Files in phoenix1331/laravel-clorian
Package laravel-clorian
Short Description Confidence-aware typed decisions for Laravel models and input: let Jev make the obvious calls, send the unsure ones to a human, and measure when to trust it more.
License MIT
Homepage https://phoenix1331.github.io/laravel-clorian
Informations about the package laravel-clorian
Clorian (KLOR-yan) is Welsh for scales (as in weighing).
Confidence-aware typed decisions for Laravel: let Jev make the obvious calls, send the unsure ones to a person, and measure when to trust it more.
Plenty of decisions in an app come down to reading some text. Clorian turns that text into typed answers your code can act on, for any Eloquent model or any input:
- Support tickets: which team, how urgent, does a person need to reply
- Marketplace listings: which category, might it be prohibited
- Reviews and comments: spam or not, what the customer is unhappy about
- Refunds and claims: what the reason is, does a manager need to see it
- Contact forms and leads: sales, support or spam, answered while the visitor waits
- Content tagging: topic and audience for posts, documents or products
A policy declares the questions. Jev, TypeSafe's typed decision model, answers all of them in one call with a probability for every option. Each answer is checked against its own thresholds: confident answers apply themselves, unsure ones wait for a person, the rest fall back to your defaults. Every human review is recorded, so Clorian can tell you when an answer has earned more trust.
Full documentation: phoenix1331.github.io/laravel-clorian, including a worked example built on it.
Why
A model can read text, but some of its answers will be wrong, and a label alone does not tell you which. Clorian puts a threshold on every answer and keeps score.
- Thresholds per question and per option. Auto-accepting "critical" urgency wakes someone up, so it can always go to a person while "low" is accepted sooner.
- Calibration from real reviews.
clorian:statsshows how often people agreed with Jev at each confidence, and suggests where a threshold can move. - Model events, not middleware. Models saved from jobs, APIs, Livewire and console commands are weighed too, not just web requests.
- Private by default. Emails, phone numbers and long digit runs are redacted before anything leaves your app, and stored input is encrypted.
- Headless and swappable. No views or routes. Jev sits behind a driver contract, with a fake so your tests never call the API.
Installation
Requires PHP 8.3+ and Laravel 12 or 13.
-
Install the package from Packagist:
-
Publish the config and migrations. The installer asks whether to weigh models queued or sync, then runs
migrate: -
Add your TypeSafe key to
.env: -
Check the key with one sample call, then pin
JEV_MODELto the version it reports:jev-latestmoves without notice, which shifts confidences and invalidates calibration. - In queued mode, run a queue worker as you would for any queued job:
Then add #[Weigh] and HasWeighings to a model and write its policy, as in Usage. To try it without a key, set CLORIAN_DRIVER=fake.
Clorian is pre-1.0, so Composer pins ^0.1 and a minor release may include breaking changes. Read the changelog before upgrading.
How it works
The flow is the same for any model. Here it is with a support ticket:
- The ticket is saved. The
HasWeighingstrait has already registered Clorian's model listener; there is nothing to wire up. - Clorian queues a job once the save commits (in sync mode it weighs during the save), redacts the
#[Weigh]fields and asks Jev every question in the policy at once. - Each answer is checked against its thresholds. Billing at 0.98 is accepted; normal urgency at 0.71 waits for a person.
- Your policy's
apply()runs with the accepted answers and your defaults for the rest, and events fire for anything listening. - A person reviews the urgency.
apply()runs again with their decision, and the review counts towards calibration.
| You want to | Write | Who calls it |
|---|---|---|
| Weigh a model when it is saved | #[Weigh(...)] and use HasWeighings |
Clorian, on create and when those fields change |
| Change the model from the answers | Your policy's apply() |
Clorian, after every weighing and every review |
| Notify, page someone, send a reply | An event listener (optional) | Laravel, when Clorian fires the event |
| Decide about data with no model | Clorian::now() |
You, where the data arrives |
| Let people review answers | Your own screen, calling Clorian::review() |
You: Clorian is headless |
apply() runs after every weighing and every review, and again on weighNow() and clorian:rescan, so make it set values (a queue, a priority) that are safe to set twice. Put anything that must happen once, such as an email, in a listener.
Usage
The worked example routes support tickets. Mark the model with the policy that weighs it and the fields to send:
The policy declares the questions, the defaults for answers that cannot be trusted, and what to do with the result:
The model then gives you its history and a review queue:
For input with no model, weigh it while the visitor waits. Sync calls time out after 2 seconds and fall back to the defaults:
React to outcomes with ordinary listeners. AnswerAccepted, AnswerNeedsReview, AnswerReviewed and WeighingFailed fire after the save commits and carry ids and values, never the content.
Review and calibration
Record a human decision from your own UI; apply() runs again with it in place:
clorian:stats shows how often people agreed with Jev, by confidence band, and suggests an accept threshold once at least 30 reviews from a band upwards are upheld 95% of the time:

clorian:tune applies a threshold, showing the values before and after and asking first:

Commands
| Command | What it does |
|---|---|
clorian:install |
Publishes the config and any missing migrations, asks for the mode, prints the .env keys. Safe to run again |
clorian:ping |
One sample call: whether the key is set, the version that answered, latency |
clorian:stats {policy?} --days=30 |
Counts, review rates, rates by confidence band, suggested thresholds |
clorian:tune {policy} {question} --option= --accept= --review= |
Changes a threshold after showing before and after; --accept=never always reviews |
clorian:rescan {model} --since= --chunk=500 --sync |
Weighs existing models again, keeping human decisions on unchanged content |
clorian:prune --pretend |
Deletes old weighings and those of deleted models, clears old stored input. Schedule it daily |
clorian:add-column {table} |
Writes a migration for an indexed clorian_status column that pendingReview() reads, for busy apps |
Configuration
config/clorian.php, published by clorian:install:
| Key | Default | Environment variable |
|---|---|---|
driver |
jev |
CLORIAN_DRIVER (jev, fake or your own) |
drivers.jev.key |
none | JEV_API_KEY |
drivers.jev.model |
jev-latest |
JEV_MODEL |
mode |
queued |
CLORIAN_MODE (queued or sync) |
queue |
default |
CLORIAN_QUEUE |
sync_timeout |
2.0 seconds |
|
store_input |
subjectless |
CLORIAN_STORE_INPUT (none, subjectless or always) |
default_thresholds |
accept 0.90, review 0.60 |
|
calibration |
target 0.95, min_sample 30 |
|
prune |
weighings after 90 days, input after 30 |
The documentation lists every key.
Testing your app
Clorian::fake() swaps in a scripted driver. Weighings still run for real (thresholds, storage, apply()), nothing leaves your app, and every weighing is recorded:
Data and privacy
Clorian sends the #[Weigh] fields (or the input to Clorian::now()) and your policy's context() to TypeSafe, after redaction, with your key in the Authorization header only. It stores answers, confidences, thresholds and reviews; the input itself only as store_input allows, redacted and encrypted. Events, exceptions, logs and queued jobs never carry content. SECURITY.md sets out exactly what is sent and stored.
Compatibility
| Supported | |
|---|---|
| PHP | 8.3, 8.4, 8.5 |
| Laravel | 12, 13 |
| Databases | SQLite, PostgreSQL, MySQL, MariaDB |
| Jev | Tested with jev-1.14.0 (what jev-latest points to as of November 2026) |
Contributing
See CONTRIBUTING.md, CHANGELOG.md and SECURITY.md. Clorian is a sibling of laravel-jev-moderation and shares its JEV_API_KEY and JEV_MODEL.
Licence
MIT. See LICENSE.md.
All versions of laravel-clorian with dependencies
illuminate/bus Version ^12.0|^13.0
illuminate/console Version ^12.0|^13.0
illuminate/container Version ^12.0|^13.0
illuminate/contracts Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/queue Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
laravel/prompts Version ^0.3