Download the PHP package cruide/starline-openapi-php without Composer

On this page you can find all versions of the php package cruide/starline-openapi-php. 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 starline-openapi-php

Starline OpenApi for PHP

Author: Alexander Tischenko

Русская версия

PHP client library for StarLine OpenAPI — telematics for StarLine security systems: vehicle state, remote commands, events and tracking.

This library is not affiliated with NPO StarLine. You are responsible for API usage (see StarLine terms of service).

Installation

Or locally via repositories in composer.json:

Getting App ID and Secret Key

  1. Register at the developer portal: https://developer.starline.ru
  2. Create an application — obtain your App ID and Secret Key.

Authentication flow (SLID)

Step Request Parameters Result
1 GET id.starline.ru/apiV3/application/getCode appId, secret=md5(appSecret) app code
2 GET id.starline.ru/apiV3/application/getToken appId, secret=md5(appSecret+code) app token
3 POST id.starline.ru/apiV3/user/login Header: token: <app_token>, form: login, pass=sha1(password) user_token
4 POST developer.starline.ru/json/v2/auth.slid JSON: {"slid_token":"<user_token>"} cookie slnet + user_id

All subsequent requests use the Cookie: slnet=<token> header. The entire chain is executed automatically by the library and cached in TokenStorageInterface.

Quick start

SLID authentication

StarLineID token

Manual captcha / SMS

Auto-captcha + Tesseract (optional, requires tesseract-ocr)

API methods

Method Description
$api->authenticate(bool $force = false) Full SLID authentication
$api->authenticateWithSlidToken(string $token) Auth via StarLineID token (skip SLID)
$api->authenticateWithCaptcha(string $sid, string $code) Retry auth with captcha
$api->authenticateWithSms(string $code) Retry auth with SMS code
$api->authenticateWithCaptchaAuto(OcrInterface $ocr) Auto-captcha: download, OCR, retry
$api->setOcr(OcrInterface $ocr) Enable automatic captcha solving
$api->user()->id() Current user ID
$api->user()->info() UserInfo (profile + devices)
$api->devices()->list() List of Device objects
$api->devices()->state($deviceId) DeviceState (/json/v3/device/{id}/data)
$api->devices()->details($deviceId) Full device info (/json/v1/device/{id}/details)
$api->devices()->position($deviceId) Last known position (/json/v1/device/{id}/position)
$api->devices()->setParam($deviceId, $params) Send command (/json/v1/device/{id}/set_param)
$api->devices()->arm/disarm/startEngine/stopEngine($deviceId) Common commands
$api->devices()->events($deviceId, $periodStart, $periodEnd) Events in time range
$api->devices()->eventType($id) Single event type description
$api->devices()->eventTypes() All event types library
$api->devices()->ways($deviceId, $begin, $end, $extra) GPS track (coordinates, mileage, travel time)
$api->get($path, $query) / $api->post($path, $json) Generic requests

Token storage

By default, tokens live only in process memory. For web apps / daemons, implement TokenStorageInterface, e.g. with Laravel cache:

Error handling

Exception When
StarlineAuthException invalid App ID/Secret/login/password, expired tokens (after one auto-retry)
StarlineAuthCaptchaException captcha or SMS code required (if OCR is not configured or failed)
StarlineApiException API errors (HTTP >= 400 or state/code != success); getRaw() — raw response
StarlineHttpException cURL transport errors

Notes

Tests

License

MIT


All versions of starline-openapi-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-json Version *
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 cruide/starline-openapi-php contains the following files

Loading the files please wait ...