Giter Club home page Giter Club logo

flights-api-project's Introduction

flights-api-project

This is a standalone app based on Yii2 on backend and angularJs on frontend. It uses Travelpayouts api for retrieving flights information and view search results on a domain or subdomain of your site.

Requirements

This app using Travelpayouts flights search API, to access the flights search API you should be registered in our travel affiliate program and submit your request on [email protected] with the following information:

  • URL of your website;
  • Design prototypes of search result;
  • Description of your project;
  • How you will use the search API?
  • Why aren’t the standard methods of integration (search forms, White Label, API access to data) suitable for you.

More information about flights search api

After granting access to Travelpayouts flight search Api you need to get your api token and marker here.

Installation

Download and unzip package or clone it to your web folder git clone https://github.com/travelpayouts/flights-api-project.git

Use composer to install dependencies.

Installing Composer

If you do not already have Composer installed, you may do so by following the instructions at getcomposer.org. On Linux and Mac OS X, you'll run the following commands

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

On Windows, you'll download and run Composer-Setup.exe.

Installing Composer packages

Just use command composer install.

Changing your app parameters

Before first running of your app, you need to set app params. All your params is located in config/params.php

<?php

return [
    // set target language
    'language' => 'en-US',
    // set source language
    'sourceLanguage' => 'en-US',
    'params' => [
        'apiToken' => 'e451ad62a0e8468732b6e1ada1e58223', // Token https://www.travelpayouts.com/programs/100/tools/api
        'apiMarker' => '132474', // Marker https://www.travelpayouts.com/programs/100/tools/api
        'apiResponseLang' => 'en', // Response language : en,ru,de,es,fr,it,pl,th.
        'title' => 'TravelPayouts sample app', // Title of your app
        'baseUrl' => '/flights-api-project', // Path of your app (for example: if your project url is http//site.com/flight set 'baseUrl'=> '/flights', if it in root directory set 'baseUrl'=> ''
    ],
];

Setting webserver

  • Apache HTTP server users have all needed .htaccess files out of box.
  • Nginx HTTP server users should install PHP as an FPM SAPI. You may use the following Nginx configuration, replacing path/to/basic/web with the actual path for basic/web and mysite.local with the actual hostname to serve.
server {
    charset utf-8;
    client_max_body_size 128M;

    listen 80; ## listen for ipv4
    #listen [::]:80 default_server ipv6only=on; ## listen for ipv6

    server_name mysite.local;
    root        /path/to/basic/web;
    index       index.php;

    access_log  /path/to/basic/log/access.log;
    error_log   /path/to/basic/log/error.log;

    location / {
        # Redirect everything that isn't a real file to index.php
        try_files $uri $uri/ /index.php$is_args$args;
    }

    # uncomment to avoid processing of calls to non-existing static files by Yii
    #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
    #    try_files $uri =404;
    #}
    #error_page 404 /404.html;

    # deny accessing php files for the /assets directory
    location ~ ^/assets/.*\.php$ {
        deny all;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass 127.0.0.1:9000;
        #fastcgi_pass unix:/var/run/php5-fpm.sock;
        try_files $uri =404;
    }

    location ~* /\. {
        deny all;
    }
}

When all these things are done

Congratulations, you completed installation and you can perform your first search.

Developing

Dependencies

What you need to make changes to this app:

  • node and npm
  • Ensure you're running Node (v6.x.x+) and NPM (3.x.x+)

Installing packages

Use command npm install to install all package dependencies

Use webpack to make changes to all files that you want to change.

To recompile your frontend files you can use a command: npm run build in root directory of your project or npm run start if you don’t want to manually recompile after every change.

Frontend directory structure

Category Location
Webpack config /webpack.config.js
Angular app entry point /frontend/app.js
Components /frontend/components
Controllers /frontend/controllers
Templates /web/templates
Stylesheets (scss) /frontend/scss

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.