Download the PHP package trafiklab/resrobot-php-sdk without Composer

On this page you can find all versions of the php package trafiklab/resrobot-php-sdk. 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 resrobot-php-sdk

ResRobot PHP SDK

Build status Latest Stable Version codecov License: MPL 2.0

ResRobot offers realtime data about Sweden's public transport. Show all departures and arrivals for a stop, or easily plan a route from A to B. More information can be found at Trafiklab - ResRobot routeplanner and Trafiklab - ResRobot timetables.

This repository contains a PHP SDK to easily use the ResRobot APIs. This way you don't need to worry about making requests, caching, or parsing responses. All responses are parsed and returned as PHP classes.

Installation

Installing can be done by using Composer:

composer require trafiklab/resrobot-php-sdk

Versioning

This package follows Semantic versioning:

Given a version number MAJOR.MINOR.PATCH, we increment the:

  • MAJOR version when we make incompatible API changes,
  • MINOR version when we add functionality in a backwards-compatible manner, and
  • PATCH version when we make backwards-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

Requirements

The following software is required to use this SDK:

Usage

In order to use the Resrobot Timetable and Routeplanning APIs, you need to obtain an API key from Trafiklab first.

Important: You only need 1 API key, which can be used for all Resrobot API calls. The multiple API-key setters are only there for compatibility with our other API wrappers, allowing you to easily switch between APIs.

Getting Timetables (departures or arrivals from a stop)

Timetables

Request

The following code example illustrates how you can retrieve a timetable for a certain stop.

<YOUR_API_KEY> is obtained from Trafiklab. <YOUR_USER_AGENT> is a string which identifies your application. While this is not enforced in any way, it is good practice to use a clear user agent. An example could be MyDemoApp/1.0.0 ([email protected]). If you don't want to send a user agent, you can just leave out this line.

Detailed information about ResRobot request parameters can be found at the ResRobot departures/arrivals API page. Only the most important/most used request parameters are implemented in the SDK, in order to reduce clutter, and to ensure that we can keep the SDK unchanged in case of changes to the API. If you believe we have missed an important field, please create an issue so we can review this.

Response

In order to use the data returned by your request, you can simply call getTimeTable() on the response object. This method returns an array of TimeTableEntry instances, each of which describes one departure or arrival. You can look at the code and PHPDoc in order to get up-to-date information on which fields are available. Detailed information about ResRobot responses can be found at the ResRobot departures/arrivals API page.

The following code gives a quick idea on how the SDK is used.

Routeplanning

Request

The following code example illustrates how you can plan a route from A to B

Response

In order to use the data returned by your request, you can simply call getTrips() on the response object. This method returns an array of Trip instances, each of which describes one departure or arrival. You can look at the code and PHPDoc in order to get up-to-date information on which fields are available. Detailed information about ResRobot responses can be found at the ResRobot departures/arrivals API page.

The following code gives a quick idea on how the SDK is used.

Contributing

We accept pull requests, but please create an issue first in order to discuss the addition or fix. If you would like to see a new feature added, you can also create a feature request by creating an issue.

Help

If you're stuck with a question, feel free to ask help through the Issue tracker.


All versions of resrobot-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-json Version *
trafiklab/php-sdk-commons Version ~1.2.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 trafiklab/resrobot-php-sdk contains the following files

Loading the files please wait ....