rana-tuhin/hostaway-php-sdk

A fully-featured PHP SDK for the Hostaway API with all available endpoints and resources.

Installs: 21

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 1

Open Issues: 0

pkg:composer/rana-tuhin/hostaway-php-sdk

v1.0.0 2025-11-01 10:40 UTC

This package is auto-updated.

Last update: 2025-11-05 07:22:37 UTC


README

A modern PHP SDK for the Hostaway API, designed to simplify integration with Hostaway’s property management system — including reservations, listings, messages, guests, and more.

🚀 Features

  • Clean, fluent API for all Hostaway endpoints
  • Built-in authentication with API Key
  • Full Laravel support (auto-discovery, facade, and config)
  • Pest-powered testing
  • PSR-4 compliant and publishable config

📦 Installation

Install the package via Composer:

composer require rana-tuhin/hostaway-php-sdk

⚙️ Configuration

After installation, publish the configuration file:

php artisan vendor:publish --tag=hostaway-config

Then, set your credentials in .env:

HOSTAWAY_API_KEY=your-hostaway-api-key
HOSTAWAY_ACCOUNT_ID=your-account-id
HOSTAWAY_BASE_URL=https://api.hostaway.com/v1/

Your config/hostaway.php will look like:

return [
    'api_key' => env('HOSTAWAY_API_KEY'),
    'account_id' => env('HOSTAWAY_ACCOUNT_ID'),
    'base_url' => env('HOSTAWAY_BASE_URL', 'https://api.hostaway.com/v1/'),
];

Example Usage in Laravel

use Hostaway;

$listings = Hostaway::listings()->getAll();

$reservations = Hostaway::reservations()->getAll();

Hostaway::messages()->send([
    'reservationId' => 1001,
    'content' => 'Welcome to our property!',
]);

🧠 Usage (Standalone PHP)

You can use the client independently from Laravel too:

use RanaTuhin\Hostaway\HostawayClient;

$client = new HostawayClient([
    'api_key' => 'your-api-key',
    'account_id' => 'your-account-id',
]);

$listings = $client->listings()->getAll();
$reservation = $client->reservations()->find(12345);

🧱 Available Resources

Resource Methods
listings() getAll(), find($id), update($id), delete($id)
reservations() getAll(), find($id), create($data)
messages() getAll(), send($data)
channels() getAll()
calendar() getAll(), update($data)
guests() getAll(), find($id)
tasks() getAll(), find($id), create($data)
users() getAll(), find($id)

Example:

$listings = $client->listings()->getAll();
$reservation = $client->reservations()->create([]);

📜 License

This package is open-sourced software licensed under the MIT License.