2017 © Pedro Peláez
 

symfony-bundle routific-bundle

Routific PHP SDK bundle

image

foodcheri/routific-bundle

Routific PHP SDK bundle

  • Tuesday, June 14, 2016
  • by davidginat
  • Repository
  • 10 Watchers
  • 0 Stars
  • 761 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 4 % Grown

The README.md

RoutificBundle

SDK Routific, (*1)

Installation

Install the bundle by addind the following lines into composer.json, (*2)

"require": {
    ...
    "foodcheri/routific-bundle": "dev-master"
},
"repositories": [{
    "type": "vcs",
        "url": "https://github.com/foodcheri/RoutificBundle.git"
}],

Update your vendors, (*3)

composer update

Add the configuration in config.yml, (*4)

...
routific:
    api_url: ~ #default: https://api.routific.com/v1
    token_key: routific_token

Usage

Instantiate the Routific client :, (*5)

$clientRoutific = $this->get('foodcheri_sdk_routific.client');

To resolve Vehicle Routing Problem, instantiate a VehicleRoutingProblem Enpoint object :, (*6)

$problem = new VehicleRoutingProblem();

Add a visit to a problem endpoint :, (*7)

$problem->addVisit("order_1", array(
    "location" => array(
        "name" => "Visit1 name",
        "lat" => 49.227607,
        "lng" => -123.1363085
    ),
    "start" => "19:00",
    "end" => "19:30",
    "duration" => 5,
    "load" => 1,
    "type" => "A",
    "priority" => "high"
    )
);

Add a vehicle to a problem endpoint :, (*8)

$problem->addVehicle("vehicle_1", array(
    "start_location" => array(
        "id" => "hub id"
        "name" => "hub name",
        "lat" => 49.227607,
        "lng" => -123.1363085
    ),
    "end_location" => array(
        "id" => "hub id",
        "name" => "hub name",
        "lat" => 49.227607,
        "lng" => -123.1363085
    ),
    "shift_start" => "18:00",
    "shift_end" => "22:30",
    "min_visits" => 10,
    "capacity" => 20,
    "type" => ["A", "B"],
    "speed" => "bike",
    "strict_start" => true,
    "break_start" => "12:00",
    "break_end" => "13:30",
    "break_duration" => 30
    )
);

Add an option to a problem endpoint :, (*9)

"options": {
   "traffic": "slow",
   "min_visits_per_vehicle": 5,
   "balance": true,
   "min_vehicles": true,
   "shortest_distance": true
}
$problem->addOption(array("traffic" => "slow"));



Finaly execute the route calculation for the endpoint problem :
$clientRoutific->route($problem);

## Response
{ "status": "success", "total_travel_time": 31.983334, "total_idle_time": 0, "num_unserved": 0, "unserved": null, "solution": { "vehicle_1": [ { "location_id": "depot", "location_name": "800 Kingsway", "arrival_time": "08:00" }, { "location_id": "order_3", "location_name": "800 Robson", "arrival_time": "08:10", "finish_time": "08:20" }, { "location_id": "order_2", "location_name": "3780 Arbutus", "arrival_time": "08:29", "finish_time": "09:10" }, { "location_id": "order_1", "location_name": "6800 Cambie", "arrival_time": "09:19", "finish_time": "09:29" }, { "location_id": "depot", "location_name": "800 Kingsway", "arrival_time": "09:39" } ] } }

The Versions

14/06 2016

dev-master

9999999-dev

Routific PHP SDK bundle

  Sources   Download

proprietary

The Requires

 

by Floran Pagliai

sdk routific bundle

14/06 2016

v1.0.0

1.0.0.0

Routific PHP SDK bundle

  Sources   Download

proprietary

The Requires

 

by Floran Pagliai

sdk routific bundle