Download the PHP package profi-tech/tsqm-php without Composer

On this page you can find all versions of the php package profi-tech/tsqm-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 tsqm-php

CI

What is TSQM?

TSQM is a low-level PHP library for transactional and reliable execution of code involving external calls, service requests, database queries, etc. In case of an error, the code can be retried, or if retries are not feasible, it could be “compensated”.

How low is "low-level"?

One of the main requirements for the library was its ability to integrate into any PHP codebase starting from version 7.4. TSQM provides basic classes and methods that can be embedded into almost any project or framework. The main classes are:

:warning: Attention! TSQM does not work out of the box; it requires a process of integration and configuration.

Basic usage

1. Install

2. Database Initialization

TSQM requires a table in a MySQL or SQLite database. You can get the SQL to create this table using:

Or by specifying the vendor and table name:

Run the generated SQL on the database you want TSQM to work with.

3. Configuring TSQM engine

You could tune TSQM engine by passing an instance of Tsqm\Options to the constructor:

4. Creating a task

To create tasks, you need to create a new Task object and set the necessary fields:

The argument for setCallable could be:

:warning: If you use callable objects, you need to set a DI container for the TSQM engine that implements Tsqm\Container\ContainerInterface. The callable object must be accessible in the container by its class name.

Task supports the following options:

Also you could specify retry policy via setRetryPolicy and RetryPolicy object:

Exammple:

5. Running a task

To execute a task, you need to call the run method:

The execution result will be available in the $task object:

6. Retries and scheduled tasks

A task does not complete if:

Tasks that need to be retried can be run through the poll method:

Although, poll method could perform scheduled runs, for production it should be used only as a fallback to the main queue-based approach:

7. Queues

To integrate queues in TSQM, you need to implement the Tsqm\Queue\QueueInterface and add the implementing class during the TSQM engine initialization:

The TSQM engine will automatically call the enqueue method of your class if the task needs to be executed later.

To recieve and handle the tasks call the listen method in a separate script:

8. Transactions

In addition to simple tasks, TSQM supports transactions; you can implement a task where the callable returns a generator of tasks. All standard logics will apply, such as error handling, retries, etc. An example of implementing a transaction:

If the purchase task fails, the transaction execution will stop and retry according to the policy "3 attempts every 5 seconds". If all attempts fail, the rollback task will be executed.

:warning: Attention! TSQM caches the results of completed tasks and checks the determinism of the transaction during execution, meaning it is safe to retry the call as many times as needed.

9. Logging

TSQM logs every step of task and transaction execution. To access these logs, you need to connect a class that implements the Tsqm\Logger\LoggerInterface interface:

Limitations and warnings


All versions of tsqm-php with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-pdo Version *
ext-json Version *
ext-pcntl 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 profi-tech/tsqm-php contains the following files

Loading the files please wait ....