itsmeabde/tiket-api

Laravel package for using api tiket.com

1.0.1 2016-08-30 07:07 UTC

This package is auto-updated.

Last update: 2024-04-16 01:00:55 UTC


README

Stories in Ready

Laravel Tiket Api's

Latest Version on Packagist Software License Total Downloads

This package provides you to use tiket.com api with simple usage and it will let you focus on development of the api's user interface. See the DOCS for documentation

Install

Via composer

$ composer require itsmeabde/tiket-api

Once this has finish, you will need to add the service provider to the providers array in your app.php config as follows:

itsmeabde/TiketApi/TiketApiServiceProvider::class

Finally, you will want to publish the config using the following command:

$ php artisan vendor:publish

Usage

Before usage, you mush configure api_key, user_agent, response in tiket.php config file. by default 'response' => 'json' , do not change any uri if there is no available updated.

This package by default store token api in cookie with key token. do not forget to configure your EncryptCookies.php in App\Http\Middleware folder.

protected $except = [
    'token'
];

Example request search flight:

use Illuminate\Http\Request;
use itsmeabde\TiketApi\TiketApi;

class FlightController extends Controller
{
    public function searchFlight(Request $request)
    {
        $query = $request->all();
        $tiket = new TiketApi();
        $response = $tiket->flightApi->searchFlight($query);
        
        return $response;
    }
}

Or you want create your own controller extends baseController

use Illuminate\Routing\Controller as BaseController;
use itsmeabde\TiketApi\TiketApi;

class BaseTiketController extends BaseController
{
    public $tiket;
    public function __construct()
    {
        $this->tiket = new TiketApi();
    }
}

So you can call tiket object from class inheritance your own Controller without declare new object tiketApi for many times.

use Illuminate\Http\Request;

class FlightController extends BaseTiketController
{
    public function searchFlight(Request $request)
    {
        $query = $request->all();
        
        return $this->tiket->flightApi->searchFlight($query);
    }
}

For more information, See DOCS.

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Bug

If you discover any bug related issues, please email itsmeabde@gmail.com instead of using the issue tracker.

License

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