Download the PHP package oriceon/mammotion without Composer
On this page you can find all versions of the php package oriceon/mammotion. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download oriceon/mammotion
More information about oriceon/mammotion
Files in oriceon/mammotion
Package mammotion
Short Description Laravel client for the Mammotion Open API — control Luba / Yuka robot mowers: devices, live status, work parameters, commands and telemetry subscriptions.
License MIT
Homepage https://github.com/oriceon/mammotion
Informations about the package mammotion
Mammotion for Laravel
Laravel client for the Mammotion Open API — list your Luba / Yuka robot mowers, read what they are doing right now, send work commands and subscribe to live telemetry.
Requirements
- PHP 8.5+
- Laravel 13+
- API credentials generated at https://developer.mammotion.com/credentials
Installation
The service provider and the Mammotion alias are auto-discovered. Publish the config if you need to change it:
Configuration
Only the credentials are mandatory:
Everything else has a sane default and can be overridden through config/mammotion.php or the environment:
| Key | Env | Default | Meaning |
|---|---|---|---|
auth_url |
MAMMOTION_AUTH_URL |
https://id.mammotion.com |
OAuth2 server that issues the access token |
api_url |
MAMMOTION_API_URL |
https://api-open.mammotion.com |
API server |
language |
MAMMOTION_LANGUAGE |
en-US |
Sent as Accept-Language |
timeout |
MAMMOTION_TIMEOUT |
15 |
HTTP timeout, in seconds |
token_leeway |
MAMMOTION_TOKEN_LEEWAY |
60 |
Safety margin shaved off expires_in when caching the token |
cache.store |
MAMMOTION_CACHE_STORE |
app default | Cache store holding the tokens |
cache.prefix |
MAMMOTION_CACHE_PREFIX |
mammotion |
Cache key prefix |
Authentication
Authentication is client_credentials and is handled for you: every call fetches the token if needed, caches it until shortly before it expires (as Mammotion asks integrators to do) and, on a 401, re-authenticates and retries the request exactly once. A refresh_token, when the server returns one, is preferred over a new client_credentials exchange.
You never need to call it explicitly, but it is available:
Usage
Resolve the client however you prefer — facade, container, or a plain instance with explicit credentials:
Devices
What the mower is doing right now
Two limitations belong to the Mammotion API, not to this package:
- REST does not expose which task or area is running, nor the progress percentage.
Mammotion::tasks($id)only lists the tasks defined in the app, without marking the active one. work-paramsis asynchronous despite its name. The firstGETmerely asks the mower to report; the immediate response is often just{"commandResult": true, "resultMessage": "Command has been sent", …}with every value at0.
The package never turns those zeros into settings. When it happens, settings stays empty and workParamsPending is true. To tell the two apart yourself:
Live progress, track and coordinates arrive exclusively through the SSE push channel — see Telemetry.
Commands
Mammotion::taskNames('DEV-1') returns the names accepted by start().
Telemetry
Subscribing tells the Mammotion server to push updates over its SSE channel. A subscription expires after 10 minutes and has to be renewed; the API accepts at most 20 devices per request.
Enums
| Enum | Covers |
|---|---|
MammotionActionEnum |
commands accepted by POST /v1/mower/action |
MammotionDeviceStatusEnum |
mower states, mapped case-insensitively |
MammotionJobContentEnum |
operating mode (mowing / collecting / both) |
MammotionSubscriptionPropertyEnum |
telemetry property keys |
Every case exposes a translated label(). Translations ship for en and ro; publish them to add your own locale.
Error handling
Both transport failures (HTTP != 2xx) and application errors (code other than 0 / 200 in the response envelope) raise MammotionApiException:
A missing or empty credential pair raises MammotionConfigurationException at build time.
Testing
The package is covered by Pest, and every HTTP call goes through Laravel's HTTP client — so Http::fake() is all you need in your own tests:
License
MIT. See LICENSE.md.
All versions of mammotion with dependencies
illuminate/contracts Version ^13.0
illuminate/http Version ^13.0
illuminate/support Version ^13.0