The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
LayaPHP is a PHP SDK for sending text to a separately running Laya decision engine; it is not a classifier that runs inside your PHP process. To classify text, install the SDK and a PSR-18 HTTP client, then configure it to reach a laya-serve HTTP endpoint. The repository documents local service operation with Docker Compose as well as configuration for another endpoint. LayaPHP documentation
What LayaPHP does—and what it does not
The project describes Laya as a multilingual decision engine that answers typed questions about text in a single forward pass. Through the PHP SDK, an application can request a categorical choice, an ordered score, or a yes/no decision, and inspect the returned answer and confidence information. These describe the API, not independently verified classification accuracy. LayaPHP documentation
The PHP application calls the service over HTTP. Consequently, a working installation requires both the Composer package and a reachable Laya service. “Self-hosted” is the project’s deployment positioning: the operator can run or select the service endpoint in infrastructure under their control. Data exposure still depends on endpoint location, network configuration, logging, and hosting practices.
What you need before installing
- PHP 8.4 or newer, according to the project documentation and Packagist package metadata.
- Composer and a PSR-18 HTTP client. The README gives Guzzle and Symfony HttpClient as examples; the SDK discovers an installed client.
- A reachable
laya-serveendpoint. For local operation, the repository documents Docker Compose and useshttp://localhost:8000.
Packagist lists version 1.2.0, published October 1, 2026, and PHP ^8.4. Package versions and runtime requirements can change, so check the current Packagist package page before choosing versions. The repository identifies the project license as Apache-2.0. LayaPHP repository
#1 Best Overall
Install the SDK and connect it to a service
- Install the package: run
composer require marcreichel/laya-phpin your PHP project. - Install a PSR-18 client: choose a compatible client, such as one of the examples in the README, and add it to the project if it is not already installed.
- Start or identify the service: use the repository’s Docker Compose setup for a local service, or arrange a reachable endpoint. The documented local address is
http://localhost:8000. - Configure the endpoint: set
LAYA_URLto the service URL and configureLAYA_API_KEYwhere the endpoint uses an API key. Follow the current repository instructions for the exact client setup and available options. - Verify connectivity: send a small test request from the application environment. A locally running service is not reachable at
localhostfrom every deployment context—for example, a separate container may need a service hostname rather than its own loopback address.
The SDK’s configuration does not install or start the Python inference service. Treat service deployment, endpoint reachability, and PHP client configuration as separate parts of the setup. Repository setup documentation
Use typed decisions for application workflows
The repository documents three question styles. A support-ticket workflow can combine them: choose a destination team, score urgency across ordered levels, and ask whether the text contains an explicit cancellation threat. This illustrates how to express decisions; it is not a claim about measured results.
Rank #2
- Choice: select one label from options, optionally with descriptions. Suitable examples include a support queue or ticket category.
- Score: place a text on ordered levels. An urgency scale is one possible application.
- Yes/no: return a binary decision, with optional criteria to clarify what counts as yes.
The PHP SDK exposes typed outputs that can be mapped into readonly classes and enums. It also exposes answer confidence, including an answerConfidence value the README recommends using to identify uncertain items for human review. Confidence is a review signal, not proof that an answer is correct; choose any review threshold based on your application’s risk and validate it against your own data. LayaPHP API documentation
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Laravel integration and framework-version distinction
The repository documents Laravel 13+ auto-discovery of its service provider, singleton registration of Laya, and environment-based settings for the service URL, API key, and optional cache configuration. It also describes dependency injection, a laya:health Artisan command, and a fake for tests. Check the README for the current configuration and usage details. LayaPHP Laravel documentation
Laravel integration is optional: Packagist lists Laravel as a suggested dependency rather than a requirement for the standalone SDK. Laravel’s own 13.x AI SDK documentation separately describes an experimental classification API backed by probabilities, with an API that may change in minor releases. That first-party API is distinct from LayaPHP’s service-provider integration. Packagist · Laravel 13.x AI SDK documentation
Plan around server versions, request volume, and limits
Some capabilities depend on the laya-serve version rather than being universal SDK behavior. The project says the default router chooses a checkpoint by language and documents an option to pin a model. Longer-document handling, including maxLen and a truncated indicator, is documented for recent server versions. The README ties particular features to server versions 0.3.21, 0.3.22, or 0.3.23 and newer; check the relevant feature’s requirement and keep SDK/server compatibility in view before relying on it. Version and feature documentation
Rank #4
The README says the server handles one inference request at a time. For many inputs, it recommends predictMany() or decideMany() on supported server versions. Documented request limits are:
Recommended Free Tools
- Up to 64 states and 64 questions in a batch.
- Up to 50,000 characters of state.
- Up to 100 choice options and 32 score levels.
- Up to 512 answer options total.
- If one state in a batch is rejected, the batch request fails.
These are documented limits, not throughput figures. A single-request-at-a-time server can affect queueing and concurrency design; batching may help group inputs where supported, but it does not establish a particular processing rate. Validate behavior with the service version and workload you plan to operate. LayaPHP operational documentation
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Decide whether self-hosting fits your application
The project positions self-hosting as a way to keep text within the operator’s infrastructure and avoid per-token fees. Those are deployment aims, not independent privacy or cost findings. Actual data handling depends on where the chosen endpoint runs and how traffic and logs are managed; total cost depends on infrastructure and ongoing operation.
The available project and package documentation does not establish independent accuracy benchmarks, latency figures, hardware sizing, privacy audits, or a total-cost comparison. Before routing support tickets, email, or other sensitive text, assess endpoint access and logging, decide which uncertain cases need human review, and test classification quality on representative examples from your own application. Choose a service version that supports the features and batch behavior your design depends on. LayaPHP documentation
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

