What do you want to do?
4 use cases
-
Route support tickets by department, urgency and churn risk
Send each incoming ticket to the right team on your own server, with a confidence check for human review.
- Laya PHP
- Work and operations
- Intermediate
View prompt
Using the marcreichel/laya-php repo, add a readonly decision class for <ticket queue> with department, urgency and churn fields, and call Laya::decide on the ticket body. Report the typed result and its answerConfidence for a sample ticket, and verify that `php artisan laya:try` prints a hydrated value for that class.
-
Block abusive or spam text in Laravel form submissions
Add a validation rule that asks a yes/no question about each submitted text and rejects the bad ones.
- Laya PHP
- Work and operations
- Intermediate
View prompt
In the marcreichel/laya-php repo's Laravel setup, add a Decides::not rule with the question <moderation question> to the <form field> validation in <controller or form request>. Report which test inputs pass and fail, and verify that a request with a fake answer of true is rejected.
-
Unit-test classification code without a running server
Run your tests against a built-in fake so CI does not need Laya or Docker.
- Laya PHP
- Work and operations
- Intermediate
View prompt
In the marcreichel/laya-php repo, write a test for <class that calls Laya> that uses the built-in fake to return <expected answers>. Report the test result and the call count, and verify that the test passes with no laya-serve running.
-
Save typed decisions in an Eloquent JSON column
Cast a model attribute to a decision class so the result reads back as a typed object.
- Laya PHP
- Work and operations
- Intermediate
View prompt
In the marcreichel/laya-php repo, add an AsDecision cast for <decision class> on the <model> model's <json column>. Save one decision, reload the model and report the stored JSON and the read-back enum value. Verify that assigning a non-decision value throws InvalidDecisionCastException.
How to use Laya PHP
- Check you have what it needs: PHP 8.4+ and Composer; A PSR-18 HTTP client such as Guzzle or Symfony HttpClient; Docker, to run laya-serve from the repo's compose.yaml.
- Open marcreichel/laya-php on GitHub and read the README and license.
- Run
composer require marcreichel/laya-phpin your PHP project. - Start the local server from a clone of this repo with
docker compose up -d --wait, then check it withphp artisan laya:healthin a Laravel app. - Write a readonly decision class with enum fields for department and urgency and a bool for churn, then try it with
php artisan laya:try "App\Decisions\Triage" "Hi, we were billed twice for March. Refund it today or we cancel.". - In your queued job, call
$laya->decide($ticket->body, Triage::class)and save the department on the ticket.
These steps come from our top use case, Route support tickets by department, urgency and churn risk, which also has a copy-paste agent prompt.
Get 5 new use cases every morning. Free, one short email, unsubscribe anytime.
Get them freeLaya PHP alternatives · Best AI repos for Work and operations
About this repo
- Who it is forPHP and Laravel developers who need to route, score or flag text on their own server without per-token LLM fees.
- Why it is hot
- LanguagePHP
- Sourcegithub.com/marcreichel/laya-php · Back to Hot repos
Requirements
- PHP 8.4+ and Composer
- A PSR-18 HTTP client such as Guzzle or Symfony HttpClient
- Docker, to run laya-serve from the repo's compose.yaml
- Laravel 13+ for the Laravel steps (service provider, artisan commands, validation rule, cast)
Maintain Laya PHP? Add the Featured on Deduped badge
Paste this into your README:
[](https://dedupedai.com/use-cases/marcreichel-laya-php/?ref=badge)
Questions about Laya PHP
What is Laya PHP?
A PHP SDK for classifying text with Laya, a self-hosted multilingual decision engine that returns typed enums, ints and bools without an LLM API bill. It is an open-source project on GitHub: https://github.com/marcreichel/laya-php.
Who is Laya PHP for?
PHP and Laravel developers who need to route, score or flag text on their own server without per-token LLM fees.
What can I do with Laya PHP?
4 use cases so far, for example: Route support tickets by department, urgency and churn risk; Block abusive or spam text in Laravel form submissions; Unit-test classification code without a running server. Each has steps and a copy-paste agent prompt.
What do I need to run Laya PHP?
PHP 8.4+ and Composer; A PSR-18 HTTP client such as Guzzle or Symfony HttpClient; Docker, to run laya-serve from the repo's compose.yaml; Laravel 13+ for the Laravel steps (service provider, artisan commands, validation rule, cast).
What are alternatives to Laya PHP?
Other hot AI repos in Work and operations: AI Job Search, Solidcraft, Fastbrowse, Awesome AI Agent Platforms, Nautilo.
Is Laya PHP safe to run?
Deduped does not own, audit or vouch for it. Read the README and license, run it on your own systems first and review every command before you run it.