Download the PHP package innmind/mantle without Composer

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

Mantle

Build Status codecov Type Coverage

Abstraction on top of Fibers to coordinate multiple tasks asynchronously.

The goal is to easily move the execution of any code built using innmind/operating-system from a synchronous context to an async one. This means that it's easier to experiment running a piece of code asynchronously and then move back if the experiment is not successful. This also means that you can test each part of an asynchronous system synchronously.

Installation

Usage

This example counts a number of $users coming from 2 sources.

The Forerunner object behaves as a reduce operation, that's why it has 2 arguments: a carried value and a reducer (called a source in this package).

The carried value here is an array that holds the number of fetched users, the number of finished tasks and whether it already launched the tasks or not.

The source will launch 2 tasks if not already done; the first one does an HTTP call and the second one counts the number of lines in a file. The source will be called again once a task finishes and their results will be available inside the fourth argument $results, it will add the number of finished tasks and the number of users to the carried value array. If both tasks are finished then the source calls $continuation->terminate() to instruct the loop to stop.

When the source calls ->terminate() and that all tasks are finished then $run() returns the carried value. Here it will assign the aggregation of both tasks results to the value $users.

Note As long as you use the $os abstraction passed as arguments the system will automatically suspend your code when necessary. This means that you don't even need to think about it.

Note The source callable is also run asynchronously. This means that you can use it to build a socket server and wait indefinitely for new connections without impacting the execution of already started tasks.

Warning Do NOT return the $os variable outside of the tasks or the source as it may break your code.

Note Since this package has been designed by only passing arguments (no global state) it means that you can compose the use of Forerunner, this means that you can run a new instance of Forerunner inside a task and it will behave transparently. (Although this feature as not been tested yet!)

Limitations

Signals

Signals like SIGINT, SIGTERM, etc... that are normally handled via $os->process()->signals() is not yet supported. This may result in unwanted behaviours.

HTTP calls

Currently HTTP calls are done via curl but it can't be integrated in the same loop as other streams. To allow the coordination of multiple tasks when doing HTTP calls the system use a timeout of 10ms and switches between tasks at this max rate.

To fix this limitation a new implementation entirely based on PHP streams needs to be created.

Meanwhile if your goal is to make multiple concurrent HTTP calls you don't need this package. innmind/http-transport already support concurrent calls on it's own (without the limitation mentionned above).

SQL queries

SQL queries executed via $os->remote()->sql() are still executed synchronously.

To fix this limitation a new implementation entirely based on PHP streams needs to be created.

Number of tasks

It seems that the current implementation of this package has a limit of around 10K concurrent tasks before it starts slowing down drastically.


All versions of mantle with dependencies

PHP Build Version
Package Version
Requires php Version ~8.2
innmind/immutable Version ~5.2
innmind/operating-system Version ~4.1|~5.0
innmind/filesystem Version ~7.3
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 innmind/mantle contains the following files

Loading the files please wait ....