Download the PHP package stefanak-michal/thingsdb-php without Composer

On this page you can find all versions of the php package stefanak-michal/thingsdb-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 thingsdb-php

ThingsDB PHP client

PHP library for communication with ThingsDB over TCP socket.

ko-fi

:white_check_mark: Requirements

:floppy_disk: Installation - Composer

Run the following command in your project to install the latest applicable version of the package:

composer require stefanak-michal/thingsdb-php

Packagist

:desktop_computer: Usage

Class \ThingsDB\ThingsDB provide all functionality related to socket connection with ThingsDB. It contains set of method which are based on documentation. Every method has comment (annotation) with required information and link to documentation.

Available methods

Method Description
__construct ThingsDB constructor - immediately connect to provided uri.
ping Ping, useful as keep-alive
auth Authorization with username and password
authToken Authorization with token
query Query ThingsDB
run Run a procedure
join Join one or more room(s)
leave Leave one or more room(s)
emit Emit an event to a room
listening Listen for incoming packages

Listening

Listening is specific state in which you wait for emitted packages from ThingsDB. You can read more about it in docs. PHP has max_execution_time and it is not allowed to set higher value than this. With max_execution_time=0 you can of course wait indefinitely.

join, emit, leave also emit package towards the one who did it. Therefore, don't be surprised when first package received with calling listening will be ON_JOIN|ON_LEAVE|ON_EMIT event type.

Example

:lock: SSL

To make connection with enabled SSL you can use third parameter of constructor which is context. This context is provided to stream_context_create when creating connection. verify_peer is the bare minimum to enable SSL communication.

:stopwatch: Timeout

Class constructor contains $timeout argument. This timeout is for established socket connection. To set up timeout for establishing socket connection itself you have to set ini directive default_socket_timeout.

_Setting up ini directive isn't part of connection class because function ini_set can be disabled on production environments for security reasons._

Error

\ThingsDB\error\ConnectException

This exception class is used for any exception related to connection on client side.

\ThingsDB\error\PackageException

This exception class is used when error occurs in ThingsDB. list of error types


All versions of thingsdb-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
rybakit/msgpack Version ^0.9.1
ext-mbstring Version *
ext-openssl 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 stefanak-michal/thingsdb-php contains the following files

Loading the files please wait ....