https://github.com/benmacha/ubereat-php
A modern PHP SDK for the UberEats API, supporting PHP 7.4 and above.
https://github.com/benmacha/ubereat-php
php sdk sdk-php symfony uber ubereats
Last synced: 19 days ago
JSON representation
A modern PHP SDK for the UberEats API, supporting PHP 7.4 and above.
- Host: GitHub
- URL: https://github.com/benmacha/ubereat-php
- Owner: BenMacha
- License: other
- Created: 2025-02-02T20:03:32.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-02-28T20:19:04.000Z (3 months ago)
- Last Synced: 2025-03-25T21:36:44.931Z (about 2 months ago)
- Topics: php, sdk, sdk-php, symfony, uber, ubereats
- Language: PHP
- Homepage: https://packagist.org/packages/ubereats/php-sdk
- Size: 56.6 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# UberEats PHP SDK
[](https://packagist.org/packages/ubereats/php-sdk)
[](https://packagist.org/packages/ubereats/php-sdk)
[](LICENSE)
[](https://github.com/BenMacha/ubereat-php/actions/workflows/ci.yml)
[](composer.json)
[](https://github.com/BenMacha/ubereat-php/actions)
[](https://codecov.io/gh/BenMacha/ubereat-php)
[](https://github.com/phpstan/phpstan)
[](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer)
A modern PHP SDK for the UberEats API, supporting PHP 7.4 and above.
## Features
- ๐ Modern PHP 7.4+ with strict typing
- ๐ Type-safe request/response objects
- ๐งช Comprehensive test coverage
- ๐ Detailed documentation
- ๐ Webhook support
- ๐ ๏ธ PSR-3 logging support
- ๐ฏ PSR-12 coding standards
- ๐ Static analysis with PHPStan level max## Requirements
- PHP 7.4 or higher
- Composer
- Guzzle HTTP Client
- PSR-3 Logger (optional)## Documentation
- [Getting Started](docs/getting-started.md)
- [Working with Orders](docs/orders.md)
- [Working with Stores](docs/stores.md)
- [Working with Deliveries](docs/deliveries.md)
- [Integration Features](docs/integration.md)## Installation
```bash
composer require ubereats/php-sdk
```## Basic Usage
```php
use UberEats\Client\UberEatsClient;// Create client instance
$client = new UberEatsClient();// Authenticate
$token = $client->authenticate(
clientId: 'your-client-id',
clientSecret: 'your-client-secret'
);// Get order details
$order = $client->getOrder('order-id');// Get store details
$store = $client->getStore('store-id');
```## Available Methods
### Authentication
- `authenticate(string $clientId, string $clientSecret): AccessToken`### Orders
- `getOrder(string $orderId): Order`
- `acceptOrder(string $orderId, AcceptOrderRequest $request): Order`
- `denyOrder(string $orderId, DenyOrderRequest $request): Order`
- `cancelOrder(string $orderId, CancelOrderRequest $request): Order`### Stores
- `getStore(string $storeId): Store`
- `getStores(): StoreCollection`## Webhook Handling
```php
use UberEats\Webhook\WebhookHandler;$handler = new WebhookHandler();
$event = $handler->handle($payload);switch ($event->type) {
case 'orders.notification':
handleOrderNotification($event);
break;
case 'orders.scheduled.notification':
handleScheduledOrder($event);
break;
case 'delivery.state_changed':
handleDeliveryStateChange($event);
break;
default:
throw new \InvalidArgumentException('Unknown event type');
}
```## Error Handling
The SDK throws `UberEatsException` for any API errors. Each exception includes:
- HTTP status code
- Error message
- Original response data```php
try {
$order = $client->getOrder('invalid-id');
} catch (UberEatsException $e) {
echo $e->getMessage();
echo $e->getCode();
}
```## Development
### Testing
```bash
composer test
```### Static Analysis
```bash
composer phpstan
```### Code Style
```bash
composer cs-fix
```### Code Coverage
```bash
composer test-coverage
```## Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Contributing
1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request## Changelog
Please see [CHANGELOG.md](CHANGELOG.md) for more information on what has changed recently.
## Credits
- [BEN MECHA Ali](https://github.com/benmacha)
- [All Contributors](../../contributors)## License
This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.