Skip to content

plumvillage/planyo-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Planyo PHP library

A PHP library for interacting with the API of the reservation system Planyo. It abstracts some of the "RESTlessness" of the API away and exposes it in a PHP friendly way.

Installation

You can install the package via composer:

composer config repositories.plumillage/planyo-php vcs https://github.com/plumvillage/planyo-php
composer require plumvillage/planyo-php:dev-main

Usage

use PV\Planyo\PlanyoClient;

$planyo = new PlanyoClient('your-api-key');

// Get a reservation
$reservation = $planyo->reservations->retreive(50000123);

// Register a refund
$reservation->refund(500, 'py_1HqIC9Llrb75DEF1234wxyz6', 'Refund for cancellation.');

Configuration

The client accepts the following configuration options:

  • apiKey: Your Planyo API key
  • baseUrl: (Optional) Custom API base URL, if you want to use the sandbox.

Available Methods

The library doesn't aim to be exhaustive. Methods will be added as needed.

  • reservations.retreive(int $id)
    • Reservation.hasCustomProduct($name, $price):
    • Reservation.addCustomProduct(string $name, float $price, bool $recalculate = false):
    • Reservation.addPayment(float $amount, int $status, string $transactionId, string $statusText): Register a payment made for a reservation
    • Reservation.refund(float $amount, string $transactionId, string $statusText): Register a refund payment for a reservation

Development

Requirements

  • PHP 7.4 or higher
  • Composer

Install

composer install

Run tests

composer test

References

Housekeeping

License

The MIT License (MIT). Please see License File for more information.

About

PHP library for the Planyo API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages