PHPackages                             thiagolovatine/uber-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. thiagolovatine/uber-php

ActiveLibrary

thiagolovatine/uber-php
=======================

A php client for consuming the Uber API

1.0.0(11y ago)07MITPHPPHP &gt;=5.4.0

Since Mar 24Pushed 7y ago1 watchersCompare

[ Source](https://github.com/ThiagoLovatine/uber-php)[ Packagist](https://packagist.org/packages/thiagolovatine/uber-php)[ Docs](http://github.com/stevenmaguire/uber-php)[ RSS](/packages/thiagolovatine-uber-php/feed)WikiDiscussions master Synced yesterday

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

Uber PHP Client
===============

[](#uber-php-client)

[![Latest Version](https://camo.githubusercontent.com/fba0d50f26c7fda0a6f5ef8f12df0cb48d93fcad4737f2f93d899ce7365b6169/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73746576656e6d6167756972652f756265722d7068702e7376673f7374796c653d666c61742d737175617265)](https://github.com/stevenmaguire/uber-php/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/12343080ecb691a4d0218e1608d128d86ce07a264a8cd990ce56a27a5f27d9f0/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73746576656e6d6167756972652f756265722d7068702f6d61737465722e7376673f7374796c653d666c61742d7371756172652631)](https://travis-ci.org/stevenmaguire/uber-php)[![Coverage Status](https://camo.githubusercontent.com/28404da555c9b7510e1c14b40c1552856c41a58e373c982f1a91c307c19228c4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f73746576656e6d6167756972652f756265722d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stevenmaguire/uber-php/code-structure)[![Quality Score](https://camo.githubusercontent.com/2b7f242997880cb753ecfdc42bd29e5d4ac45d4f67e209637471ca04e5fe0be9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f73746576656e6d6167756972652f756265722d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stevenmaguire/uber-php)[![Total Downloads](https://camo.githubusercontent.com/1dd59e5c03a93989113663b9cbf294de86236179ea3c2652d0e7f68b4ba807bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746576656e6d6167756972652f756265722d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stevenmaguire/uber-php)

A PHP client for authenticating with Uber using OAuth 2.0 and consuming the API.

*This package is intended to be used for communicating with the Uber API after you've secured an access token from your users. To authenticate users and retrieve access tokens, use [stevenmaguire/oauth2-uber](https://github.com/stevenmaguire/oauth2-uber).*

Install
-------

[](#install)

Via Composer

```
$ composer require stevenmaguire/uber-php
```

> Note that the required version of PHP is 5.5. If you want use library with PHP 5.4 you should use 1.2.0 version.

Usage
-----

[](#usage)

### Create client

[](#create-client)

```
$client = new Stevenmaguire\Uber\Client(array(
    'access_token' => 'YOUR ACCESS TOKEN',
    'server_token' => 'YOUR SERVER TOKEN',
    'use_sandbox'  => true, // optional, default false
    'version'      => 'v1.2', // optional, default 'v1.2'
    'locale'       => 'en_US', // optional, default 'en_US'
));
```

*Please review the [Sandbox](https://developer.uber.com/docs/riders/guides/sandbox) documentation on how to develop and test against these endpoints without making real-world Requests and being charged.*

### Get Products

[](#get-products)

#### By location:

[](#by-location)

```
$products = $client->getProducts(array(
    'latitude' => '41.85582993',
    'longitude' => '-87.62730337'
));
```

#### By Id:

[](#by-id)

```
$product = $client->getProduct($productId);
```

[https://developer.uber.com/docs/riders/references/api/v1.2/products-product\_id-get](https://developer.uber.com/docs/riders/references/api/v1.2/products-product_id-get)

### Get Price Estimates

[](#get-price-estimates)

```
$estimates = $client->getPriceEstimates(array(
    'start_latitude' => '41.85582993',
    'start_longitude' => '-87.62730337',
    'end_latitude' => '41.87499492',
    'end_longitude' => '-87.67126465'
));
```

### Get Time Estimates

[](#get-time-estimates)

```
$estimates = $client->getTimeEstimates(array(
    'start_latitude' => '41.85582993',
    'start_longitude' => '-87.62730337'
));
```

### Get Promotions

[](#get-promotions)

```
$promotions = $client->getPromotions(array(
    'start_latitude' => '41.85582993',
    'start_longitude' => '-87.62730337',
    'end_latitude' => '41.87499492',
    'end_longitude' => '-87.67126465'
));
```

### Get User Activity

[](#get-user-activity)

This feature is only available since version `1.1`.

```
$client->setVersion('v1.2'); // or v1.1
$history = $client->getHistory(array(
    'limit' => 50, // optional
    'offset' => 0 // optional
));
```

### Get User Profile

[](#get-user-profile)

```
$profile = $client->getProfile();
```

### Update User Profile

[](#update-user-profile)

```
$attributes = array('applied_promotion_codes' => 'PROMO_CODE');
$profileResponse = $client->setProfile($attributes);
```

### Get Payment Methods

[](#get-payment-methods)

```
$paymentMethods = $client->getPaymentMethods();
```

### Get Place

[](#get-place)

```
$placeId = 'home';
$place = $client->getPlace($placeId);
```

[https://developer.uber.com/docs/riders/references/api/v1.2/places-place\_id-get](https://developer.uber.com/docs/riders/references/api/v1.2/places-place_id-get)

### Update a Place

[](#update-a-place)

```
$placeId = 'home';
$attributes = array('address' => '685 Market St, San Francisco, CA 94103, USA');
$place = $client->setPlace($placeId, $attributes);
```

[https://developer.uber.com/docs/riders/references/api/v1.2/places-place\_id-put](https://developer.uber.com/docs/riders/references/api/v1.2/places-place_id-put)

### Request A Ride

[](#request-a-ride)

```
$request = $client->requestRide(array(
    'start_latitude' => '41.85582993',
    'start_longitude' => '-87.62730337',
    'end_latitude' => '41.87499492',
    'end_longitude' => '-87.67126465',
    'product_id' => '4bfc6c57-98c0-424f-a72e-c1e2a1d49939', // Optional
    'surge_confirmation_id' => 'e100a670',                  // Optional
    'payment_method_id' => 'a1111c8c-c720-46c3-8534-2fcd'   // Optional
));
```

#### Upfront Fares

[](#upfront-fares)

Upfront fares means the total fare is known before the ride is taken.

- An end location is required
- There is no surge confirmation flow
- The user should specify a fare\_id to confirm consent to the upfront fare
- The user should specify the number of seats that are required for shared products (like UberPOOL)

1. In the products endpoint `GET /products`, products will have the `upfront_fare_enabled` field set to `true`.
2. Use the ride request estimate endpoint `POST /requests/estimate` with the `product_id` to get a `fare_id`. The `fare_id` can be used to lock down an upfront fare and arrival time for a trip. The `fare_id` expires after two minutes. If the `fare_id` is expired or not valid, we return a 422 error.
3. Request the ride using the ride request endpoint `POST /requests` with the `fare_id` returned in the previous step.

#### Surge Confirmation Flow

[](#surge-confirmation-flow)

If the ride request is using a product that has a surge multiplier, the API wrapper will throw an Exception and provide a response body that includes a surge confirmation ID.

```
try {
    $request = $client->requestRide(array(
        'product_id' => '4bfc6c57-98c0-424f-a72e-c1e2a1d49939',
        'start_latitude' => '41.85582993',
        'start_longitude' => '-87.62730337',
        'end_latitude' => '41.87499492',
        'end_longitude' => '-87.67126465'
    ));
} catch (Stevenmaguire\Uber\Exception $e) {
    $body = $e->getBody();
    $surgeConfirmationId = $body['meta']['surge_confirmation']['surge_confirmation_id'];
}
```

### Get Current Ride Details

[](#get-current-ride-details)

```
$request = $client->getCurrentRequest();
```

### Get Ride Details

[](#get-ride-details)

```
$request = $client->getRequest($requestId);
```

[https://developer.uber.com/docs/riders/references/api/v1.2/requests-request\_id-get](https://developer.uber.com/docs/riders/references/api/v1.2/requests-request_id-get)

### Update Current Ride Details

[](#update-current-ride-details)

```
$requestDetails = array(
    'end_address' => '685 Market St, San Francisco, CA 94103, USA',
    'end_nickname' => 'da crib',
    'end_place_id' => 'home',
    'end_latitude' => '41.87499492',
    'end_longitude' => '-87.67126465'
);

$updateRequest = $client->setCurrentRequest($requestDetails);
```

### Update Ride Details

[](#update-ride-details)

```
$requestId = '4bfc6c57-98c0-424f-a72e-c1e2a1d49939'
$requestDetails = array(
    'end_address' => '685 Market St, San Francisco, CA 94103, USA',
    'end_nickname' => 'da crib',
    'end_place_id' => 'home',
    'end_latitude' => '41.87499492',
    'end_longitude' => '-87.67126465'
);

$updateRequest = $client->setRequest($requestId, $requestDetails);
```

[https://developer.uber.com/docs/riders/references/api/v1.2/requests-request\_id-patch](https://developer.uber.com/docs/riders/references/api/v1.2/requests-request_id-patch)

### Get Ride Estimate

[](#get-ride-estimate)

```
$requestEstimate = $client->getRequestEstimate(array(
    'product_id' => '4bfc6c57-98c0-424f-a72e-c1e2a1d49939',
    'start_latitude' => '41.85582993',
    'start_longitude' => '-87.62730337',
    'end_latitude' => '41.87499492', // optional
    'end_longitude' => '-87.67126465', // optional
));
```

### Get Ride Map

[](#get-ride-map)

```
$map = $client->getRequestMap($requestId);
```

[https://developer.uber.com/docs/riders/references/api/v1.2/requests-request\_id-map-get](https://developer.uber.com/docs/riders/references/api/v1.2/requests-request_id-map-get)

### Get Ride Receipt

[](#get-ride-receipt)

```
$receipt = $client->getRequestReceipt($requestId);
```

[https://developer.uber.com/docs/riders/references/api/v1.2/requests-request\_id-receipt-get](https://developer.uber.com/docs/riders/references/api/v1.2/requests-request_id-receipt-get)

### Cancel Current Ride

[](#cancel-current-ride)

```
$request = $client->cancelCurrentRequest();
```

### Cancel Ride

[](#cancel-ride)

```
$request = $client->cancelRequest($requestId);
```

[https://developer.uber.com/docs/riders/references/api/v1.2/requests-request\_id-delete](https://developer.uber.com/docs/riders/references/api/v1.2/requests-request_id-delete)

### Create Reminder

[](#create-reminder)

```
$attributes = array(
    'reminder_time' => '1429294463',
    'phone_number' => '555-555-5555',
    'event' => array(
        'time' => '1429294463',
        'name' => 'Frisbee with friends',
        'location' => 'Dolores Park',
        'latitude' => '37.759773',
        'longitude' => '-122.427063',
    ),
    'product_id' => 'a1111c8c-c720-46c3-8534-2fcdd730040d',
    'trip_branding' => array(
        'link_text' => 'View team roster',
        'partner_deeplink' => 'partner://team/9383',
    )
);
$reminder = $client->createReminder($attributes);
```

### Get Reminder

[](#get-reminder)

```
$reminderId = '4bfc6c57-98c0-424f-a72e-c1e2a1d49939';
$reminder = $client->getReminder($reminderId);
```

[https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder\_id-get](https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-get)

### Update Reminder

[](#update-reminder)

```
$reminderId = '4bfc6c57-98c0-424f-a72e-c1e2a1d49939';
$attributes = array(
    'reminder_time' => '1429294463',
    'phone_number' => '555-555-5555',
    'event' => array(
        'time' => '1429294463',
        'name' => 'Frisbee with friends',
        'location' => 'Dolores Park',
        'latitude' => '37.759773',
        'longitude' => '-122.427063',
    ),
    'product_id' => 'a1111c8c-c720-46c3-8534-2fcdd730040d',
    'trip_branding' => array(
        'link_text' => 'View team roster',
        'partner_deeplink' => 'partner://team/9383',
    )
);
$reminder = $client->setReminder($reminderId, $attributes);
```

[https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder\_id-patch](https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-patch)

### Cancel Reminder

[](#cancel-reminder)

```
$reminderId = '4bfc6c57-98c0-424f-a72e-c1e2a1d49939';
$reminder = $client->cancelReminder($reminderId);
```

[https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder\_id-delete](https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-delete)

### Get Driver Profile

[](#get-driver-profile)

```
$profile = $client->getDriverProfile();
```

### Get Driver Payments

[](#get-driver-payments)

```
$profile = $client->getDriverPayments(array(
    'limit' => 50, // optional
    'offset' => 0 // optional
));
```

### Get Driver Trips

[](#get-driver-trips)

```
$profile = $client->getDriverTrips(array(
    'limit' => 50, // optional
    'offset' => 0 // optional
));
```

### Rate Limiting

[](#rate-limiting)

> This feature is only supported for `v1` version of the API.

Rate limiting is implemented on the basis of a specific client's secret token. By default, 1,000 requests per hour can be made per secret token.

When consuming the service with this package, your rate limit status will be made available within the client.

```
$product = $client->getProduct($productId);

$rateLimit = $client->getRateLimit();

$rateLimit->getLimit();        // Rate limit capacity per period
$rateLimit->getRemaining();    // Requests remaining in current period
$rateLimit->getReset();        // Timestamp in UTC time when the next period will begin
```

These values will update after each request. `getRateLimit` will return null after the client is created and before the first successful request.

### Using the Sandbox

[](#using-the-sandbox)

Modify the status of an ongoing sandbox Request.

> These methods will throw `Stevenmaguire\Uber\Exception` when invoked while the client is not in sandbox mode. The underlying API endpoints have no effect unless you are using the sandbox environment.

```
$request = $client->requestRide(array(
    'product_id' => '4bfc6c57-98c0-424f-a72e-c1e2a1d49939',
    'start_latitude' => '41.85582993',
    'start_longitude' => '-87.62730337',
    'end_latitude' => '41.87499492',
    'end_longitude' => '-87.67126465'
));

$updateRequest = $client->setSandboxRequest($request->request_id, array('status' => 'accepted'));
```

Simulate the possible responses the Request endpoint will return when requesting a particular product, such as surge pricing, against the Sandbox.

```
$product = $client->getProduct($productId);

$updateProduct = $client->setSandboxProduct($productId, array('surge_multiplier' => 2.2, 'drivers_available' => false));
```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Steven Maguire](https://github.com/stevenmaguire)
- [All Contributors](https://github.com/stevenmaguire/uber-php/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4068d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0626c802d00b308c93bc592cfb08bc6f26b0c9bc9cd4015a0c251f58bf7305b8?d=identicon)[ThiagoLovatine](/maintainers/ThiagoLovatine)

---

Top Contributors

[![stevenmaguire](https://avatars.githubusercontent.com/u/1851973?v=4)](https://github.com/stevenmaguire "stevenmaguire (53 commits)")[![megazoll](https://avatars.githubusercontent.com/u/347306?v=4)](https://github.com/megazoll "megazoll (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thiagolovatine-uber-php/health.svg)

```
[![Health](https://phpackages.com/badges/thiagolovatine-uber-php/health.svg)](https://phpackages.com/packages/thiagolovatine-uber-php)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
