{"id":36989471,"url":"https://github.com/sharpapi/laravel-airports-database-flight-duration-calculator","last_synced_at":"2026-02-21T12:02:37.239Z","repository":{"id":331649411,"uuid":"1131197441","full_name":"sharpapi/laravel-airports-database-flight-duration-calculator","owner":"sharpapi","description":"Laravel package for SharpAPI.com - laravel-airports-database-flight-duration-calculator","archived":false,"fork":false,"pushed_at":"2026-01-10T15:14:03.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-11T04:30:45.895Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sharpapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-09T16:11:58.000Z","updated_at":"2026-01-10T15:14:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sharpapi/laravel-airports-database-flight-duration-calculator","commit_stats":null,"previous_names":["sharpapi/laravel-airports-database-flight-duration-calculator"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sharpapi/laravel-airports-database-flight-duration-calculator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Flaravel-airports-database-flight-duration-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Flaravel-airports-database-flight-duration-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Flaravel-airports-database-flight-duration-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Flaravel-airports-database-flight-duration-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharpapi","download_url":"https://codeload.github.com/sharpapi/laravel-airports-database-flight-duration-calculator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpapi%2Flaravel-airports-database-flight-duration-calculator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-13T23:30:07.476Z","updated_at":"2026-01-13T23:30:08.052Z","avatar_url":"https://github.com/sharpapi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![SharpAPI GitHub cover](https://sharpapi.com/sharpapi-github-laravel-bg.jpg \"SharpAPI Laravel Client\")\n\n# Airports Database \u0026 Flight Duration Calculator for Laravel\n\n## 🚀 Access comprehensive airport data and calculate flight durations with this Laravel package.\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/sharpapi/laravel-airports-database-flight-duration-calculator.svg?style=flat-square)](https://packagist.org/packages/sharpapi/laravel-airports-database-flight-duration-calculator)\n[![Total Downloads](https://img.shields.io/packagist/dt/sharpapi/laravel-airports-database-flight-duration-calculator.svg?style=flat-square)](https://packagist.org/packages/sharpapi/laravel-airports-database-flight-duration-calculator)\n\nCheck the details at SharpAPI's [Airports Database \u0026 Flight Duration Calculator](https://sharpapi.com/en/catalog/utility/airports-database-flight-duration-calculator) page.\n\n---\n\n## Requirements\n\n- PHP \u003e= 8.1\n- Laravel \u003e= 9.0\n\n---\n\n## Installation\n\nFollow these steps to install and set up the SharpAPI Laravel Airports Database \u0026 Flight Duration Calculator package.\n\n1. Install the package via `composer`:\n\n```bash\ncomposer require sharpapi/laravel-airports-database-flight-duration-calculator\n```\n\n2. Register at [SharpAPI.com](https://sharpapi.com/) to obtain your API key.\n\n3. Set the API key in your `.env` file:\n\n```bash\nSHARP_API_KEY=your_api_key_here\n```\n\n4. **[OPTIONAL]** Publish the configuration file:\n\n```bash\nphp artisan vendor:publish --tag=sharpapi-airports-database-flight-duration-calculator\n```\n\n---\n## Key Features\n\n- **Airport Search**: Search for airports by name, IATA code, ICAO code, or city.\n- **Airport Details**: Get detailed information about airports by IATA or ICAO code.\n- **Flight Duration Calculation**: Calculate flight duration between two airports.\n- **Country-based Airport Listing**: Get a list of airports in a specific country.\n\n---\n\n## Usage\n\nYou can inject the `AirportsDatabaseFlightDurationCalculatorService` class to access the functionality.\n\n### Basic Workflow\n\n1. **Search for Airports**: Use `searchAirports` to find airports by name, code, or city.\n2. **Get Airport Details**: Use `getAirportByIataCode` or `getAirportByIcaoCode` to get detailed information about a specific airport.\n3. **Calculate Flight Duration**: Use `calculateFlightDuration` to calculate the flight duration between two airports.\n4. **List Airports by Country**: Use `getAirportsByCountry` to get a list of airports in a specific country.\n\n---\n\n### Controller Example\n\nHere is an example of how to use `AirportsDatabaseFlightDurationCalculatorService` within a Laravel controller:\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse GuzzleHttp\\Exception\\GuzzleException;\nuse SharpAPI\\AirportsDatabaseFlightDurationCalculator\\AirportsDatabaseFlightDurationCalculatorService;\n\nclass AirportsController extends Controller\n{\n    protected AirportsDatabaseFlightDurationCalculatorService $airportsService;\n\n    public function __construct(AirportsDatabaseFlightDurationCalculatorService $airportsService)\n    {\n        $this-\u003eairportsService = $airportsService;\n    }\n\n    /**\n     * @throws GuzzleException\n     */\n    public function searchAirports(string $query)\n    {\n        $results = $this-\u003eairportsService-\u003esearchAirports($query);\n        \n        return response()-\u003ejson($results);\n    }\n\n    /**\n     * @throws GuzzleException\n     */\n    public function getAirportDetails(string $iataCode)\n    {\n        $airport = $this-\u003eairportsService-\u003egetAirportByIataCode($iataCode);\n        \n        return response()-\u003ejson($airport);\n    }\n\n    /**\n     * @throws GuzzleException\n     */\n    public function calculateFlightDuration(string $fromIataCode, string $toIataCode)\n    {\n        $duration = $this-\u003eairportsService-\u003ecalculateFlightDuration($fromIataCode, $toIataCode);\n        \n        return response()-\u003ejson($duration);\n    }\n\n    /**\n     * @throws GuzzleException\n     */\n    public function getAirportsByCountry(string $countryCode)\n    {\n        $airports = $this-\u003eairportsService-\u003egetAirportsByCountry($countryCode);\n        \n        return response()-\u003ejson($airports);\n    }\n}\n```\n\n### Handling Guzzle Exceptions\n\nAll requests are managed by Guzzle, so it's helpful to be familiar with [Guzzle Exceptions](https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions).\n\nExample:\n\n```php\nuse GuzzleHttp\\Exception\\ClientException;\n\ntry {\n    $airports = $this-\u003eairportsService-\u003esearchAirports('London');\n} catch (ClientException $e) {\n    echo $e-\u003egetMessage();\n}\n```\n\n---\n\n## Optional Configuration\n\nYou can customize the configuration by setting the following environment variables in your `.env` file:\n\n```bash\nSHARP_API_KEY=your_api_key_here\nSHARP_API_BASE_URL=https://sharpapi.com/api/v1\n```\n\n---\n\n## Airport Data Format Example\n\n```json\n{\n  \"data\": [\n    {\n      \"id\": \"1ef266de-5a6c-67d6-86a1-06bb2780ed98\",\n      \"icao\": \"00AA\",\n      \"iata\": \"\",\n      \"lid\": \"00AA\",\n      \"name\": \"Aero B Ranch Airport\",\n      \"city\": \"Leoti\",\n      \"subdivision\": \"Kansas\",\n      \"country\": \"US\",\n      \"timezone\": \"America/Chicago\",\n      \"elevation\": 3435,\n      \"latitude\": 38.7,\n      \"longitude\": -101.47\n    }\n  ],\n  \"links\": {\n    \"first\": \"https://sharpapi.com/api/v1/airports?page=1\",\n    \"last\": \"https://sharpapi.com/api/v1/airports?page=1128\",\n    \"prev\": null,\n    \"next\": \"https://sharpapi.com/api/v1/airports?page=2\"\n  },\n  \"meta\": {\n    \"current_page\": 1,\n    \"from\": 1,\n    \"last_page\": 1128,\n    \"per_page\": 25,\n    \"to\": 25,\n    \"total\": 28186\n  }\n}\n```\n\n---\n\n## Support \u0026 Feedback\n\nFor issues or suggestions, please:\n\n- [Open an issue on GitHub](https://github.com/sharpapi/laravel-airports-database-flight-duration-calculator/issues)\n- Join our [Telegram community](https://t.me/sharpapi_community)\n\n---\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for a detailed list of changes.\n\n---\n\n## Credits\n\n- [A2Z WEB LTD](https://github.com/a2zwebltd)\n- [Dawid Makowski](https://github.com/makowskid)\n- Enhance your [Laravel AI](https://sharpapi.com/) capabilities!\n\n---\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n---\n\n## Follow Us\n\nStay updated with news, tutorials, and case studies:\n\n- [SharpAPI on X (Twitter)](https://x.com/SharpAPI)\n- [SharpAPI on YouTube](https://www.youtube.com/@SharpAPI)\n- [SharpAPI on Vimeo](https://vimeo.com/SharpAPI)\n- [SharpAPI on LinkedIn](https://www.linkedin.com/products/a2z-web-ltd-sharpapicom-automate-with-aipowered-api/)\n- [SharpAPI on Facebook](https://www.facebook.com/profile.php?id=61554115896974)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharpapi%2Flaravel-airports-database-flight-duration-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharpapi%2Flaravel-airports-database-flight-duration-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharpapi%2Flaravel-airports-database-flight-duration-calculator/lists"}