valentinmari/glovo-api-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

valentinmari/glovo-api-php

Composer 安装命令:

composer require valentinmari/glovo-api-php

包简介

Glovo Business API

README 文档

README

Create, retrieve and track your Glovo orders trough their Business API.

Requirements

PHP 5.4.0 and later.

Composer

You can install the bindings via Composer. Run the following command:

$ composer require valentinmari/glovo-api-php

To use the Glovo API in your project, use Composer's autoload:

require_once('vendor/autoload.php');

Dependencies

The bindings require the following extensions in order to work properly:

  • curl, although you can use your own non-cURL client if you prefer
  • json
  • mbstring (Multibyte String)

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.

Getting Started

Create an account in Glovo (it can be created from the App). This api needs a credit card associated to your account. You can add one from your app and it will be used automatically for any order. In order to get your API credentials you should login in the desired environment and go to Credentials section on your profile.

Example ApiKey & ApiSecret:

$apiKey = '125238463972712';
$apiSecret = '081f8c9680d457a088b4413a62ddf84c';

Simple usage looks like:

<?php

include 'vendor/autoload.php';

use Glovo\Api;
use Glovo\Model\Order;
use Glovo\Model\Address;


// get credentials on https://business.glovoapp.com/dashboard/profile or https://business.testglovo.com/dashboard/profile
$api = new Api( '125238463972712', '081f8c9680d457a088b4413a62ddf84c' );
$api->sandbox_mode( true );

$sourceDir = new Address( Address::TYPE_PICKUP, -34.919861, -57.919027, "Diag. 73 1234", "1st floor" );
$destDir = new Address( Address::TYPE_DELIVERY, -34.922945, -57.990177, "Diag. 73 75", "3A");

$order = new Order();
$order->setDescription( "1 big hammer" );
$order->setAddresses( [$sourceDir, $destDir] );
//$order->setScheduleTime( ( new \DateTime( '+1 hour' ) )->setTime( 19, 0 ) );

$orderEstimate = $api->estimateOrderPrice( $order );

echo "Estimate: {$orderEstimate['total']['amount']}{$orderEstimate['total']['currency']} \n";

$orderInfo = $api->createOrder( $order );

echo "Order created, ID: {$orderInfo['id']}, state: {$orderInfo['state']} \n";

See full example in example.php

Update Certificates

In order to update the CA Root certificates you can run:

$ chmod +x ./update_certs.php
$ ./update_certs.php

Documentation

You can read [the Glovo B2B API docs][https://api-docs.glovoapp.com/b2b/index.html#introduction].

统计信息

  • 总下载量: 3.59k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 23
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 23
  • Watchers: 3
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固