Download the PHP package unifyunits/unifyunits-laravel without Composer
On this page you can find all versions of the php package unifyunits/unifyunits-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download unifyunits/unifyunits-laravel
More information about unifyunits/unifyunits-laravel
Files in unifyunits/unifyunits-laravel
Package unifyunits-laravel
Short Description Laravel client for the UnifyUnits Measurement API
License MIT
Informations about the package unifyunits-laravel
UnifyUnits Laravel SDK
A small Laravel HTTP client for the UnifyUnits Measurement API. It sends values as decimal strings so PHP floating-point conversion does not alter precision.
Requirements
- PHP 8.2 or newer
- Laravel 10, 11, 12, or 13
Install
Until the package is published on Packagist, add the GitHub repository to your
application's Composer configuration and install the v0.1 release:
After Packagist publication, the repository configuration step will no longer be needed.
Laravel discovers the service provider automatically. Publish its configuration and set credentials in the application environment:
Keep API keys in server-side environment configuration. Do not expose them in browser code, source control, or logs.
Usage
Inject the client contract:
Or use the facade:
Available methods are convert, convertBatch, categories, category,
units, unit, and health. Conversion values must be strings. Batch requests
return each item's success or error plus aggregate counts; individual item
errors do not make the entire batch response an HTTP failure.
HTTP failures throw UnifyUnits\Laravel\Exceptions\ApiException, which offers
errorCode(), requestId(), and details() helpers. Network and timeout
exceptions from Laravel's HTTP client remain distinguishable from API errors.
Local development and tests
Tests use Laravel's HTTP fake and contain no production credentials. They can be run on PHP 8.2 or newer with:
This package is released independently from the API. GitHub releases do not publish it to Packagist.
All versions of unifyunits-laravel with dependencies
illuminate/contracts Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/http Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/support Version ^10.0 || ^11.0 || ^12.0 || ^13.0