PHPackages                             misujon/laravel-duffel - 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. [API Development](/categories/api)
4. /
5. misujon/laravel-duffel

ActiveLibrary[API Development](/categories/api)

misujon/laravel-duffel
======================

A fully featured Laravel package for integrating with Duffel’s Flight and Hotel Booking APIs. Provides an elegant, service-oriented structure for searching flights, creating orders, managing offers, and booking hotels using Duffel's modern travel APIs — all with built-in error handling, logging, and support for Laravel’s HTTP client and service container.

051PHP

Since May 31Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/misujon/laravel-duffel)[ Packagist](https://packagist.org/packages/misujon/laravel-duffel)[ RSS](/packages/misujon-laravel-duffel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Duffel API Package
==========================

[](#laravel-duffel-api-package)

A Laravel-ready package to integrate Duffel's Flights, Seat Maps, Airlines, Airports, Aircraft, and Cities APIs with clean service-based methods.

---

🚀 Installation
--------------

[](#-installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require misujon/laravel-duffel
```

### 2. Publish Configuration

[](#2-publish-configuration)

```
php artisan vendor:publish --provider="Misujon\\LaravelDuffel\\LaravelDuffelServiceProvider" --tag="config"
```

### 3. Set Environment Variables

[](#3-set-environment-variables)

In your Laravel app's `.env` file:

```
DUFFEL_API_KEY=your_duffel_access_token_here
DUFFEL_API_URL=https://api.duffel.com/
DUFFEL_API_VERSION=v2
DUFFEL_URL_PREFIX="air"
```

### 4. (Optional) Add Facade Aliases

[](#4-optional-add-facade-aliases)

In `config/app.php` under aliases:

```
'Duffel' => Misujon\LaravelDuffel\Facades\Duffel::class,
```

---

✈️ FlightService Methods
------------------------

[](#️-flightservice-methods)

### 1. searchFlights(array $searchData)

[](#1-searchflightsarray-searchdata)

**Description:** Search available flights.

**Parameters Example:**

```
[
    'slices' => [
        ['origin' => 'DXB', 'destination' => 'LHR', 'departure_date' => '2025-07-15'],
    ],
    'passengers' => [
        ['type' => 'adult'],
        ['type' => 'child', 'age' => 8],
    ],
    'cabin_class' => 'economy',
]
```

**Usage:**

```
$response = Duffel::searchFlights($searchData);
```

### 2. getFlightOffer(string $offerId)

[](#2-getflightofferstring-offerid)

**Description:** Fetch a specific flight offer.

**Usage:**

```
$response = Duffel::getFlightOffer('off_0000AtXxW8gsgU0dRswvHG');
```

### 3. fetchSeatMaps(string $offerId)

[](#3-fetchseatmapsstring-offerid)

**Description:** Fetch seat maps for a flight offer.

**Usage:**

```
$response = Duffel::fetchSeatMaps('off_0000AtXxW8gsgU0dRswvHG');
```

**Returns `` if no seat maps found.**

---

🌍 ResourceService Methods
-------------------------

[](#-resourceservice-methods)

### Class for Resource Service

[](#class-for-resource-service)

Use all the methods by importing the class

```
Misujon\LaravelDuffel\Facades\DuffelResource;

```

### 1. getAirlines()

[](#1-getairlines)

Fetch list of airlines.

```
$response = DuffelResource::getAirlines();
```

### 2. getSingleAirline(string $airlineId)

[](#2-getsingleairlinestring-airlineid)

Fetch a specific airline by ID.

```
$response = DuffelResource::getSingleAirline('arl_0000A3BCD');
```

### 3. getAircrafts()

[](#3-getaircrafts)

Fetch list of aircrafts.

```
$response = DuffelResource::getAircrafts();
```

### 4. getSingleAircraft(string $aircraftId)

[](#4-getsingleaircraftstring-aircraftid)

Fetch a specific aircraft.

```
$response = DuffelResource::getSingleAircraft('arc_0000Abc123');
```

### 5. getAirports()

[](#5-getairports)

Fetch list of airports.

```
$response = DuffelResource::getAirports();
```

### 6. getSingleAirport(string $airportId)

[](#6-getsingleairportstring-airportid)

Fetch a specific airport.

```
$response = DuffelResource::getSingleAirport('apt_0000AbcXYZ');
```

### 7. getCities()

[](#7-getcities)

Fetch list of cities.

```
$response = DuffelResource::getCities();
```

### 8. getSingleCity(string $cityId)

[](#8-getsinglecitystring-cityid)

Fetch a specific city.

```
$response = DuffelResource::getSingleCity('cit_0000Abcd987');
```

---

📆 OrderService Methods
----------------------

[](#-orderservice-methods)

### Class for Resource Service

[](#class-for-resource-service-1)

Use all the methods by importing the class

```
Misujon\LaravelDuffel\Facades\OrderService;

```

### 1. listOrders()

[](#1-listorders)

Get a list of all created orders.

```
Duffel::listOrders();
```

### 2. createOrder(array $data)

[](#2-createorderarray-data)

Create a new flight order.

```
Duffel::createOrder([
    'selected_offers' => ['off_xxxx'],
    'payments' => [[
        'type' => 'balance',
        'amount' => '100.00',
        'currency' => 'USD'
    ]],
    'passengers' => [
        ['id' => 'pas_xxxx']
    ]
]);
```

### 3. listOrderServices(string $orderId)

[](#3-listorderservicesstring-orderid)

List available services for a given order.

```
Duffel::listOrderServices('ord_xxxx');
```

### 4. getOrder(string $orderId)

[](#4-getorderstring-orderid)

Get the details of a specific order.

```
Duffel::getOrder('ord_xxxx');
```

### 5. updateOrder(string $orderId, array $data)

[](#5-updateorderstring-orderid-array-data)

Update metadata for a specific order.

```
Duffel::updateOrder('ord_xxxx', [
    'metadata' => [
        'purpose' => 'client booking'
    ]
]);
```

### 6. addServiceToOrder(string $orderId, array $data)

[](#6-addservicetoorderstring-orderid-array-data)

Add a service (e.g. bag or seat) to an order.

```
Duffel::addServiceToOrder('ord_xxxx', [
    'services' => [
        ['id' => 'ase_xxxx']
    ]
]);
```

---

👉 Example Usage
---------------

[](#-example-usage)

```
use Duffel;

class FlightController extends Controller
{
    public function search()
    {
        $searchData = [...];
        return Duffel::searchFlights($searchData);
    }

    public function airline($id)
    {
        return Duffel::getSingleAirline($id);
    }

    public function createOrder()
    {
        return Duffel::createOrder([...]);
    }
}
```

---

📜 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](https://chatgpt.com/c/LICENSE).

---

💬 Contributing
--------------

[](#-contributing)

Pull requests, issues, and feature suggestions are welcome! Let's build together!

☕ Support Me
============

[](#-support-me)

Hi there! 👋 I'm a passionate Full Stack Web Developer with over 5 years of experience crafting powerful, efficient, and creative web solutions. From building robust APIs with **PHP/Laravel** and **Python/Django**, to designing dynamic frontend applications with **React**, **Vue**, and **Next.js**, I thrive on solving complex problems and delivering top-quality results.

I specialize in data scraping, API integrations, responsive UI/UX, and full-cycle project management using Agile methodologies. Every project I work on is built with care, innovation, and a strong commitment to excellence. If you enjoy my work, find it useful, or simply want to support an independent developer on their journey — feel free to **buy me a coffee!**

Your support truly means a lot and helps me keep doing what I love every day. 🚀

**Thank you for being awesome! 🙌**

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/70a8edfafa7218d0b311b4daeb692a162c7176572a10a511f532523b4d988161?d=identicon)[misujon](/maintainers/misujon)

---

Top Contributors

[![misujon](https://avatars.githubusercontent.com/u/17620556?v=4)](https://github.com/misujon "misujon (14 commits)")

---

Tags

duffelduffel-apiflight-apiflight-bookinghotel-apihotel-booking

### Embed Badge

![Health badge](/badges/misujon-laravel-duffel/health.svg)

```
[![Health](https://phpackages.com/badges/misujon-laravel-duffel/health.svg)](https://phpackages.com/packages/misujon-laravel-duffel)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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