Download the PHP package mariodevv/nativephp-health-connect without Composer
On this page you can find all versions of the php package mariodevv/nativephp-health-connect. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mariodevv/nativephp-health-connect
More information about mariodevv/nativephp-health-connect
Files in mariodevv/nativephp-health-connect
Package nativephp-health-connect
Short Description Android Health Connect for NativePHP Mobile: read steps, distance, calories, heart rate, weight, sleep and exercise, with deduplicated aggregates
License MIT
Informations about the package nativephp-health-connect
Health Connect for NativePHP Mobile
Read Android Health Connect data from PHP: steps, distance, active calories, heart rate, weight, sleep and exercise sessions. Includes deduplicated totals (aggregate) so overlapping sources (phone + watch) are not double counted.
Android only. iOS HealthKit is not supported.
Requirements
- NativePHP Mobile 3.x or 4.x
- Android 14+ (API 34). In your app's
.env:
Health Connect ships with Android 14. On older versions it is a separate app that this plugin cannot detect, so they are not supported.
Install
Usage
$from / $to accept DateTimeInterface or any string DateTimeImmutable parses. Times are returned as UTC ISO-8601.
Writing (1.1)
Ask for write access on top of read access with requestPermissions(['steps', 'weight'], write: true), then:
Only steps and weight can be written. status()['writable'] lists what the user granted. Health Connect applies its own source priority when reading totals, so steps you write may be dropped from aggregate('steps') where the phone's own step counter overlaps in time.
Errors come back as ['error' => '...']: permission_required, unavailable, unknown type '...', write not supported for '...'.
Types
| Type | read record fields |
aggregate |
|---|---|---|
steps |
start, end, count, source |
count |
distance |
start, end, meters, source |
meters |
active_calories |
start, end, kcal, source |
kcal |
heart_rate |
start, end, samples[{time,bpm}], source |
avg, min, max |
weight |
time, kg, source |
not supported |
sleep |
start, end, title, stages[{start,end,stage}], source |
seconds |
exercise |
start, end, title, type, source |
not supported |
Limits
readreturns at most 10,000 records per call. Narrow the time range or useaggregate.- Writing is limited to steps and weight.
- Sleep
stagesis implemented but not yet tested against a real device that records stages (tested with sessions without stages). - Health Connect only returns data the user has granted, and only data written by other apps or devices.
License
MIT