santosdave / jambojet-laravel
Comprehensive Laravel package for JamboJet's NSK API integration
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/santosdave/jambojet-laravel
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
- illuminate/http: ^9.0|^10.0|^11.0
- illuminate/support: ^9.0|^10.0|^11.0
- laravel/framework: ^10.0|^11.0
- monolog/monolog: ^3.8
Requires (Dev)
- orchestra/testbench: ^7.0|^8.0|^9.0
- phpunit/phpunit: ^9.0|^10.0
README
A comprehensive PHP wrapper for the JamboJet NSK (New Skies) API - providing complete airline booking and operations functionality.
π Overview
The JamboJet NSK API Wrapper is a production-ready PHP SDK that provides a complete interface to JamboJet's airline systems. Built with enterprise-grade architecture, comprehensive validation, and extensive error handling.
Key Features
- βοΈ Complete Booking Operations - Search, book, modify, cancel flights
- π₯ Passenger Management - Full lifecycle passenger operations with SSRs
- π³ Payment Processing - Credit cards, fraud prevention, installments, refunds
- π« Ticketing & Documents - E-tickets, boarding passes, receipts, invoices
- πΊ Ancillary Services - Seat selection, baggage, meals, special services
- π’ Organization Management - Multi-organization support (v1 & v2)
- π Manifest Operations - Flight manifests, weight & balance, load sheets
- ποΈ Voucher Management - Create, apply, track vouchers
- π Trip Planning - Multi-city trips, fare rules, availability
- βοΈ Configuration - Resources, settings, station management
- π Authentication - Token management, user sessions
- π‘οΈ Enterprise Ready - Validation, error handling, logging
π Requirements
- PHP 8.0 or higher
- Composer
- cURL extension
- JSON extension
- OpenSSL extension
- Valid JamboJet NSK API credentials
π¦ Installation
Install via Composer:
composer require santosdave/jambojet-laravel
βοΈ Configuration
Create a configuration file or set environment variables:
<?php // config/jambojet.php return [ 'base_url' => env('JAMBOJET_BASE_URL', 'https://api.jambojet.com/'), 'subscription_key' => env('JAMBOJET_SUBSCRIPTION_KEY'), 'timeout' => env('JAMBOJET_TIMEOUT', 30), 'retry_attempts' => env('JAMBOJET_RETRY_ATTEMPTS', 3), 'environment' => env('JAMBOJET_ENVIRONMENT', 'test'), 'logging' => [ 'enabled' => env('JAMBOJET_LOG_ENABLED', true), 'channel' => env('JAMBOJET_LOG_CHANNEL', 'stack'), 'level' => env('JAMBOJET_LOG_LEVEL', 'info'), ], ];
Environment Variables
JAMBOJET_BASE_URL=https://jmtest.booking.jambojet.com/jm/dotrez/ JAMBOJET_SUBSCRIPTION_KEY=your-subscription-key-here JAMBOJET_TIMEOUT=30 JAMBOJET_RETRY_ATTEMPTS=3 JAMBOJET_ENVIRONMENT=test
π Quick Start
Initialize the Client
<?php require 'vendor/autoload.php'; use SantosDave\JamboJet\JamboJetClient; $client = new JamboJetClient([ 'base_url' => 'https://api.jambojet.com/', 'subscription_key' => 'your-key-here' ]);
Basic Flight Search & Booking
<?php // 1. Search for flights $searchCriteria = [ 'origin' => 'NBO', 'destination' => 'MBA', 'departureDate' => '2024-12-15', 'adult' => 1 ]; $availability = $client->booking()->getAvailability($searchCriteria); // 2. Select flight and get sell key $sellKey = $availability['data']['trips'][0]['journeysAvailable'][0]['journeys'][0]['sellKey']; // 3. Create booking $bookingRequest = [ 'sellKeys' => [$sellKey], 'passengers' => [ [ 'name' => [ 'first' => 'John', 'last' => 'Doe' ], 'passengerTypeCode' => 'ADT', 'gender' => 'Male' ] ], 'contact' => [ 'emails' => ['john.doe@example.com'], 'phoneNumbers' => ['+254700000000'] ] ]; $booking = $client->booking()->createBooking($bookingRequest); $recordLocator = $booking['data']['recordLocator']; // 4. Process payment $paymentData = [ 'paymentMethodType' => 'ExternalAccount', 'paymentMethodCode' => 'MC', 'accountNumber' => '5123456789012346', 'expiration' => '2025-12', 'accountHolderName' => 'John Doe', 'paymentFields' => [ ['fieldName' => 'VerificationCode', 'fieldValue' => '123'] ] ]; $payment = $client->payment()->addPaymentToBooking($recordLocator, $paymentData); // 5. Retrieve booking confirmation $confirmation = $client->booking()->getBooking($recordLocator); echo "Booking successful! PNR: " . $recordLocator;
π Documentation
Service Documentation
Comprehensive guides for each service module:
- Authentication Service - Token management, user sessions
- Booking Service - Flight search, booking creation, modifications
- Booking Passengers Service - Passenger operations, SSRs, documents
- Payment Service - Payment processing, refunds, installments
- User Service - User registration, authentication, profiles
- Trip Service - Trip planning, multi-city bookings
- Resources Service - Airports, countries, currencies
- Organizations Service v1 - Organization management
- Organizations Service v2 - Enhanced organization features
- Manifest Service - Flight manifests, load sheets
- Voucher Service - Voucher creation and management
- Settings Service - Configuration and settings
- Messages Service - Message queue operations
Complete Workflows
Step-by-step implementation guides:
- Basic Booking Flow - Search β Book β Pay β Ticket
- Advanced Booking Flow - With ancillaries, modifications, groups
Additional Resources
- Error Handling Guide - Exception handling and troubleshooting
- Validation Reference - Input validation rules
- Testing Guide - Unit and integration testing
- API Reference - Complete endpoint documentation
π― Core Services Overview
Booking Operations
// Search flights $availability = $client->booking()->getAvailability($criteria); // Create booking $booking = $client->booking()->createBooking($request); // Modify booking $modified = $client->booking()->updateBooking($recordLocator, $changes); // Cancel booking $cancelled = $client->booking()->cancelBooking($recordLocator); // Retrieve booking $details = $client->booking()->getBooking($recordLocator);
Passenger Management
// Add passenger $passenger = $client->bookingPassengers()->addPassenger($recordLocator, $passengerData); // Add SSR (Special Service Request) $ssr = $client->bookingPassengers()->addSSR($recordLocator, $ssrData); // Update passenger information $updated = $client->bookingPassengers()->updatePassenger($recordLocator, $passengerId, $updates); // Add travel documents $document = $client->bookingPassengers()->addTravelDocument($recordLocator, $passengerId, $documentData);
Payment Processing
// Add payment $payment = $client->payment()->addPaymentToBooking($recordLocator, $paymentData); // Process refund $refund = $client->payment()->processRefund($recordLocator, $refundData); // Set up installments $installment = $client->payment()->createInstallmentPlan($recordLocator, $planData); // Get payment status $status = $client->payment()->getPaymentStatus($recordLocator);
Ancillary Services
// Seat selection $seat = $client->booking()->assignSeat($recordLocator, $seatData); // Add baggage $baggage = $client->booking()->addBaggage($recordLocator, $baggageData); // Add meal $meal = $client->booking()->addMeal($recordLocator, $mealData); // Add insurance $insurance = $client->booking()->addInsurance($recordLocator, $insuranceData);
π‘οΈ Error Handling
The wrapper provides comprehensive exception handling:
<?php use SantosDave\JamboJet\Exceptions\JamboJetApiException; use SantosDave\JamboJet\Exceptions\JamboJetValidationException; use SantosDave\JamboJet\Exceptions\JamboJetAuthenticationException; try { $booking = $client->booking()->createBooking($request); } catch (JamboJetValidationException $e) { // Handle validation errors (400) echo "Validation Error: " . $e->getMessage(); $errors = $e->getValidationErrors(); } catch (JamboJetAuthenticationException $e) { // Handle authentication errors (401) echo "Authentication Error: " . $e->getMessage(); } catch (JamboJetApiException $e) { // Handle general API errors echo "API Error: " . $e->getMessage(); echo "Status Code: " . $e->getStatusCode(); }
π§ͺ Testing
Run the test suite:
# Run all tests composer test # Run specific test suite composer test -- --testsuite=Unit # Run with coverage composer test -- --coverage-html coverage/
π API Coverage
| Module | Coverage | Endpoints |
|---|---|---|
| Booking | 98% | 120+ |
| Booking Passengers | 95% | 80+ |
| Payment | 100% | 45+ |
| Organizations (v1) | 100% | 25+ |
| Organizations (v2) | 100% | 30+ |
| Manifest | 100% | 35+ |
| Voucher | 100% | 20+ |
| Trip | 100% | 15+ |
| Resources | 100% | 40+ |
| Settings | 100% | 25+ |
| User | 98% | 35+ |
| Messages | 100% | 10+ |
Overall: 97%+ coverage across all modules
π Security
Reporting Security Issues
If you discover a security vulnerability, please email: security@santosdave.com
Do not create public GitHub issues for security vulnerabilities.
Security Best Practices
- Always use HTTPS in production
- Store API credentials securely (environment variables, vaults)
- Implement rate limiting
- Enable request/response logging for audit trails
- Regularly update dependencies
- Use token refresh mechanisms
- Validate all input data
- Sanitize sensitive data in logs
π€ Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Development Setup
# Clone repository git clone https://github.com/santosdave/jambojet-nsk-api.git cd jambojet-nsk-api # Install dependencies composer install # Copy environment file cp .env.example .env # Run tests composer test
Coding Standards
# Check code style (PSR-12) composer lint # Fix code style composer lint:fix # Run static analysis composer analyse
π Changelog
See CHANGELOG.md for release notes and version history.
π License
This project is licensed under the MIT License - see LICENSE file for details.
π¨βπ» Author
Santos Dave
- GitHub: @santosdave
- Email: santosdave86@gmail.com
π Acknowledgments
- JamboJet Airways for API access and documentation
- NSK (New Skies) Platform by Navitaire
- PHP Community for excellent tooling
π Support
- π§ Email: support@santosdave.com
- π Issues: GitHub Issues
- π Documentation: Full Documentation
- π¬ Discussions: GitHub Discussions
πΊοΈ Roadmap
- GraphQL API support
- WebSocket real-time updates
- CLI tool for testing
- Postman collection
- Docker development environment
- Multi-language support
- Advanced caching strategies
- Webhook event handling
Made with β€οΈ by Santos Dave
β Star this repo if you find it useful!