承接 mahan-shoghy/laravel-doordash 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mahan-shoghy/laravel-doordash

最新稳定版本:1.41

Composer 安装命令:

composer require mahan-shoghy/laravel-doordash

包简介

Doordash implementation for Laravel

README 文档

README

Laravel Doordash API Package simplifies integration with the Doordash API for food delivery services in Laravel applications.

For now, only the Drive (Delivery) functionality is released.

Feel free to add more features!

Doordash API Documentation

Table of Contents

Installation

Via composer (Laravel 10+):

composer require mahan-shoghy/laravel-doordash

Optional: If you want to publish the config file, use the following command:

php artisan vendor:publish --provider="MahanShoghy\LaravelDoordash\DoordashServiceProvider" --tag="config"

Usage

Setup environment

Add and set these variables to your environment file:

DOORDASH_DEVELOPER_ID=
DOORDASH_KEY_ID=
DOORDASH_SIGNING_SECRET=

You can create credentials and get values from the Doordash Developer Portal

Delivery

Use delivery facade:

use MahanShoghy\LaravelDoordash\App\Drive\Facades\Delivery;

Create Quote - Documentation

Delivery::createQuote(array $data);

Accept Quote - Documentation

Delivery::acceptQuote(string $external_delivery_id, int $tip);

Create Delivery - Documentation

Delivery::create(array $data);

Get Delivery - Documentation

Delivery::get(string $external_delivery_id);

Update Delivery - Documentation

Delivery::update(string $external_delivery_id, array $data);

Cancel Delivery - Documentation

Delivery::cancel(string $external_delivery_id);

Webhook

Webhooks allow your Laravel application to receive and handle Doordash events in real-time. Follow these steps to set up webhook handling in your application.

  1. Publish the Configuration File: If you haven't already, publish the configuration file using the following command:
     php artisan vendor:publish --provider="MahanShoghy\LaravelDoordash\DoordashServiceProvider" --tag="config"
    
  2. Generate webhook authorization token: Add the following variable to your environment file:

     DOORDASH_WEBHOOK_AUTH_TOKEN=
    

    Run the following command to generate token:

     php artisan doordash:generate-webhook-token
    

    The generated token will be set in your environment file. Use this token in the Authorization header when creating the webhook endpoint on Developer Portal.

  3. Define a Webhook Route: In your Laravel routes file (like: web.php), add a route for handling webhooks. You can choose any URL you prefer. By default, the HTTP method is set to POST, but you can change it if needed:

     Route::doordashWebhooks('your-webhook-url'); // Default method is POST
     // OR
     Route::doordashWebhooks('your-webhook-url', 'get'); // Change HTTP method to GET
    
  4. Configure Webhook Events: Open the doordash.php configuration file (which you published in step 1) and specify the events you want to handle and the corresponding job classes. Here's an example:

     'jobs' => [
         'DASHER_CONFIRMED' => DasherConfirmedJob::class,
     ]
    

    In the job class, you can access the payload data sent by Doordash to handle the event.

     class DasherConfirmedJob implements ShouldQueue
     {
         public Payload $payload;
        
         public function __construct(Payload $payload)
         {
             $this->payload = $payload;
         }
        
         public function handle(): void
         {
             // Handle the webhook event using $this->payload
         }
     }
    
  5. Event Documentation: You can find a list of available Doordash webhook events in the Doordash documentation. This resource will help you understand and configure the events you wish to handle.

  6. Use Laravel Queues: For better performance and scalability, consider using Laravel queues to handle webhook jobs asynchronously. This ensures that your application remains responsive even during heavy webhook traffic.

Now, your Laravel application is ready to receive and process Doordash webhook events in real-time.

Support

If you have any questions or need assistance, feel free to contact us. if there are specific code examples you'd like to include in the README to help users get started quickly, you can add those as well.

Donate

If you find this package helpful and would like to support its development, you can make a donation in cryptocurrency. Your contributions will help maintain and improve this package.

You can send your contribution to the following address in your MetaMask wallet:
Wallet Address:

0x4B3d57AC72B57a76b778Bac4e3b32d2d4d729955

Thank you for your support!

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固