Git Product home page Git Product logo

apaleo-client's Introduction

ApaleoClient

Simple PHP Library for interacting with the Apaleo Open Hospitality Cloud (www.apaleo.com)

Built by Loopon for use in our own Guest Communication Suite (www.loopon.com) which is fully integrated with the Apaleo Open Hospitality Cloud, as well as to serve as a PHP example of how to integrate with Apaleo.

Getting Started

This code has been written for and tested in PHP 7.1. It will not work on anything earlier than PHP 7 due to the usage of strict typing.

To do anything meaningful with this code, you first need to obtain credentials from Apaleo. Check https://apaleo.com/getting-started-with-apaleo-apis/ for details.

Prerequisites

In order to use this example client, you need to install composer. See https://getcomposer.org/doc/00-intro.md

Creating a completely new project using the ApaleoClient

Once you have composer installed, create an empty new project and create a composer.json file with the following contents:

{
    "name": "LooponAB/apaleo-client-test",
    "type": "project",
    "authors": [
        {
            "name": "Simon Finne",
            "email": "[email protected]"
        }
    ],
    "repositories": [
        {
            "name": "loopon/apaleo-client",
            "type": "git",
            "url": "https://github.com/LooponAB/apaleo-client.git"
        }
    ],
    "require": {
        "loopon/apaleo-client": "v1.x-dev"
    }
}

Then install the dependencies with the following command:

$ composer install

Now create a new file ExampleClient.php with the following contents:

<?php
require(__DIR__ . '/vendor/autoload.php');

$lApaleoClient = new Loopon\Apaleo\Client\Client('<URL OF YOUR APPLICATION>', '<USERNAME>', '<PASSWORD>');
$lInventory = $lApaleoClient->getInventoryApi()->getProperties();
print_r($lInventory);

Finally update the parameters to the Client constructor to match the credentials you have received from Apaleo.

Testing the client

Simply run the code:

$ php ExampleClient.php

If you have setup your credentials correctly, the example will simply print the available inventory for your user. In case you only see an error message or stack trace, you most likely have provided incorrect credentials.

Using the library in your own project

In order to include the php library in your project, simply add the following entries to your composer.json file:

Repositories entry:

    "repositories": [
        {
            "name": "loopon/apaleo-client",
            "type": "git",
            "url": "https://github.com/LooponAB/apaleo-client.git"
        }
    ],

Requirements entry:

    "require": {
        "loopon/apaleo-client": "v1.x-dev"
    }

Built With

Authors

  • Simon Finne - Initial implementation - simonfi

License

This project is licensed under the 3-Clause BSD License - see the LICENSE file for details

Contributing

Currently the Client is extremely limited and mostly serves as an example how to connect to Apaleo. Our intention is to keep updating it as Apaleo's API and our (www.loopon.com) usage of it evolves, but pull requests for new features are greatly appreciated.

Acknowledgments

  • Thank you to Andrea Stubbe at Apaleo for all the help while building Loopon's integration to the Apaleo Open Hospitality Cloud

apaleo-client's People

Contributors

simonfi avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

looponab

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.