Download the PHP package flairuk/laravel-all-aboard without Composer
On this page you can find all versions of the php package flairuk/laravel-all-aboard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download flairuk/laravel-all-aboard
More information about flairuk/laravel-all-aboard
Files in flairuk/laravel-all-aboard
Download flairuk/laravel-all-aboard
More information about flairuk/laravel-all-aboard
Files in flairuk/laravel-all-aboard
Vendor flairuk
Package laravel-all-aboard
Short Description A Laravel client for the All Aboard rail API: European train journeys, offers, bookings, orders, rail passes and refunds.
License MIT
Homepage https://github.com/FLAIRUK/laravel-all-aboard
Package laravel-all-aboard
Short Description A Laravel client for the All Aboard rail API: European train journeys, offers, bookings, orders, rail passes and refunds.
License MIT
Homepage https://github.com/FLAIRUK/laravel-all-aboard
Please rate this library. Is it a good library?
Informations about the package laravel-all-aboard
**Laravel All Aboard** โ A Laravel 12 and 13 client for the [All Aboard API](https://allaboard.eu/api-solution), for travel sites and agents that search, price and book European train journeys and rail passes.
- **The whole booking flow.** Covers locations, journey search, offers (including round-trip fares), bookings, orders, payment-gateway checkout, tickets, rail passes, travel cards, refunds and access tokens.
- **No GraphQL to write.** Every method sends a query with a sensible set of fields, checked against the live schema. Pass your own fields when you need more or less.
- **Pagination built in.** Locations and orders can be walked with `->lazy()`, which fetches the next page only when you reach it.
- **Safe retries.** Queries are retried on connection errors and 5xx responses. Bookings, orders, payments and refunds never are, so nothing is booked or charged twice.
- **Real errors.** GraphQL errors throw exceptions carrying All Aboard's error codes (`NO_TICKETS`, `PRICE_CHANGED`โฆ), their arguments and the request id to quote to their support.
> This is an unofficial package. It is not affiliated with or endorsed by All Aboard. You need your own All Aboard account and API key.
๐ฆ Installation ยท ๐ Usage ยท ๐ Booking flow ยท ๐ซ Rail passes ยท โ ๏ธ Errors ยท โ๏ธ Configuration
## ๐ฆ Installation `all-aboard:install` publishes `config/all-aboard.php` and adds these keys to `.env` and `.env.example`: Then check the connection: The test environment is a separate gateway and needs a key with the `test` scope. Keys are given scopes in the [Dashboard](https://allaboard.eu/agent): `live` or `test` for access at all, `orders:read` to read orders, and `payments:wallet`, `payments:stripe` or `payments:invoice` for each way of paying. See [API Scopes](https://docs.allaboard.eu/intro/scopes).
## ๐ Usage You can also type-hint `FLAIRUK\AllAboard\AllAboard` to have it injected. Every call returns a `Response` wrapping the operation's result: Prices are `['amount' => 13400, 'currency' => 'EUR']`, with the amount in minor units (cents, pence). ### Locations Journeys are searched between location `uid`s. All Aboard recommends keeping your own copy of the locations and re-syncing it on a schedule: Remove any you stored that the walk no longer returns. For autocomplete, you can also ask the API directly: A **meta** location (`isMeta: true`) is a city rather than one station: "Paris" rather than "Paris Gare de Lyon". Searching from it lets the API pick the right station for the route, so prefer meta locations and list them first. ### Finding journeys Search the whole trip and let the API route it: Options follow the [`journeys`](https://docs.allaboard.eu/tickets/) query: ### Getting offers An offer is a way to travel a journey: a price, a flexibility and a class. Pricing waits on the train operators and can take up to 30 seconds: Passengers can be arrays, or shorthand: `'adult'` for a type, `30` for an age. Up to five per request. All Aboard has no hard look-to-book limit, but asks that you only price journeys a customer is likely to book. **Round trips** are priced in one call, so operators can quote genuine return fares: Offers that share a `memberOf.id` are one ticket (a return fare shows as a full price one way and a zero-priced companion the other). Book all of them together or none. ### Travel cards Railcards, discount cards and passes such as Interrail change what a passenger pays: Send exactly the same passengers and cards when you create the booking. Cards can't be changed afterwards. ### Anything else For operations or fields without a wrapper, run GraphQL directly. Authentication, the session header and error handling still apply: Every resource method takes a `fields` argument to replace its default selection. The defaults are constants on `FLAIRUK\AllAboard\Fields` if you want to build on them:
## ๐ Booking flow Create a booking from the offers, add the passengers' details, create an order to pre-book the tickets, then pay: Then, depending on how your cost center pays: `create()`, `finalize()` and `createPayment()` are never retried automatically. If one of them times out, check with `orders()->find()` before trying again. ### Changing the booking To bill passengers to a [cost center](https://docs.allaboard.eu/payments/cost-centers) other than your default, set it on them when creating the booking: ### Tickets Tickets are issued after finalizing, usually within 15 minutes. Poll the order, for example from a queued job: `tickets()` is empty until issuance completes. List orders with `AllAboard::orders()->list()->lazy()` (needs `orders:read`). ### Refunds ### Public pages and access tokens Never put an API key with `orders:read` on a page the public can open. Mint an access token for the one order instead. It reaches nothing else and expires on its own: Pass it to the [Refund Manager embed](https://docs.allaboard.eu/embeds/aa-refund-manager-modal), or use it from PHP:
## ๐ซ Rail passes All Aboard finds the cheapest combination of passes (a **bundle**) covering every passenger: Booking a pass follows the same flow as tickets: Each passenger's pass code appears in `orders()->tickets()` once issued.
## โ ๏ธ Errors and rate limits All Aboard reports errors in the GraphQL response, each with a code: The full list is in [Error Codes](https://docs.allaboard.eu/ref/errors). In queued jobs, release the job on a rate limit: `AllAboard::agent()->rateLimits()` shows each of your limits, how much is left and when it resets.
## โ๏ธ Configuration | Key | Env | Default | | --- | --- | --- | | `api_key` | `ALL_ABOARD_API_KEY` | | | `test` | `ALL_ABOARD_TEST` | `false` | | `base_url` | `ALL_ABOARD_BASE_URL` | built from `test` | | `session` | `ALL_ABOARD_SESSION` | from the Laravel session | | `currency` | `ALL_ABOARD_CURRENCY` | EUR, All Aboard's default | | `timeout` | `ALL_ABOARD_TIMEOUT` | `90` seconds | | `retry` | | 2 retries, 500 ms apart (queries only) | | `cache.store` | `ALL_ABOARD_CACHE_STORE` | the default cache store | | `cache.ttl` | | 24 hours; `null` turns caching off | Every request carries a `session` header, which All Aboard uses to trace one customer's booking flow. By default it is a hash of the Laravel session id, so a customer's requests share one; outside a web request (in a queued job, say) each client gets a random one. Set it yourself to tie a job back to the customer: Scope a single call differently without changing the defaults: ### Streaming All Aboard can stream journey offers over WebSockets as each part is priced. This package uses plain HTTP, which waits for the complete result. If you want prices to appear as they arrive, use the [embeds](https://docs.allaboard.eu/embeds/) or a [graphql-ws](https://the-guild.dev/graphql/ws) client in the browser.
## ๐งช Testing The client uses Laravel's HTTP client, so `Http::fake()` works in your own tests:
## ๐ License The MIT License (MIT). See [LICENSE](LICENSE) for details. All Aboard is a trademark of its owner. This package is not affiliated with or endorsed by All Aboard.
All versions of laravel-all-aboard with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
illuminate/cache Version ^12.0|^13.0
illuminate/collections Version ^12.0|^13.0
illuminate/console Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
illuminate/cache Version ^12.0|^13.0
illuminate/collections Version ^12.0|^13.0
illuminate/console Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
The package flairuk/laravel-all-aboard contains the following files
Loading the files please wait ...