{"id":51028981,"url":"https://github.com/azhar25git/iboxlab-flagg","last_synced_at":"2026-06-21T22:02:40.475Z","repository":{"id":365936201,"uuid":"1274410208","full_name":"azhar25git/iboxlab-flagg","owner":"azhar25git","description":"Flight Search Aggregator on mock ups - an assignment","archived":false,"fork":false,"pushed_at":"2026-06-19T14:40:15.000Z","size":111,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-19T15:29:06.399Z","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/azhar25git.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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-19T13:36:30.000Z","updated_at":"2026-06-19T14:40:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/azhar25git/iboxlab-flagg","commit_stats":null,"previous_names":["azhar25git/iboxlab-flagg"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/azhar25git/iboxlab-flagg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azhar25git%2Fiboxlab-flagg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azhar25git%2Fiboxlab-flagg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azhar25git%2Fiboxlab-flagg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azhar25git%2Fiboxlab-flagg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azhar25git","download_url":"https://codeload.github.com/azhar25git/iboxlab-flagg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azhar25git%2Fiboxlab-flagg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34627212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-06-21T22:02:39.674Z","updated_at":"2026-06-21T22:02:40.470Z","avatar_url":"https://github.com/azhar25git.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flight Search Aggregator\n\nBackend service that fans out flight searches to multiple providers, normalizes heterogeneous response schemas into a canonical model, deduplicates overlapping offers, and returns a unified result set with completeness metadata.\n\n## Setup\n\n```bash\ncomposer install\ncp .env.example .env\nphp artisan key:generate\nphp artisan migrate\n```\n\nRequirements: PHP ^8.3, Composer, SQLite (or any database — SQLite is zero-config).\n\n## Run\n\n```bash\nphp artisan serve\n```\n\nThe provider dispatcher makes concurrent HTTP calls back to the same host to fetch provider fixtures. The built-in PHP development server is single-threaded by default, so use multiple workers:\n\n```bash\nPHP_CLI_SERVER_WORKERS=4 php -S 127.0.0.1:8000 -t public\n```\n\n## Test\n\n```bash\nphp artisan test --parallel --compact\n```\n\nFormat code:\n\n```bash\nvendor/bin/pint --dirty --format agent\n```\n\nStatic analysis (Larastan level 6):\n\n```bash\nvendor/bin/phpstan analyse --memory-limit=1G\n```\n\n## API\n\n### Search flights\n\n```\nGET /api/flights/search?from=DAC\u0026to=DXB\u0026date=2026-07-01\u0026passengers=2\n```\n\nOptional query params: `sort` (format `field:direction`, e.g. `price:asc`), `filter[max_stops]`, `filter[carriers]` (comma-separated, e.g. `AA,BS`), `filter[max_price]`.\n\n### Create booking\n\n```\nPOST /api/bookings\nContent-Type: application/json\n\n{\n  \"flight_id\": \"\u003cstable-flight-id\u003e\",\n  \"passengers\": [\n    { \"name\": \"John Doe\", \"email\": \"john@example.com\", \"date_of_birth\": \"1990-01-15\" }\n  ]\n}\n```\n\n### Get booking\n\n```\nGET /api/bookings/{reference}\n```\n\n## API Documentation\n\nOpenAPI 3.0 spec: [storage/api-docs/api.yaml](storage/api-docs/api.yaml)\n\nBrowse with Swagger UI:\n\n```\nhttp://localhost:8000/apidocs\n```\n\nOr paste the raw spec URL into [Swagger Editor](https://editor.swagger.io):\n\n```\nhttp://localhost:8000/api/docs/openapi.yaml\n```\n\n## Architecture\n\nSee [ARCHITECTURE.md](ARCHITECTURE.md) for design decisions, trade-offs, and extension points.\n\n## Future Roadmap\n\nPrioritized next steps if this moves beyond the exercise:\n\n### P0 — Provider health and observability\n\n**What:** Add per-request timing, structured logs, retries with backoff, and circuit-breaker logic for each provider. Replace the averaged duration metric with true per-provider latency.\n\n**Why:** Aggregation is only trustworthy when consumers can see exactly which providers responded, how long they took, and whether retries occurred. This is the highest-risk production gap today.\n\n### P1 — Persistent flight-offer storage for bookings\n\n**What:** Move the flight-offer cache from the array cache to Redis or a database table keyed by stable flight ID. Currently the TTL is 60 seconds (intentionally short to avoid stale pricing).\n\n**Why:** Booking currently only works if the offer is still in the same cache store and within the TTL. A booking reference must be resolvable long after the original search, possibly from a different app instance.\n\n### P1 — Real provider integrations\n\n**What:** Swap the internal fixture endpoints for configurable external base URLs, per-provider secrets read from environment variables, request signing, and provider-specific timeout/retry config. Keep `fixtures()` for tests.\n\n**Why:** The current implementation validates the architecture with mocks; production value depends on calling real provider APIs safely.\n\n### P2 — Input validation hardening\n\n**What:** Enforce IATA format on `filter[carriers]`, add a regex for `flight_id` in bookings, and tighten passenger validation (e.g. date-of-birth in the past, name length).\n\n**Why:** Fail fast at the boundary with clear 422 responses instead of letting bad data reach the services or providers.\n\n### P2 — Rate limiting and abuse prevention\n\n**What:** Add request throttling on `/api/flights/search` and `/api/bookings`, plus per-provider call quotas.\n\n**Why:** Both endpoints trigger external calls or side effects; unguarded, they become easy DoS vectors and can burn provider rate limits.\n\n### P2 — Async provider refresh and result caching\n\n**What:** Cache normalized provider results for a short TTL and refresh them in the background; keep a stale-while-revalidate fallback.\n\n**Why:** Reduces average search latency and provider load without returning completely stale data.\n\n### P3 — Multi-currency price normalization\n\n**What:** Integrate an exchange-rate service and normalize all prices to the requested currency.\n\n**Why:** The spec currently assumes USD, but a real aggregator must compare prices across currencies.\n\n### P3 — Pagination and response caching\n\n**What:** Currently the search endpoint returns all unique flights in a single response with no limit, offset, or page controls. Add cursor pagination and cache final result sets.\n\n**Why:** Keeps response sizes bounded (e.g. 10 per page) for busy routes and further reduces provider calls. A route with many providers can produce payloads that are too large or slow to serialize.\n\n### P3 — Booking cancellation\n\n**What:** Add `POST /api/bookings/{reference}/cancel` to transition a booking from `confirmed` to `cancelled`.\n\n**Why:** Required for any real booking workflow. Was intentionally cut from the initial scope to keep the exercise focused on search and creation.\n\n### P3 — Clean up dead enum cases\n\n**What:** Remove or defer unused `BookingStatus` values (`PENDING`, `CANCELLED`) that exist in code but are never used.\n\n**Why:** Dead code is a maintenance liability. Kept during the exercise to avoid rework when cancellation is added back.\n\n### P3 — Explicit timezone handling for fixture timestamps\n\n**What:** Provider fixture times (ISO-8601 without offset, `Y-m-d H:i`) are treated as UTC by convention. Add explicit timezone parsing or document the assumption per provider.\n\n**Why:** All fixture data is for the same route (DAC→DXB), so UTC works. Real provider data may include local timezone offsets, requiring per-adapter shift rules.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazhar25git%2Fiboxlab-flagg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazhar25git%2Fiboxlab-flagg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazhar25git%2Fiboxlab-flagg/lists"}