Laravel / PHP
Build a vacation rental backend with Laravel + Repull PHP SDK.
1
Prerequisites
PHP 8.1+ and Composer installed on your machine.
You also need a Repull API key. Get one from your dashboard.
2
Install
composer require repull/sdk
3
Set up environment variables
Add your credentials to a .env file in your project root:
REPULL_API_KEY=sk_live_YOUR_KEY
There is one key type — sk_live_ — created from /dashboard/keys. It acts on whatever channels your workspace has connected.
4
Make your first API call
Set up the SDK with your API key, then call any endpoint. The example below lists properties and fetches reservations.
<?php
// app/Services/RepullService.php
namespace App\Services;
use GuzzleHttp\Client;
use Repull\Api\AvailabilityApi;
use Repull\Api\PropertiesApi;
use Repull\Api\ReservationsApi;
use Repull\Configuration;
use Repull\Model\AvailabilityWriteRequest;
class RepullService
{
private Configuration $config;
private Client $http;
public function __construct()
{
$this->config = Configuration::getDefaultConfiguration()
->setAccessToken(env('REPULL_API_KEY'));
$this->http = new Client();
}
/** How do I list properties in Laravel? */
public function getProperties()
{
return (new PropertiesApi($this->http, $this->config))->listProperties(limit: 50);
}
/** How do I get Airbnb reservations in Laravel? */
public function getAirbnbReservations()
{
return (new ReservationsApi($this->http, $this->config))
->listReservations(platform: 'airbnb', status: 'confirmed');
}
/** How do I update pricing in Laravel? Pushes to every connected channel. */
public function updateAvailability(int $propertyId, array $dates, float $price)
{
return (new AvailabilityApi($this->http, $this->config))->updateAvailability(
$propertyId,
new AvailabilityWriteRequest(['dates' => $dates, 'price' => $price]),
);
}
}
// routes/api.php
Route::get('/properties', function (\App\Services\RepullService $repull) {
return response()->json($repull->getProperties());
});
Route::get('/reservations/airbnb', function (\App\Services\RepullService $repull) {
return response()->json($repull->getAirbnbReservations());
});5
Next steps
You are all set. Explore the rest of the platform:
AI