Download the PHP package kostaschasiotis/octotravel-php without Composer
On this page you can find all versions of the php package kostaschasiotis/octotravel-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kostaschasiotis/octotravel-php
More information about kostaschasiotis/octotravel-php
Files in kostaschasiotis/octotravel-php
Package octotravel-php
Short Description A simple, robust PHP library for interacting with the Octo.travel API.
License MIT
Informations about the package octotravel-php
Octo.travel API PHP Library
A simple, robust PHP library for interacting with the Octo.travel API. This library provides an object-oriented interface to easily consume the API, including functionality for retrieving suppliers, managing products, and checking availability.
Features
- Fully typed classes and value objects for a safer and clearer interface.
- Built-in support for all API endpoints.
- Easy-to-extend architecture using mappers and API call abstractions.
- Guzzle HTTP client for efficient and reliable HTTP requests.
Installation
Install the library using Composer:
Usage
Setup
Create an instance of the OctoClient with your API base URL and optional headers.
Endpoints
Get Supplier
Returns the supplier and associated contact details.
Get Products
Fetch the list of products.
Get Single Product
Fetch the product for the given id.
Get Availability Calendar
This endpoint is highly optimised and will return a single object per day. It's designed to be queried for large date ranges and the result is used to populate an availability calendar.
Check Availability
This endpoint is slightly slower as it will return an object for each individual departure time (or day).
You have to perform this step to retrieve an availabilityId in order to confirm a sale, so if you just want to use this endpoint and skip the calendar endpoint then that's perfectly ok.
Booking Reservation
Reserving availability when making a booking.
Get Bookings
This endpoint will fetch the bookings you have made for the given filters.
When using this endpoint you must include one of the following query parameters:
- resellerReference
- supplierReference
- localDate
- localDateStart and localDateEnd
Booking Confirmation
This endpoint confirms the booking so it's ready to be used.
Booking Cancellation
For cancelling bookings. You can only cancel a booking if booking.cancellable is TRUE, and is within the booking cancellation cut-off window.
Get Booking
Fetch the status of an existing booking.
Booking Update
Updates a booking before and after it has been confirmed as long as it hasn't been redeemed or within the cancellation cutoff window.
Extend Reservation
Use this endpoint to hold the availability for a booking longer if the status is ON_HOLD.
Extending the Library
This library uses a mapper-based architecture to map raw API responses to domain entities. You can easily add new endpoints or extend the functionality:
- Create a New API Call Class Implement the ApiCallInterface for your custom API endpoint logic.
- Add Mappers Map raw data to your domain entities using static mapper classes.
- Register the Call Add the new call to OctoClient for easy access.
Contributing
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new feature branch: git checkout -b feature/your-feature-name.
- Commit your changes: git commit -m "Add your message here".
- Push the branch: git push origin feature/your-feature-name.
- Open a pull request.
License
This library is open-sourced under the MIT license.
Acknowledgments
Special thanks to the Octo.travel team for providing the inspiration and API documentation for this library.