sonko-dmitry/travelpayouts

Widget and API wrapper for travelpayouts.com

Installs: 171

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

v1.1.4 2020-03-03 10:30 UTC

This package is auto-updated.

Last update: 2024-09-29 05:28:14 UTC


README

Packagist Packagist Packagist Yii

This extension is the way to integrate Travelpayouts.com API and widgets with your Yii2 application.

Installation

The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require sonko-dmitry/travelpayouts:*

or add

"sonko-dmitry/travelpayouts": "*"

to the require section of your composer.json file.

Widgets usage

  1. Add the component in your view file:
use SonkoDmitry\travelpayouts\widgets\SubscriptionWidget;
  1. Now you can use component
<?= SubscriptionWidget::widget([
    'backgroundColor' => '#00b1dd',
    'originIata' => 'PEE',
    'originName' => 'Пермь',
    'destinationIata' => 'MOW',
    'destinationName' => 'Москва',
    'marker' => '12345',
    'powered_by' => true,
]) ?>

Where "12345" marker value is your Travelpayouts partner token.

Usage as component

  1. Add the component configuration in your global main.php config file:
'travelpayouts' => [
    'class' => 'SonkoDmitry\travelpayouts\Travelpayouts',
    'token' => '12345',
    //'useLocalData' => false, //you can change this property globally for all data components, if you want use only remote data for examle
],

Where "12345" marker value is your Travelpayouts partner token.

  1. Now you can use component (list all contries in data)
$countries = Yii::$app->travelpayouts->data->countries;