PHPackages                             gungcahyadipp/channex-open-channel - 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. gungcahyadipp/channex-open-channel

ActiveLibrary[API Development](/categories/api)

gungcahyadipp/channex-open-channel
==================================

PHP package for Channex Open Channel API integration. Supports standalone PHP 8.2+ and Laravel.

v1.0.1(4mo ago)24MITPHPPHP ^8.2

Since Jan 12Pushed 4mo agoCompare

[ Source](https://github.com/gungcahyadipp/channex-open-channel)[ Packagist](https://packagist.org/packages/gungcahyadipp/channex-open-channel)[ RSS](/packages/gungcahyadipp-channex-open-channel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

Channex Open Channel PHP Package
================================

[](#channex-open-channel-php-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a88bf65b40e2aa9191d12cbf517cc57023533ab83d3b7d89f6332d3334a0a62f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67756e676361687961646970702f6368616e6e65782d6f70656e2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gungcahyadipp/channex-open-channel)[![Total Downloads](https://camo.githubusercontent.com/16459b1d5abf9e68f60c3dc8bb194a8e30b4e3671ad75f65f712ffc6a732ee4e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67756e676361687961646970702f6368616e6e65782d6f70656e2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gungcahyadipp/channex-open-channel)[![License](https://camo.githubusercontent.com/eb33167b3753322727b2361ec01342481a560978889eca8e389c604cdaa60185/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f67756e676361687961646970702f6368616e6e65782d6f70656e2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gungcahyadipp/channex-open-channel)

PHP package untuk integrasi dengan [Channex Open Channel API](https://channex.io). Package ini mendukung penggunaan standalone (plain PHP 8.2+) maupun dengan Laravel framework.

Requirements
------------

[](#requirements)

- PHP 8.2 atau lebih tinggi
- Guzzle HTTP Client 7.0+

Installation
------------

[](#installation)

```
composer require gungcahyadipp/channex-open-channel
```

Quick Start (Laravel)
---------------------

[](#quick-start-laravel)

```
# 1. Publish semua file (config, controller, handlers, routes)
php artisan vendor:publish --tag=channex

# 2. Tambahkan ke routes/api.php
# require __DIR__ . '/channex.php';

# 3. Set environment variables di .env
```

**Environment Variables:**

```
CHANNEX_API_KEY=open_channel_api_key
CHANNEX_INBOUND_API_KEY=your-inbound-api-key
CHANNEX_PROVIDER_CODE=OpenChannel
CHANNEX_ENVIRONMENT=staging
```

**Endpoints yang tersedia setelah publish:**

MethodEndpointGET`/api/channex/test_connection/`GET`/api/channex/mapping_details/`GET|POST`/api/channex/changes/`---

Laravel Setup (Detail)
----------------------

[](#laravel-setup-detail)

### Publish Options

[](#publish-options)

```
# Publish semua sekaligus
php artisan vendor:publish --tag=channex

# Atau publish terpisah:
php artisan vendor:publish --tag=channex-config      # config/channex.php
php artisan vendor:publish --tag=channex-controller  # ChannexController.php
php artisan vendor:publish --tag=channex-handlers    # Handler classes
php artisan vendor:publish --tag=channex-routes      # routes/channex.php
```

### Konfigurasi

[](#konfigurasi)

**File: `config/channex.php`**

Config KeyDescriptionDefault`api_key`API key untuk mengirim request ke Channex`open_channel_api_key``inbound_api_key`API key untuk validasi request dari Channex`null``provider_code`Provider code unik dari Channex`OpenChannel``environment``staging` atau `production``staging``endpoints.api`Custom API endpoint (opsional)`null``endpoints.secure`Custom secure endpoint (opsional)`null`### Default Endpoints

[](#default-endpoints)

EnvironmentAPI EndpointSecure Endpointstaging`https://staging.channex.io/api/v1``https://secure-staging.channex.io/api/v1`production`https://app.channex.io/api/v1``https://secure.channex.io/api/v1`---

Usage
-----

[](#usage)

### Push Booking (Laravel)

[](#push-booking-laravel)

```
use GungCahyadiPP\ChannexOpenChannel\Laravel\Facades\Channex;
use GungCahyadiPP\ChannexOpenChannel\DTOs\Booking;
use GungCahyadiPP\ChannexOpenChannel\DTOs\Customer;
use GungCahyadiPP\ChannexOpenChannel\DTOs\Room;
use GungCahyadiPP\ChannexOpenChannel\DTOs\Occupancy;
use GungCahyadiPP\ChannexOpenChannel\DTOs\RoomDay;

$booking = new Booking(
    status: Booking::STATUS_NEW,
    hotelCode: 'HOTEL123',
    arrivalDate: '2024-05-09',
    departureDate: '2024-05-10',
    currency: 'USD',
    customer: new Customer(surname: 'Doe', name: 'John'),
    rooms: [
        new Room(
            roomTypeCode: 'ROOM001',
            occupancy: new Occupancy(adults: 2),
            days: [
                new RoomDay(date: '2024-05-09', price: '100.00', ratePlanCode: 'RATE001')
            ]
        )
    ]
);

// Push ke Channex
$response = Channex::pushBooking($booking);

// Request full sync
Channex::requestFullSync('HOTEL123');
```

### Push Booking (Standalone PHP)

[](#push-booking-standalone-php)

```
use GungCahyadiPP\ChannexOpenChannel\ChannexConfig;
use GungCahyadiPP\ChannexOpenChannel\ChannexClient;

$config = new ChannexConfig(
    apiKey: 'your-api-key',
    providerCode: 'YOUR_PROVIDER_CODE',
    environment: 'staging'
);

$client = new ChannexClient($config);
$response = $client->pushBooking($booking);
```

---

Implementing Channex Endpoints
------------------------------

[](#implementing-channex-endpoints)

Setelah publish, edit handler classes di `app/Handlers/Channex/`:

### 1. TestConnectionHandler

[](#1-testconnectionhandler)

**File:** `app/Handlers/Channex/TestConnectionHandler.php`

```
protected function validateHotelCode(string $hotelCode): bool
{
    // Cek apakah hotel_code valid di sistem Anda
    return Property::where('channex_code', $hotelCode)->exists();
}
```

### 2. MappingDetailsHandler

[](#2-mappingdetailshandler)

**File:** `app/Handlers/Channex/MappingDetailsHandler.php`

```
protected function getRoomTypes(string $hotelCode): array
{
    $property = Property::where('channex_code', $hotelCode)->first();

    return $property->roomTypes->map(function ($room) {
        $roomType = new RoomType(id: (string) $room->id, title: $room->name);

        foreach ($room->ratePlans as $rate) {
            $roomType->addRatePlan(new RatePlan(
                id: (string) $rate->id,
                title: $rate->name,
                sellMode: RatePlan::SELL_MODE_PER_ROOM,
                maxPersons: $room->max_occupancy,
                currency: 'USD',
                readOnly: false
            ));
        }

        return $roomType;
    })->toArray();
}
```

### 3. ChangesHandler

[](#3-changeshandler)

**File:** `app/Handlers/Channex/ChangesHandler.php`

```
protected function processAvailabilityChanges(string $hotelCode, array $changes): void
{
    foreach ($changes as $change) {
        Availability::updateOrCreate(
            ['room_type_id' => $change->roomTypeId, 'date' => $change->dateFrom],
            ['available' => $change->availability]
        );
    }
}

protected function processRestrictionChanges(string $hotelCode, array $changes): void
{
    foreach ($changes as $change) {
        $rate = $change->getRateForOccupancy();

        Restriction::updateOrCreate(
            ['rate_plan_id' => $change->ratePlanId, 'date' => $change->dateFrom],
            [
                'rate' => $rate?->getAmount(),
                'stop_sell' => $change->stopSell,
                'min_stay_arrival' => $change->minStayArrival,
            ]
        );
    }
}
```

---

DTOs Reference
--------------

[](#dtos-reference)

### Booking DTOs

[](#booking-dtos)

ClassDescription`Booking`Main booking object`Customer`Customer information`Company`Customer company info`Room`Booking room`RoomDay`Daily room pricing`Occupancy`Room occupancy (adults, children, infants)`Guest`Guest information`Guarantee`Credit card details (virtual card support)`Service`Extra services/fees`Deposit`Payment deposits### Mapping DTOs

[](#mapping-dtos)

ClassDescription`RoomType`Room type for mapping`RatePlan`Rate plan for mapping### Changes DTOs

[](#changes-dtos)

ClassDescription`AvailabilityChange`Availability update from Channex`RestrictionChange`Rate/restriction update from Channex`Rate`Rate information---

Booking Status Constants
------------------------

[](#booking-status-constants)

```
use GungCahyadiPP\ChannexOpenChannel\DTOs\Booking;

Booking::STATUS_NEW       // new
Booking::STATUS_MODIFIED  // modified
Booking::STATUS_CANCELLED // cancelled

Booking::PAYMENT_COLLECT  // collect
Booking::PAYMENT_PREPAID  // prepaid
```

---

Testing
-------

[](#testing)

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

License
-------

[](#license)

MIT License

Links
-----

[](#links)

- [Packagist](https://packagist.org/packages/gungcahyadipp/channex-open-channel)
- [GitHub](https://github.com/gungcahyadipp/channex-open-channel)
- [Channex API Documentation](https://docs.channex.io)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance78

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

121d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cbda56e103385dea9039efb6de5c23089bfb8a024dd76985e42a5ecf5fcecef0?d=identicon)[gungcahyadipp](/maintainers/gungcahyadipp)

---

Top Contributors

[![gungcahyadipp](https://avatars.githubusercontent.com/u/30739832?v=4)](https://github.com/gungcahyadipp "gungcahyadipp (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gungcahyadipp-channex-open-channel/health.svg)

```
[![Health](https://phpackages.com/badges/gungcahyadipp-channex-open-channel/health.svg)](https://phpackages.com/packages/gungcahyadipp-channex-open-channel)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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