Download the PHP package nikba/laravel-bussystem-api without Composer

On this page you can find all versions of the php package nikba/laravel-bussystem-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-bussystem-api

Laravel BusSystem API

Latest Version on Packagist Total Downloads Tests PHP Version

A typed Laravel client for the BusSystem passenger transportation API. Search bus, train, and air routes; build bookings; manage orders and tickets; and optionally persist API data with the included Eloquent models.

Highlights

Requirements

Laravel 10 and 11 are supported for compatibility with existing applications but are end-of-life upstream. Prefer a currently maintained Laravel release for production deployments.

Installation

Install the package with Composer:

Laravel discovers the service provider and facade automatically.

Publish the configuration file:

If you want to store orders and tickets locally, publish and run the included migrations:

Configuration

Add your BusSystem credentials to .env:

The package also supports these optional settings:

BUSSYSTEM_RETRY_DELAY and cache TTL values are expressed in milliseconds and seconds, respectively. Keep credentials out of source control and use separate credentials for test and production environments.

Quick start

1. Search for routes

City and station identifiers are provided by BusSystem. You can retrieve available points before searching:

2. Check seats and booking options

Use the interval_id returned by the route search:

3. Create an order

Route and passenger indexes are zero-based when assigning seats, discounts, baggage, or wagons.

4. Buy or reserve tickets

Treat response arrays as external API data: validate the keys required by your application before reading or persisting them.

Dependency injection

For application services and controllers, dependency injection is usually preferable to the facade:

The client is registered as a singleton under BusSystemClientInterface and the bussystem container alias.

Route searches

SearchCriteria supports the following fluent methods:

Purpose Methods
Travel date date(), period()
City route from(), to()
Train stations trainFrom(), trainTo()
Airport route airportFrom(), airportTo()
Specific stations stationFrom(), stationTo()
Transport transport(), bus(), train(), air()
Transfers allowTransfers(), directOnly()
Result options sortBy(), sortByTime(), sortByPrice(), includeSoldOut()
Locale currency(), language()
Air travel airPassengers(), airServiceClass(), airDirect(), airBaggage()
Custom API data addParam()

For air travel, use IATA codes and the dedicated passenger options:

Booking builder

BookingData provides methods for composing single-leg or multi-leg bookings:

Purpose Methods
Routes addRoute()
Passengers addPassenger()
Seats addSeat(), addSeats()
Discounts and baggage addDiscount(), addBaggage()
Train wagon addWagon()
Contact details setContactInfo()
Additional details setAdditionalInfo(), setPromocode()
Locale setCurrency(), setLanguage()
Inspection toArray(), validate(), getPassengerCount(), getRouteCount()

For a multi-leg journey, call addRoute() once per leg and use its zero-based index for related selections:

Available operations

All methods are available through either BusSystemClientInterface or the BusSystem facade.

For signatures, parameters, builders, models, and configuration details, see the complete API reference.

Method Description
getPoints() Retrieve cities, stations, and airports
getRoutes() Search for available routes
getAllRoutes() Retrieve detailed timetable routes
getFreeSeats() Retrieve available seats or train wagons
getSeatPlan() Retrieve a seat-plan layout
getDiscounts() Retrieve discounts for a route
getBaggage() Retrieve baggage options for a route
createOrder() Create an order from BookingData
buyTickets() Purchase tickets for an order
reserveTickets() Reserve tickets for payment on boarding
validateReservation() Check whether a phone number can reserve
validateSms() Send or verify an SMS validation code
getOrder() Retrieve order information
getTicket() Retrieve ticket information
cancelTickets() Cancel an order or selected tickets
ping() Check API availability

Enums

Native PHP enums remove common magic strings while preserving string-based compatibility:

Unknown transport values fall back to TransportType::All; unknown sort values fall back to SortType::Time. Unknown model status values resolve to null.

Error handling

Every package exception extends BusSystemException and can carry structured context:

The exception namespace also includes booking, payment, and cancellation exception types for application-level workflows.

Caching, retries, and logging

Caching applies automatically to points, route searches, and seat plans when enabled. Cache keys include the request parameters, and each resource has its own configurable TTL.

The default HTTP client retries connection failures and HTTP 5xx responses using exponential backoff. BUSSYSTEM_RETRY_ATTEMPTS controls the maximum retry count and BUSSYSTEM_RETRY_DELAY sets the base delay in milliseconds.

Request logging is configurable through BUSSYSTEM_LOGGING_ENABLED, BUSSYSTEM_LOG_CHANNEL, and BUSSYSTEM_LOG_LEVEL. Authentication parameters are removed from request log context by the package. Review your logging retention and access policies because other booking data may contain personal information.

Optional Eloquent models

The package includes Order and Ticket models backed by bussystem_orders and bussystem_tickets. API responses are not persisted automatically; your application decides what and when to store.

Useful scopes include:

Both models use soft deletes and retain the original API payload in the nullable api_response JSON column.

Testing

The injectable HTTP client in BusSystemClient makes isolated tests straightforward:

Run the project checks locally:

Individual commands are also available:

Contributing

Contributions are welcome. Please read CONTRIBUTING.md before opening a pull request and include tests for behavioral changes.

Security

Do not report security vulnerabilities through public issues. Follow SECURITY.md to disclose them privately.

Changelog

See CHANGELOG.md for release history and upgrade notes.

Credits

License

Laravel BusSystem API is open-source software licensed under the MIT License.


All versions of laravel-bussystem-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.5|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nikba/laravel-bussystem-api contains the following files

Loading the files please wait ...