Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Cees-Jan Kiewiet
Copyright (c) 2020 Cees-Jan Kiewiet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# reactphp-parallel
# ReactPHP bindings around ext-parallel

[![Build Status](https://travis-ci.com/reactphp-parallel/reactphp-parallel.png)](https://travis-ci.com/reactphp-parallel/reactphp-parallel)
![Continuous Integration](https://github.com/reactphp-parallel/reactphp-parallel/workflows/Continuous%20Integration/badge.svg)
[![Latest Stable Version](https://poser.pugx.org/react-parallel/react-parallel/v/stable.png)](https://packagist.org/packages/react-parallel/react-parallel)
[![Total Downloads](https://poser.pugx.org/react-parallel/react-parallel/downloads.png)](https://packagist.org/packages/react-parallel/react-parallel)
[![Code Coverage](https://scrutinizer-ci.com/g/reactphp-parallel/reactphp-parallel/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/reactphp-parallel/reactphp-parallel/?branch=master)
[![Type Coverage](https://shepherd.dev/github/reactphp-parallel/reactphp-parallel/coverage.svg)](https://shepherd.dev/github/reactphp-parallel/reactphp-parallel)
[![License](https://poser.pugx.org/react-parallel/react-parallel/license.png)](https://packagist.org/packages/react-parallel/react-parallel)

ReactPHP bindings around ext-parallel

## Install ##

To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `~`.
Expand All @@ -15,9 +15,26 @@ To install via [Composer](http://getcomposer.org/), use the command below, it wi
composer require react-parallel/react-parallel
```

## Usage

The factory in this package provides the following methods for quick and shared access to low level components.

```php
$loop = EventLoopFactory::create();
$factory = new Factory($loop);
$factory->loop(); // Returns the event loop, mainly for convenience
$factory->eventLoopBridge(); // Returns the event loop bridge, used as a central place to translate channels and futures to observables and promises
$factory->streams(); // Returns the stream factory, which provides high level stream abstractions
$factory->call(function (int $time): int {
return $time;
}, [time()]); // Executes the closure passed into this method in a thread and returns a promises for any results coming out of that closure
$factory->lowLevelPool(); // Returns a low level pool that will scale infinitely (as a long as you have resources enough to scale)
$factory->limitedPool(12); // Returns a limited pool with a maximum number of threads specified by you
```

## License ##

Copyright 2019 [Cees-Jan Kiewiet](http://wyrihaximus.net/)
Copyright 2020 [Cees-Jan Kiewiet](http://wyrihaximus.net/)

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down