list airports api
This commit is contained in:
@@ -2,7 +2,19 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use App\Libraries\IotaCodes\Airport;
|
||||
use App\Libraries\IotaCodes\AirportTransformer;
|
||||
use App\Libraries\IotaCodes\Client;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use League\Fractal\Manager;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use League\Fractal\Resource\Collection;
|
||||
use League\Fractal\Resource\Item;
|
||||
use League\Fractal\Resource\ResourceInterface;
|
||||
use League\Fractal\Serializer\JsonApiSerializer;
|
||||
|
||||
//use GuzzleHttp\Psr7\Request;
|
||||
|
||||
class AirportController extends Controller
|
||||
{
|
||||
@@ -15,14 +27,76 @@ class AirportController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch list of airports
|
||||
*
|
||||
* @api {get} /airports
|
||||
* @apiName List Airports
|
||||
*
|
||||
* @apiParam (pagination) {number} [page] page number to display
|
||||
* @apiParam (pagination) {number} [per_page] number of items to display on the page
|
||||
*
|
||||
* @apiParam (autocomplete) {string} [autocomplete] string to try and autocomplete
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function resourceList(Request $request)
|
||||
{
|
||||
//todo
|
||||
$client = Client::create();
|
||||
$per_page = $request->input('per_page', 10);
|
||||
$page = $request->input('page', 1);
|
||||
|
||||
$collection = $client->listAirports($request->input('autocomplete'));
|
||||
$paginator = new LengthAwarePaginator(
|
||||
$collection->forPage($page, $per_page),
|
||||
$collection->count(),
|
||||
$per_page,
|
||||
$page
|
||||
);
|
||||
|
||||
$airports = new Collection($paginator, new AirportTransformer(), 'airports');
|
||||
$airports->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||
|
||||
return $this->JsonApiResponse($airports, 200);
|
||||
}
|
||||
|
||||
public function get(Request $request)
|
||||
|
||||
/**
|
||||
* Get details of an airport by it's code
|
||||
*
|
||||
* @api {get} /airports/:code
|
||||
* @apiName Get Airport from code
|
||||
*
|
||||
* @apiParam {string} code 3 letter airport code
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $code
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getAirport(Request $request, $code)
|
||||
{
|
||||
//
|
||||
$client = Client::create();
|
||||
|
||||
$result = $client->getAirport($code);
|
||||
$result = new Item($result, new AirportTransformer(), 'airports');
|
||||
|
||||
return $this->JsonApiResponse($result, 200);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert the response to Json
|
||||
*
|
||||
* @param \League\Fractal\Resource\Item $resource
|
||||
* @param $statusCode
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function JsonApiResponse(ResourceInterface $resource, $statusCode)
|
||||
{
|
||||
$manager = new Manager();
|
||||
$manager->setSerializer(new JsonApiSerializer('http://docker.dev:8080'));
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray(), $statusCode);
|
||||
}
|
||||
}
|
||||
|
||||
21
app/Libraries/IotaCodes/Airport.php
Normal file
21
app/Libraries/IotaCodes/Airport.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace App\Libraries\IotaCodes;
|
||||
|
||||
class Airport
|
||||
{
|
||||
|
||||
public $name;
|
||||
|
||||
public $code;
|
||||
|
||||
protected function __construct($name, $code)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->code = $code;
|
||||
}
|
||||
|
||||
public static function create($name, $code)
|
||||
{
|
||||
return new self($name, $code);
|
||||
}
|
||||
}
|
||||
19
app/Libraries/IotaCodes/AirportTransformer.php
Normal file
19
app/Libraries/IotaCodes/AirportTransformer.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace App\Libraries\IotaCodes;
|
||||
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class AirportTransformer extends TransformerAbstract
|
||||
{
|
||||
public function transform(Airport $airport)
|
||||
{
|
||||
return [
|
||||
'id' => $airport->code,
|
||||
'name' => $airport->name,
|
||||
'links' => [
|
||||
'rel' => 'self',
|
||||
'uri' => '/airports/'.$airport->code,
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
117
app/Libraries/IotaCodes/Client.php
Normal file
117
app/Libraries/IotaCodes/Client.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
namespace App\Libraries\IotaCodes;
|
||||
|
||||
use GuzzleHttp\Client as Guzzle;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class Client
|
||||
{
|
||||
/**
|
||||
* Guzzle Client
|
||||
* @var Guzzle
|
||||
*/
|
||||
protected $guzzle;
|
||||
|
||||
/**
|
||||
* Client constructor.
|
||||
* @param \GuzzleHttp\Client $guzzle
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct(Guzzle $guzzle, array $config = [])
|
||||
{
|
||||
$this->guzzle = $guzzle;
|
||||
}
|
||||
|
||||
public static function create()
|
||||
{
|
||||
return new self(new Guzzle([
|
||||
'base_uri' => 'https://iatacodes.org',
|
||||
'timeout' => 5.0,
|
||||
'verify' => false
|
||||
]));
|
||||
}
|
||||
|
||||
public function listAirports($autoComplete = '')
|
||||
{
|
||||
$uri = '/api/v6/airports';
|
||||
$key = 'all.airports';
|
||||
$minutes = 60;
|
||||
|
||||
$response = app('cache')->get($key, function () use ($key, $minutes, $uri) {
|
||||
try {
|
||||
/** @var \Psr\Http\Message\ResponseInterface $response */
|
||||
$response = $this->guzzle->get($uri, [
|
||||
'query' => [
|
||||
'lang' => 'en',
|
||||
'api_key' => '8105c628-a86c-41af-85da-828bcf8190e0'
|
||||
],
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
//todo handle error
|
||||
}
|
||||
|
||||
$result = $response->getBody()->getContents();
|
||||
app('cache')->put($key, $result, $minutes);
|
||||
return $result;
|
||||
});
|
||||
|
||||
$result = $this->toAirportCollection($response);
|
||||
if ($autoComplete != '') {
|
||||
$result = $this->autoCompleteMap($result, $autoComplete);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getAirport($code)
|
||||
{
|
||||
$uri = '/api/v6/airports';
|
||||
$cacheKey = 'airport.'.$code;
|
||||
$cacheMinutes = 60;
|
||||
|
||||
$response = app('cache')->get($cacheKey, function () use ($cacheKey, $cacheMinutes, $uri, $code) {
|
||||
try {
|
||||
/** @var \Psr\Http\Message\ResponseInterface $response */
|
||||
$response = $this->guzzle->get($uri, [
|
||||
'query' => [
|
||||
'code' => $code,
|
||||
'lang' => 'en',
|
||||
'api_key' => '8105c628-a86c-41af-85da-828bcf8190e0'
|
||||
],
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
//todo handle error
|
||||
}
|
||||
|
||||
$result = $response->getBody()->getContents();
|
||||
app('cache')->put($cacheKey, $result, $cacheMinutes);
|
||||
return $result;
|
||||
});
|
||||
|
||||
return $result = $this->toAirportCollection($response)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $json string
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
private function toAirportCollection($json)
|
||||
{
|
||||
$data = json_decode($json);
|
||||
$result = (new Collection($data->response))
|
||||
->sortBy('name')
|
||||
->map(function ($item, $key) {
|
||||
return Airport::create($item->name, $item->code);
|
||||
});
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function autoCompleteMap(Collection $collection, $autoComplete)
|
||||
{
|
||||
return $collection->filter(function ($value, $key) use ($autoComplete) {
|
||||
return strpos(strtolower($value->name), strtolower($autoComplete)) !== false;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ $app = new Laravel\Lumen\Application(
|
||||
|
||||
// $app->withFacades();
|
||||
|
||||
// $app->withEloquent();
|
||||
$app->withEloquent();
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -81,6 +81,7 @@ $app->singleton(
|
||||
// $app->register(App\Providers\AppServiceProvider::class);
|
||||
// $app->register(App\Providers\AuthServiceProvider::class);
|
||||
// $app->register(App\Providers\EventServiceProvider::class);
|
||||
$app->register(Illuminate\Redis\RedisServiceProvider::class);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -97,4 +98,17 @@ $app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
|
||||
require __DIR__.'/../routes/web.php';
|
||||
});
|
||||
|
||||
// configure Monolog
|
||||
$app->configureMonologUsing(function($monolog) {
|
||||
/** @var \Monolog\Logger $monolog */
|
||||
|
||||
$minimumLevel = $monolog::NOTICE;
|
||||
if (env('APP_DEBUG', false)) {
|
||||
$minimumLevel = $monolog::DEBUG;
|
||||
}
|
||||
|
||||
$monolog->pushHandler(new Monolog\Handler\ErrorLogHandler());
|
||||
return $monolog;
|
||||
});
|
||||
|
||||
return $app;
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
"vlucas/phpdotenv": "~2.2",
|
||||
"predis/predis": "^1.1",
|
||||
"guzzlehttp/guzzle": "^6.2",
|
||||
"league/fractal": "^0.16.0"
|
||||
"league/fractal": "^0.16.0",
|
||||
"illuminate/redis": "^5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "~1.4",
|
||||
|
||||
222
composer.lock
generated
222
composer.lock
generated
@@ -4,7 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "0f6011855d8a65ac742796d6646cc6c6",
|
||||
"hash": "ac293e9fc1d1422ccd44359d5d1203ff",
|
||||
"content-hash": "fdfbddc774b8c050f0587d9df9418bb8",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/inflector",
|
||||
@@ -71,7 +72,7 @@
|
||||
"singularize",
|
||||
"string"
|
||||
],
|
||||
"time": "2015-11-06T14:35:42+00:00"
|
||||
"time": "2015-11-06 14:35:42"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
@@ -133,7 +134,7 @@
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"time": "2017-02-28T22:50:30+00:00"
|
||||
"time": "2017-02-28 22:50:30"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
@@ -184,7 +185,7 @@
|
||||
"keywords": [
|
||||
"promise"
|
||||
],
|
||||
"time": "2016-12-20T10:07:11+00:00"
|
||||
"time": "2016-12-20 10:07:11"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
@@ -249,7 +250,7 @@
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"time": "2017-03-20T17:10:46+00:00"
|
||||
"time": "2017-03-20 17:10:46"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/auth",
|
||||
@@ -300,7 +301,7 @@
|
||||
],
|
||||
"description": "The Illuminate Auth package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-04-16T13:31:21+00:00"
|
||||
"time": "2017-04-16 13:31:21"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/broadcasting",
|
||||
@@ -349,7 +350,7 @@
|
||||
],
|
||||
"description": "The Illuminate Broadcasting package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-03-15T17:10:29+00:00"
|
||||
"time": "2017-03-15 17:10:29"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/bus",
|
||||
@@ -394,7 +395,7 @@
|
||||
],
|
||||
"description": "The Illuminate Bus package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-01-17T14:21:32+00:00"
|
||||
"time": "2017-01-17 14:21:32"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/cache",
|
||||
@@ -444,7 +445,7 @@
|
||||
],
|
||||
"description": "The Illuminate Cache package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-02-27T20:54:32+00:00"
|
||||
"time": "2017-02-27 20:54:32"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/config",
|
||||
@@ -488,7 +489,7 @@
|
||||
],
|
||||
"description": "The Illuminate Config package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-02-04T20:27:32+00:00"
|
||||
"time": "2017-02-04 20:27:32"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/console",
|
||||
@@ -539,7 +540,7 @@
|
||||
],
|
||||
"description": "The Illuminate Console package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-03-23T15:59:01+00:00"
|
||||
"time": "2017-03-23 15:59:01"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/container",
|
||||
@@ -582,7 +583,7 @@
|
||||
],
|
||||
"description": "The Illuminate Container package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-04-16T13:32:45+00:00"
|
||||
"time": "2017-04-16 13:32:45"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/contracts",
|
||||
@@ -624,7 +625,7 @@
|
||||
],
|
||||
"description": "The Illuminate Contracts package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-03-29T13:17:47+00:00"
|
||||
"time": "2017-03-29 13:17:47"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/database",
|
||||
@@ -684,7 +685,7 @@
|
||||
"orm",
|
||||
"sql"
|
||||
],
|
||||
"time": "2017-04-11T22:53:18+00:00"
|
||||
"time": "2017-04-11 22:53:18"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/encryption",
|
||||
@@ -731,7 +732,7 @@
|
||||
],
|
||||
"description": "The Illuminate Encryption package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2016-12-30T22:45:27+00:00"
|
||||
"time": "2016-12-30 22:45:27"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/events",
|
||||
@@ -776,7 +777,7 @@
|
||||
],
|
||||
"description": "The Illuminate Events package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-04-09T00:57:11+00:00"
|
||||
"time": "2017-04-09 00:57:11"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/filesystem",
|
||||
@@ -826,7 +827,7 @@
|
||||
],
|
||||
"description": "The Illuminate Filesystem package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-04-07T19:38:05+00:00"
|
||||
"time": "2017-04-07 19:38:05"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/hashing",
|
||||
@@ -870,7 +871,7 @@
|
||||
],
|
||||
"description": "The Illuminate Hashing package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-03-08T23:05:14+00:00"
|
||||
"time": "2017-03-08 23:05:14"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/http",
|
||||
@@ -916,7 +917,7 @@
|
||||
],
|
||||
"description": "The Illuminate Http package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-03-15T14:15:59+00:00"
|
||||
"time": "2017-03-15 14:15:59"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/pagination",
|
||||
@@ -960,7 +961,7 @@
|
||||
],
|
||||
"description": "The Illuminate Pagination package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-03-28T13:05:02+00:00"
|
||||
"time": "2017-03-28 13:05:02"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/pipeline",
|
||||
@@ -1004,7 +1005,7 @@
|
||||
],
|
||||
"description": "The Illuminate Pipeline package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-01-17T14:21:32+00:00"
|
||||
"time": "2017-01-17 14:21:32"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/queue",
|
||||
@@ -1059,7 +1060,52 @@
|
||||
],
|
||||
"description": "The Illuminate Queue package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-04-12T19:11:35+00:00"
|
||||
"time": "2017-04-12 19:11:35"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/redis",
|
||||
"version": "v5.4.19",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/redis.git",
|
||||
"reference": "28ece0b065b4b864a3ba66cc360f4c25911fc115"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/redis/zipball/28ece0b065b4b864a3ba66cc360f4c25911fc115",
|
||||
"reference": "28ece0b065b4b864a3ba66cc360f4c25911fc115",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "5.4.*",
|
||||
"illuminate/support": "5.4.*",
|
||||
"php": ">=5.6.4",
|
||||
"predis/predis": "~1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Redis\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
}
|
||||
],
|
||||
"description": "The Illuminate Redis package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-04-04 22:41:06"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/session",
|
||||
@@ -1110,7 +1156,7 @@
|
||||
],
|
||||
"description": "The Illuminate Session package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-03-30T14:26:45+00:00"
|
||||
"time": "2017-03-30 14:26:45"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/support",
|
||||
@@ -1167,7 +1213,7 @@
|
||||
],
|
||||
"description": "The Illuminate Support package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-04-09T14:34:57+00:00"
|
||||
"time": "2017-04-09 14:34:57"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/translation",
|
||||
@@ -1212,7 +1258,7 @@
|
||||
],
|
||||
"description": "The Illuminate Translation package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-04-07T13:49:47+00:00"
|
||||
"time": "2017-04-07 13:49:47"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/validation",
|
||||
@@ -1262,7 +1308,7 @@
|
||||
],
|
||||
"description": "The Illuminate Validation package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-04-05T14:24:42+00:00"
|
||||
"time": "2017-04-05 14:24:42"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/view",
|
||||
@@ -1310,7 +1356,7 @@
|
||||
],
|
||||
"description": "The Illuminate View package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2017-04-09T14:27:27+00:00"
|
||||
"time": "2017-04-09 14:27:27"
|
||||
},
|
||||
{
|
||||
"name": "laravel/lumen-framework",
|
||||
@@ -1394,7 +1440,7 @@
|
||||
"laravel",
|
||||
"lumen"
|
||||
],
|
||||
"time": "2017-04-03T21:20:22+00:00"
|
||||
"time": "2017-04-03 21:20:22"
|
||||
},
|
||||
{
|
||||
"name": "league/fractal",
|
||||
@@ -1458,7 +1504,7 @@
|
||||
"league",
|
||||
"rest"
|
||||
],
|
||||
"time": "2017-03-12T01:28:43+00:00"
|
||||
"time": "2017-03-12 01:28:43"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
@@ -1536,7 +1582,7 @@
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2017-03-13T07:08:03+00:00"
|
||||
"time": "2017-03-13 07:08:03"
|
||||
},
|
||||
{
|
||||
"name": "mtdowling/cron-expression",
|
||||
@@ -1580,7 +1626,7 @@
|
||||
"cron",
|
||||
"schedule"
|
||||
],
|
||||
"time": "2017-01-23T04:29:33+00:00"
|
||||
"time": "2017-01-23 04:29:33"
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
@@ -1633,7 +1679,7 @@
|
||||
"datetime",
|
||||
"time"
|
||||
],
|
||||
"time": "2017-01-16T07:55:07+00:00"
|
||||
"time": "2017-01-16 07:55:07"
|
||||
},
|
||||
{
|
||||
"name": "nikic/fast-route",
|
||||
@@ -1676,7 +1722,7 @@
|
||||
"router",
|
||||
"routing"
|
||||
],
|
||||
"time": "2017-01-19T11:35:12+00:00"
|
||||
"time": "2017-01-19 11:35:12"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
@@ -1724,7 +1770,7 @@
|
||||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"time": "2017-03-13T16:27:32+00:00"
|
||||
"time": "2017-03-13 16:27:32"
|
||||
},
|
||||
{
|
||||
"name": "predis/predis",
|
||||
@@ -1774,7 +1820,7 @@
|
||||
"predis",
|
||||
"redis"
|
||||
],
|
||||
"time": "2016-06-16T16:22:20+00:00"
|
||||
"time": "2016-06-16 16:22:20"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
@@ -1824,7 +1870,7 @@
|
||||
"request",
|
||||
"response"
|
||||
],
|
||||
"time": "2016-08-06T14:39:51+00:00"
|
||||
"time": "2016-08-06 14:39:51"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
@@ -1871,7 +1917,7 @@
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-10-10T12:19:37+00:00"
|
||||
"time": "2016-10-10 12:19:37"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
@@ -1934,7 +1980,7 @@
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-04-26T01:39:17+00:00"
|
||||
"time": "2017-04-26 01:39:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
@@ -1991,7 +2037,7 @@
|
||||
],
|
||||
"description": "Symfony Debug Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-04-19T20:17:50+00:00"
|
||||
"time": "2017-04-19 20:17:50"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
@@ -2051,7 +2097,7 @@
|
||||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-05-01T14:58:48+00:00"
|
||||
"time": "2017-05-01 14:58:48"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
@@ -2100,7 +2146,7 @@
|
||||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-04-12T14:13:17+00:00"
|
||||
"time": "2017-04-12 14:13:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
@@ -2153,7 +2199,7 @@
|
||||
],
|
||||
"description": "Symfony HttpFoundation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-05-01T14:55:58+00:00"
|
||||
"time": "2017-05-01 14:55:58"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-kernel",
|
||||
@@ -2235,7 +2281,7 @@
|
||||
],
|
||||
"description": "Symfony HttpKernel Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-05-01T17:46:48+00:00"
|
||||
"time": "2017-05-01 17:46:48"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
@@ -2294,7 +2340,7 @@
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2016-11-14T01:06:16+00:00"
|
||||
"time": "2016-11-14 01:06:16"
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
@@ -2343,7 +2389,7 @@
|
||||
],
|
||||
"description": "Symfony Process Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-04-12T14:13:17+00:00"
|
||||
"time": "2017-04-12 14:13:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
@@ -2407,7 +2453,7 @@
|
||||
],
|
||||
"description": "Symfony Translation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-04-12T14:13:17+00:00"
|
||||
"time": "2017-04-12 14:13:17"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
@@ -2457,7 +2503,7 @@
|
||||
"env",
|
||||
"environment"
|
||||
],
|
||||
"time": "2016-09-01T10:05:43+00:00"
|
||||
"time": "2016-09-01 10:05:43"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
@@ -2518,7 +2564,7 @@
|
||||
"gherkin",
|
||||
"parser"
|
||||
],
|
||||
"time": "2016-10-30T11:50:56+00:00"
|
||||
"time": "2016-10-30 11:50:56"
|
||||
},
|
||||
{
|
||||
"name": "codeception/codeception",
|
||||
@@ -2612,7 +2658,7 @@
|
||||
"functional testing",
|
||||
"unit testing"
|
||||
],
|
||||
"time": "2017-05-11T21:07:05+00:00"
|
||||
"time": "2017-05-11 21:07:05"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/instantiator",
|
||||
@@ -2666,7 +2712,7 @@
|
||||
"constructor",
|
||||
"instantiate"
|
||||
],
|
||||
"time": "2015-06-14T21:17:01+00:00"
|
||||
"time": "2015-06-14 21:17:01"
|
||||
},
|
||||
{
|
||||
"name": "facebook/webdriver",
|
||||
@@ -2718,7 +2764,7 @@
|
||||
"selenium",
|
||||
"webdriver"
|
||||
],
|
||||
"time": "2017-04-28T14:54:49+00:00"
|
||||
"time": "2017-04-28 14:54:49"
|
||||
},
|
||||
{
|
||||
"name": "fzaninotto/faker",
|
||||
@@ -2766,7 +2812,7 @@
|
||||
"faker",
|
||||
"fixtures"
|
||||
],
|
||||
"time": "2016-04-29T12:21:54+00:00"
|
||||
"time": "2016-04-29 12:21:54"
|
||||
},
|
||||
{
|
||||
"name": "hamcrest/hamcrest-php",
|
||||
@@ -2811,7 +2857,7 @@
|
||||
"keywords": [
|
||||
"test"
|
||||
],
|
||||
"time": "2015-05-11T14:41:42+00:00"
|
||||
"time": "2015-05-11 14:41:42"
|
||||
},
|
||||
{
|
||||
"name": "mockery/mockery",
|
||||
@@ -2876,7 +2922,7 @@
|
||||
"test double",
|
||||
"testing"
|
||||
],
|
||||
"time": "2017-02-28T12:52:32+00:00"
|
||||
"time": "2017-02-28 12:52:32"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
@@ -2918,7 +2964,7 @@
|
||||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"time": "2017-04-12T18:52:22+00:00"
|
||||
"time": "2017-04-12 18:52:22"
|
||||
},
|
||||
{
|
||||
"name": "pdepend/pdepend",
|
||||
@@ -2958,7 +3004,7 @@
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "Official version of pdepend to be handled with Composer",
|
||||
"time": "2017-01-19T14:23:36+00:00"
|
||||
"time": "2017-01-19 14:23:36"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-common",
|
||||
@@ -3012,7 +3058,7 @@
|
||||
"reflection",
|
||||
"static analysis"
|
||||
],
|
||||
"time": "2015-12-27T11:43:31+00:00"
|
||||
"time": "2015-12-27 11:43:31"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-docblock",
|
||||
@@ -3057,7 +3103,7 @@
|
||||
}
|
||||
],
|
||||
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
||||
"time": "2016-09-30T07:12:33+00:00"
|
||||
"time": "2016-09-30 07:12:33"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/type-resolver",
|
||||
@@ -3104,7 +3150,7 @@
|
||||
"email": "me@mikevanriel.com"
|
||||
}
|
||||
],
|
||||
"time": "2016-11-25T06:54:22+00:00"
|
||||
"time": "2016-11-25 06:54:22"
|
||||
},
|
||||
{
|
||||
"name": "phpmd/phpmd",
|
||||
@@ -3170,7 +3216,7 @@
|
||||
"phpmd",
|
||||
"pmd"
|
||||
],
|
||||
"time": "2017-01-20T14:41:10+00:00"
|
||||
"time": "2017-01-20 14:41:10"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
@@ -3233,7 +3279,7 @@
|
||||
"spy",
|
||||
"stub"
|
||||
],
|
||||
"time": "2017-03-02T20:05:34+00:00"
|
||||
"time": "2017-03-02 20:05:34"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
@@ -3296,7 +3342,7 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2017-04-02T07:44:40+00:00"
|
||||
"time": "2017-04-02 07:44:40"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
@@ -3343,7 +3389,7 @@
|
||||
"filesystem",
|
||||
"iterator"
|
||||
],
|
||||
"time": "2016-10-03T07:40:28+00:00"
|
||||
"time": "2016-10-03 07:40:28"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-text-template",
|
||||
@@ -3384,7 +3430,7 @@
|
||||
"keywords": [
|
||||
"template"
|
||||
],
|
||||
"time": "2015-06-21T13:50:34+00:00"
|
||||
"time": "2015-06-21 13:50:34"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-timer",
|
||||
@@ -3433,7 +3479,7 @@
|
||||
"keywords": [
|
||||
"timer"
|
||||
],
|
||||
"time": "2017-02-26T11:10:40+00:00"
|
||||
"time": "2017-02-26 11:10:40"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-token-stream",
|
||||
@@ -3482,7 +3528,7 @@
|
||||
"keywords": [
|
||||
"tokenizer"
|
||||
],
|
||||
"time": "2017-02-27T10:12:30+00:00"
|
||||
"time": "2017-02-27 10:12:30"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
@@ -3564,7 +3610,7 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2017-04-03T02:22:27+00:00"
|
||||
"time": "2017-04-03 02:22:27"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
@@ -3623,7 +3669,7 @@
|
||||
"mock",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2016-12-08T20:27:08+00:00"
|
||||
"time": "2016-12-08 20:27:08"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/code-unit-reverse-lookup",
|
||||
@@ -3668,7 +3714,7 @@
|
||||
],
|
||||
"description": "Looks up which function or method a line of code belongs to",
|
||||
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
|
||||
"time": "2017-03-04T06:30:41+00:00"
|
||||
"time": "2017-03-04 06:30:41"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/comparator",
|
||||
@@ -3732,7 +3778,7 @@
|
||||
"compare",
|
||||
"equality"
|
||||
],
|
||||
"time": "2017-01-29T09:50:25+00:00"
|
||||
"time": "2017-01-29 09:50:25"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
@@ -3784,7 +3830,7 @@
|
||||
"keywords": [
|
||||
"diff"
|
||||
],
|
||||
"time": "2015-12-08T07:14:41+00:00"
|
||||
"time": "2015-12-08 07:14:41"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
@@ -3834,7 +3880,7 @@
|
||||
"environment",
|
||||
"hhvm"
|
||||
],
|
||||
"time": "2016-11-26T07:53:53+00:00"
|
||||
"time": "2016-11-26 07:53:53"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
@@ -3901,7 +3947,7 @@
|
||||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"time": "2016-11-19T08:54:04+00:00"
|
||||
"time": "2016-11-19 08:54:04"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
@@ -3952,7 +3998,7 @@
|
||||
"keywords": [
|
||||
"global state"
|
||||
],
|
||||
"time": "2015-10-12T03:26:01+00:00"
|
||||
"time": "2015-10-12 03:26:01"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/object-enumerator",
|
||||
@@ -3998,7 +4044,7 @@
|
||||
],
|
||||
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
|
||||
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
|
||||
"time": "2017-02-18T15:18:39+00:00"
|
||||
"time": "2017-02-18 15:18:39"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/recursion-context",
|
||||
@@ -4051,7 +4097,7 @@
|
||||
],
|
||||
"description": "Provides functionality to recursively process PHP variables",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
||||
"time": "2016-11-19T07:33:16+00:00"
|
||||
"time": "2016-11-19 07:33:16"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/resource-operations",
|
||||
@@ -4093,7 +4139,7 @@
|
||||
],
|
||||
"description": "Provides a list of PHP built-in functions that operate on resources",
|
||||
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
|
||||
"time": "2015-07-28T20:34:47+00:00"
|
||||
"time": "2015-07-28 20:34:47"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/version",
|
||||
@@ -4136,7 +4182,7 @@
|
||||
],
|
||||
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
||||
"homepage": "https://github.com/sebastianbergmann/version",
|
||||
"time": "2016-10-03T07:35:21+00:00"
|
||||
"time": "2016-10-03 07:35:21"
|
||||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
@@ -4187,7 +4233,7 @@
|
||||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"time": "2017-05-04T00:33:04+00:00"
|
||||
"time": "2017-05-04 00:33:04"
|
||||
},
|
||||
{
|
||||
"name": "stecman/symfony-console-completion",
|
||||
@@ -4232,7 +4278,7 @@
|
||||
}
|
||||
],
|
||||
"description": "Automatic BASH completion for Symfony Console Component based applications.",
|
||||
"time": "2016-02-24T05:08:54+00:00"
|
||||
"time": "2016-02-24 05:08:54"
|
||||
},
|
||||
{
|
||||
"name": "symfony/browser-kit",
|
||||
@@ -4289,7 +4335,7 @@
|
||||
],
|
||||
"description": "Symfony BrowserKit Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-04-12T14:13:17+00:00"
|
||||
"time": "2017-04-12 14:13:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/config",
|
||||
@@ -4345,7 +4391,7 @@
|
||||
],
|
||||
"description": "Symfony Config Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-04-12T14:13:17+00:00"
|
||||
"time": "2017-04-12 14:13:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
@@ -4398,7 +4444,7 @@
|
||||
],
|
||||
"description": "Symfony CssSelector Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-05-01T14:55:58+00:00"
|
||||
"time": "2017-05-01 14:55:58"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dependency-injection",
|
||||
@@ -4461,7 +4507,7 @@
|
||||
],
|
||||
"description": "Symfony DependencyInjection Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-04-26T01:39:17+00:00"
|
||||
"time": "2017-04-26 01:39:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
@@ -4517,7 +4563,7 @@
|
||||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-04-12T14:13:17+00:00"
|
||||
"time": "2017-04-12 14:13:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
@@ -4566,7 +4612,7 @@
|
||||
],
|
||||
"description": "Symfony Filesystem Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-04-12T14:13:17+00:00"
|
||||
"time": "2017-04-12 14:13:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
@@ -4621,7 +4667,7 @@
|
||||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-05-01T14:55:58+00:00"
|
||||
"time": "2017-05-01 14:55:58"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
@@ -4671,7 +4717,7 @@
|
||||
"check",
|
||||
"validate"
|
||||
],
|
||||
"time": "2016-11-23T20:04:58+00:00"
|
||||
"time": "2016-11-23 20:04:58"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
||||
@@ -5,7 +5,7 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./docker/Dockerfile
|
||||
image: oauth:latest
|
||||
image: tripbuilder:latest
|
||||
ports:
|
||||
- "9024:22"
|
||||
volumes:
|
||||
@@ -19,7 +19,7 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./docker/Dockerfile-nginx
|
||||
image: oauth:nginx
|
||||
image: tripbuilder:nginx
|
||||
ports:
|
||||
- "8080:80"
|
||||
- "9025:22"
|
||||
@@ -44,3 +44,11 @@ services:
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
composer:
|
||||
image: composer/composer:alpine
|
||||
volumes:
|
||||
- .:/app
|
||||
- ~/.ssh:/root/.ssh
|
||||
entrypoint:
|
||||
- composer
|
||||
- install
|
||||
|
||||
@@ -15,11 +15,17 @@ COPY ./docker/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ENTRYPOINT /docker-entrypoint.sh
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl nano sed libwww-perl htop \
|
||||
curl nano sed libwww-perl htop ca-certificates \
|
||||
php7.0 php-cli php-fpm php-curl php-pear php-mcrypt php-zip php-mbstring php-xml \
|
||||
php-pgsql php-redis \
|
||||
php-xdebug \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
||||
&& echo "xdebug.remote_enable=on" >> /etc/php/7.0/mods-available/xdebug.ini \
|
||||
&& echo "xdebug.remote_autostart=on" >> /etc/php/7.0/mods-available/xdebug.ini \
|
||||
&& echo "xdebug.remote_port = 9001" >> /etc/php/7.0/mods-available/xdebug.ini \
|
||||
&& echo "xdebug.max_nesting_level=300" >> /etc/php/7.0/mods-available/xdebug.ini \
|
||||
&& echo "xdebug.remote_connect_back=1" >> /etc/php/7.0/mods-available/xdebug.ini
|
||||
|
||||
COPY ./ /var/www/
|
||||
COPY ./docker/docker-php-fpm.conf /etc/php/7.0/fpm/pool.d/www.conf
|
||||
|
||||
|
||||
@@ -14,3 +14,6 @@
|
||||
$app->get('/', function () use ($app) {
|
||||
return $app->version();
|
||||
});
|
||||
|
||||
$app->get('/airports', 'AirportController@resourceList');
|
||||
$app->get('/airports/{code}', 'AirportController@getAirport');
|
||||
|
||||
Reference in New Issue
Block a user