2017 © Pedro Peláez
 

library hotel-api

A PHP class to connect and request hotel services from Amadeus Client

image

fidel/hotel-api

A PHP class to connect and request hotel services from Amadeus Client

  • Monday, April 25, 2016
  • by intrepido
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Hotel Api

A PHP module to connect and request hotel services from Amadeus Client, (*1)

Installation

To install this package you will need:, (*2)

  • Laravel 5.2
  • PHP 5.5.9 +

Add to your composer.json file the repository directly:, (*3)

"repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/foresttravel/hotel-api"
        }
 ]

Install via composer running in your terminal the command., (*4)

composer require foresttravel/hotel-api --prefer-source

Once this has finished, you will need to add the service provider to the providers array in your app.php config as follows:, (*5)

HotelAPI\Providers\HotelApiServiceProvider::class, (*6)

Then run in your terminal:, (*7)

php artisan vendor:publish --provider="HotelAPI\Providers\HotelApiServiceProvider", (*8)

Connection

To make succefull connection you need to specify this env variables in you .env file:, (*9)

API_ENDPOINT_AMADEUS='*******'
API_USERNAME_AMADEUS='*******'
API_PASSWORD_AMADEUS='*******'

Authentication

To use the middleware you will have to register them in app/Http/Kernel.php under the $routeMiddleware property:, (*10)

protected $routeMiddleware = [
    ...
    'token-amadeus' => \HotelAPI\Middleware\AuthenticateTokenAmadeus::class
]; 

Then in the app/Http/route.php you can use it like this:, (*11)

$api->group(['middleware' => 'token-amadeus'], function ($api) {
        $api->post('hotel-details', 'API\V1\HotelController@hotelDetails');
        ...
});

When the user make the first request he will be logged in the Amadeus client and he received a token, then the next step would be to make the subsequent requests, with this token., (*12)

To make authenticated requests via http you will need to set an authorization header as follows:, (*13)

Authorization: Bearer {yourtokenhere}

Note to Apache users, (*14)

Apache seems to discard the Authorization header if it is not a base64 encoded user/pass combo. So to fix this you can add the following to your apache config, (*15)

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

Database

This package has some codifiers tables that it need for properly work. You need to specify with database driver you want to use for the migrations. You may specify the driver with this env variable in you .env file:, (*16)

API_CONNECTION_DRIVER='*****'

Then you can make the migration:, (*17)

php artisan migrate 

Updates

To keep updated this package you can use this command:, (*18)

composer update foresttravel/hotel-api

The Versions

25/04 2016

dev-master

9999999-dev

A PHP class to connect and request hotel services from Amadeus Client

  Sources   Download

The Requires

 

by Fidel

24/04 2016

0.1.1

0.1.1.0

A PHP class to connect and request hotel services from Amadeus Client

  Sources   Download

The Requires

 

by Fidel

24/04 2016

0.1.0

0.1.0.0

A PHP class to connect and request hotel services from Amadeus Client

  Sources   Download

The Requires

 

by Fidel

24/04 2016

0.0.6

0.0.6.0

A PHP class to connect and request hotel services from Amadeus Client

  Sources   Download

The Requires

 

by Fidel

24/04 2016

0.0.5

0.0.5.0

A PHP class to connect and request hotel services from Amadeus Client

  Sources   Download

The Requires

 

by Fidel

24/04 2016

0.0.4

0.0.4.0

A PHP class to connect and request hotel services from Amadeus Client

  Sources   Download

The Requires

 

by Fidel

24/04 2016

0.0.3

0.0.3.0

A PHP class to connect and request hotel services from Amadeus Client

  Sources   Download

The Requires

 

by Fidel

22/04 2016

0.0.2

0.0.2.0

A PHP class to connect and request hotel services from Amadeus Client

  Sources   Download

The Requires

 

by Fidel

22/04 2016

0.0.1

0.0.1.0

A PHP class to connect and request hotel services from Amadeus Client

  Sources   Download

The Requires

 

by Fidel