Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jansenfelipe/loggi-php
Abstraction layer PHP to integrate with a Loggi API
https://github.com/jansenfelipe/loggi-php
loggi
Last synced: about 2 months ago
JSON representation
Abstraction layer PHP to integrate with a Loggi API
- Host: GitHub
- URL: https://github.com/jansenfelipe/loggi-php
- Owner: jansenfelipe
- Created: 2018-02-14T19:56:18.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-11T11:32:59.000Z (about 5 years ago)
- Last Synced: 2024-04-18T15:14:52.501Z (8 months ago)
- Topics: loggi
- Language: PHP
- Size: 19.5 KB
- Stars: 5
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# LoggiPHP
[![Travis](https://travis-ci.org/jansenfelipe/loggi-php.svg?branch=master)](https://travis-ci.org/jansenfelipe/loggi-php)Abstraction layer PHP to integrate with a Loggi API.
Read More https://docs.api.loggi.com/docs
## HowTo Use
First, install library:
```ssh
$ composer require jansenfelipe/loggi-php
```Just instantiate the resource you want to consume.
In the example below I'm looking for all the Shops:
```php
all();foreach ($result as $shop) {
echo $shop->id;
echo $shop->pk;
echo $shop->name;
}/*
* Now, I will estimate the price to deliver at a certain point
*/$from = $result[0]; //Get a first shop
$orderResource = new OrderResource();
$to = new LocationEntity();
$to->latitude = -19.8579253;
$to->longitude = -43.94522380000001;$result = $orderResource->estimation($from, $to);
echo 'Estimated price: '. $result->price;
```
## Setup
The above example assumes that the environment variables `LOGGI_API_URL`, `LOGGI_API_EMAIL` and `LOGGI_API_KEY` are configured.
By default, the request will be sent in the production environment.
If you want, you can instantiate the `LoggiClient` manually and inject into the resource.
For example:
```php
[
'edges' => [
'node' => ['pk', 'name', 'slug']
]
]
]);$response = $client->executeQuery($query);
```
## License
The MIT License (MIT)