PHPackages                             rbit/milk-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. rbit/milk-sdk-php

Abandoned → [hi-folks/milk-sdk-php](/?search=hi-folks%2Fmilk-sdk-php)ArchivedLibrary[API Development](/categories/api)

rbit/milk-sdk-php
=================

Milk SDK PHP is a (fluent) open-source PHP library that makes it easy to integrate your PHP application with location services like XYZ Hub API, Geocoder API, ...

0.1.0(6y ago)110[1 issues](https://github.com/roberto-butti/milk-sdk-php/issues)MITPHPPHP &gt;=7.4.0

Since Mar 7Pushed 6y ago1 watchersCompare

[ Source](https://github.com/roberto-butti/milk-sdk-php)[ Packagist](https://packagist.org/packages/rbit/milk-sdk-php)[ Docs](https://github.com/roberto-butti/milk-sdk-php)[ RSS](/packages/rbit-milk-sdk-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Milk SDK PHP
============

[](#milk-sdk-php)

[![Actions Status](https://github.com/roberto-butti/milk-sdk-php/workflows/PHP%20Composer/badge.svg)](https://github.com/roberto-butti/milk-sdk-php/actions)[![GitHub license](https://camo.githubusercontent.com/4d1cc1c3e4fee28c1abedfd8eb89da31d107d0d7fd86f282afb73c2d9ec7d4d4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f726f626572746f2d62757474692f6d696c6b2d73646b2d706870)](https://github.com/roberto-butti/milk-sdk-php/blob/master/LICENSE.md)

Milk SDK PHP is a (fluent) open-source PHP library that makes it easy to integrate your PHP application with location services like:

- XYZ Hub API;
- **Routing** API;
- **Weather** Destination API;
- Geocoder API;
- ...

Getting Started
---------------

[](#getting-started)

### Install the SDK

[](#install-the-sdk)

In your PHP project install package via composer:

```
composer require rbit/milk-sdk-php
```

### Configuring XYZ HUB

[](#configuring-xyz-hub)

With this SDK you can consume XYZ API. You have 2 options:

- use an your own instance of XYZ HUB or
- use XYZ HUB Cloud

#### Configure SDK with your own instance of XYZ HUB

[](#configure-sdk-with-your-own-instance-of-xyz-hub)

Running your own instance of XYZ HUB means that you already have your instance of . A tutorial about how to setup XYZ Hub locally (on localhost):

Create a *.env* file. Fill it with:

```
XYZ_ACCESS_TOKEN=""
XYZ_API_HOSTNAME="http://localhost:8080"

```

#### Configure SDK with XYZ HUB Cloud service

[](#configure-sdk-with-xyz-hub-cloud-service)

Using XYZ HUB Cloud Service means that you are using this host .

To use this service you need to sign in as developer on  and create your plan (for exampole Feemium) and obtain your Access Token.

Once you have your access token, create a *.env* file. You can start from a sample file (*.env.dist*):

```
cp .env.dist .env
```

Then, you need to fill your XYZ\_ACCESS\_TOKEN in .env file with your access token.

Quick Examples
--------------

[](#quick-examples)

In order to use the Milk SDK, you need to:

- create a PHP file
- include the autoload.php file
- declare all imports via *use*
- load environment configuration (via *Dotenv*)
- get your token
- get your XYZ Spaces
- display your result

```
