diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..21be40ca --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +/.gitattributes export-ignore +/.github/ export-ignore +/.gitignore export-ignore +/phpunit.xml.dist export-ignore +/phpunit.xml.legacy export-ignore +/tests/ export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..85aad9c5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: CI + +on: + push: + pull_request: + +jobs: + PHPUnit: + name: PHPUnit (PHP ${{ matrix.php }}) + runs-on: ubuntu-22.04 + strategy: + matrix: + php: + - 8.3 + - 8.2 + - 8.1 + - 8.0 + - 7.4 + - 7.3 + - 7.2 + - 7.1 + - 7.0 + - 5.6 + - 5.5 + - 5.4 + - 5.3 + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: xdebug + ini-file: development + ini-values: disable_functions='' # do not disable PCNTL functions on PHP < 8.1 + extensions: sockets, pcntl + env: + fail-fast: true # fail step if any extension can not be installed + - run: composer install + - run: vendor/bin/phpunit --coverage-text --exclude-group internet + if: ${{ matrix.php >= 7.3 }} + - run: vendor/bin/phpunit --coverage-text --exclude-group internet -c phpunit.xml.legacy + if: ${{ matrix.php < 7.3 }} + + PHPUnit-hhvm: + name: PHPUnit (HHVM) + runs-on: ubuntu-22.04 + continue-on-error: true + steps: + - uses: actions/checkout@v4 + - run: cp "$(which composer)" composer.phar && ./composer.phar self-update --2.2 # downgrade Composer for HHVM + - name: Run hhvm composer.phar require --dev react/async:^2 react/promise:^2 phpunit/phpunit:^5.7 # downgrade Async and Promise for HHVM + uses: docker://hhvm/hhvm:3.30-lts-latest + with: + args: hhvm composer.phar require --dev react/async:^2 react/promise:^2 phpunit/phpunit:^5.7 + - name: Run hhvm vendor/bin/phpunit --exclude-group internet + uses: docker://hhvm/hhvm:3.30-lts-latest + with: + args: hhvm vendor/bin/phpunit --exclude-group internet diff --git a/.gitignore b/.gitignore index 7c97585f..2866cd9e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .subsplit vendor +/composer.lock diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a72355b9..00000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: php - -php: - - 5.4 - - 5.5 - - 5.6 - - hhvm - -matrix: - allow_failures: - - php: hhvm - -install: ./scripts/travis-init.sh - -script: php vendor/bin/phpunit --coverage-text diff --git a/CHANGELOG.md b/CHANGELOG.md index f0103f00..f5f711e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,94 @@ -CHANGELOG -========= +# Changelog -### 0.4.1 (2014-04-13) +## 1.4.0 (2023-07-11) + +A major new feature release, see [**release announcement**](https://clue.engineering/2023/announcing-reactphp-promise-v3). + +* Feature: Add support for new Promise v3 release. + (#464 and #524 by @clue) + +* Feature: Support PHP 8.2 release. + (#491 by @Nielsvanpach) + +* Improve test suite, update dependencies and report failed assertions. + (#462 and #501 by @clue and #466 and #492 by @SimonFrings) + +## 1.3.0 (2022-07-11) + +A major new feature release, see [**release announcement**](https://clue.engineering/2022/announcing-reactphp-async). + +* Feature: Add new Async component to core components. + (#458 by @clue) + +* Feature: Support PHP 8.1 release. + (#451 by @clue) + +* Improve documentation, update HTTP server example for reactphp/http v1.6.0 release. + (#449 and #459 by @clue and #457 by @nhedger) + +* Improve test suite, support PHPUnit 9 and update dependencies to avoid skipping tests. + (#450 and #454 by @clue and #455 by @SimonFrings) + +## 1.2.0 (2021-07-11) + +A major new feature release, see [**release announcement**](https://clue.engineering/2021/announcing-reactphp-default-loop). + +* Feature: Simplify usage by supporting new [default loop](https://reactphp.org/event-loop/#loop). + (#445 by @clue) + +## 1.1.0 (2020-07-11) + +A major new feature release, see [**release announcement**](https://clue.engineering/2020/announcing-reactphp-http). + +* Feature: Add event-driven, streaming HTTP client and server implementation via [`react/http`](https://reactphp.org/http/). + (#440 by @clue) + +* Update documentation to link to project meta repo and link to our official Gitter chat room. + (#432 and #433 by @clue) + +* Improve test suite to run tests on PHP 7.4 and add `.gitattributes` to exclude dev files from exports. + (#434 by @reedy and #439 by @clue) + +## 1.0.0 (2019-07-11) + +* First stable LTS release, now following [SemVer](https://semver.org/). + We'd like to emphasize that this project is production ready and battle-tested. + We plan to support all long-term support (LTS) releases for at least 24 months, + so you have a rock-solid foundation to build on top of. + +> ReactPHP consists of a set of individual [components](https://reactphp.org/#core-components). + This means that instead of installing something like a "ReactPHP framework", + you actually can pick only the components that you need. As an alternative, + we also provide this meta package that will install all stable components at + once. Installing this is only recommended for quick prototyping, as the list + of stable components may change over time. + In other words, this meta package does not contain any source code and + instead only consists of links to all our main components, see also our + [list of components](https://reactphp.org/#core-components) for more details. + +## 0.4.2 (2014-12-11) + +**Real Split**: The one where we tag the change where the master repo pulls in all the split components. + +New component releases are now tagged and released in their respective +component repository. See also [core components](https://reactphp.org/#core-components) +to learn more about this. + +This project continues to be under active development and is anything but dead. +You can check out the combined [changelog for all ReactPHP components](https://reactphp.org/changelog.html). + +## 0.4.1 (2014-04-13) + +**Hungry Hungry CPU**: CPU starvation bug fixes and other bug fixes. * Bug fix: [EventLoop] null timeout in StreamSelectLoop causing 100% CPU usage (@clue) * Bug fix: [Socket] Check read buffer for data before shutdown signal and end emit (@ArtyDev) * Bug fix: [DNS] Fixed PSR-4 autoload path (@marcj/WyriHaximus) * Bug fix: v0.3.4 changes merged for v0.4.1 -### 0.3.4 (2014-03-30) - - * Bug fix: [Stream] Fixed 100% CPU spike from non-empty write buffer on closed stream - * Buf fix: [Socket] Reset socket to non-blocking after shutting down (PHP bug) +## 0.4.0 (2014-02-02) -### 0.4.0 (2014-02-02) +**Fore!** * Feature: Added ChildProcess to run async child processes within the event loop (@jmikola) * Feature: [EventLoop] Added `EventLoopInterface::nextTick()`, implemented in all event loops (@jmalloc) @@ -29,25 +104,32 @@ CHANGELOG * Bug fix: [Dns] Properly resolve CNAME aliases * Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0 -### 0.3.3 (2013-07-08) +## 0.3.4 (2014-03-30) + + * Bug fix: [Stream] Fixed 100% CPU spike from non-empty write buffer on closed stream + * Buf fix: [Socket] Reset socket to non-blocking after shutting down (PHP bug) + +## 0.3.3 (2013-07-08) + +**Connection state bug fixes** * Bug fix: [EventLoop] No error on removing non-existent streams (@clue) * Bug fix: [EventLoop] Do not silently remove feof listeners in `LibEvLoop` * Bug fix: [Stream] Correctly detect closed connections -### 0.3.2 (2013-05-10) +## 0.3.2 (2013-05-10) * Feature: [Dns] Support default port for IPv6 addresses (@clue) * Bug fix: [Stream] Make sure CompositeStream is closed properly -### 0.3.1 (2013-04-21) +## 0.3.1 (2013-04-21) * Feature: [Socket] Support binding to IPv6 addresses (@clue) * Feature: [SocketClient] Support connecting to IPv6 addresses (@clue) * Bug fix: [Stream] Allow any `ReadableStreamInterface` on `BufferedSink::createPromise()` * Bug fix: [HttpClient] Correct requirement for socket-client -### 0.3.0 (2013-04-14) +## 0.3.0 (2013-04-14) * BC break: [EventLoop] New timers API (@nrk) * BC break: [EventLoop] Remove check on return value from stream callbacks (@nrk) @@ -55,58 +137,87 @@ CHANGELOG * Feature: [SocketClient] New SocketClient component extracted from HttpClient (@clue) * Feature: [Stream] Factory method for BufferedSink -### 0.2.7 (2013-01-05) +### EventLoop + +* The timer callback now receives a `Timer` instance, with the following + useful methods: + + * `cancel` + * `isActive` + * `setData($data)` + * `getData` + + And some other less common ones. These are prefered over + `LoopInterface::cancelTimer` and `LoopInterface::isTimerActive`. + +* You can no longer return a boolean from a periodic timer callback to abort + it. + +### HttpClient + +* `HttpClient\*ConnectionManager` has been moved to `SocketClient\*Connector`, + and the `getConnection` method has been renamed to `create`. + + Before: + + $connectionManager->getConnection($host, $port); + + After: + + $connector->create($host, $port); + +## 0.2.7 (2013-01-05) * Bug fix: [EventLoop] Fix libevent timers with PHP 5.3 * Bug fix: [EventLoop] Fix libevent timer cancellation (@nrk) -### 0.2.6 (2012-12-26) +## 0.2.6 (2012-12-26) * Feature: [Cache] New cache component, used by DNS * Bug fix: [Http] Emit end event when Response closes (@beaucollins) * Bug fix: [EventLoop] Plug memory issue in libevent timers (@cameronjacobson) * Bug fix: [EventLoop] Correctly pause LibEvLoop on stop() -### 0.2.5 (2012-11-26) +## 0.2.5 (2012-11-26) * Feature: [Stream] Make BufferedSink trigger progress events on the promise (@jsor) * Feature: [HttpClient] Use a promise-based API internally * Bug fix: [HttpClient] Use DNS resolver correctly -### 0.2.4 (2012-11-18) +## 0.2.4 (2012-11-18) * Feature: [Stream] Added ThroughStream, CompositeStream, ReadableStream and WritableStream * Feature: [Stream] Added BufferedSink * Feature: [Dns] Change to promise-based API (@jsor) -### 0.2.3 (2012-11-14) +## 0.2.3 (2012-11-14) * Feature: LibEvLoop, integration of `php-libev` * Bug fix: Forward drain events from HTTP response (@cs278) * Dependency: Updated guzzle deps to `3.0.*` -### 0.2.2 (2012-10-28) +## 0.2.2 (2012-10-28) * Major: Dropped Espresso as a core component now available as `react/espresso` only * Feature: DNS executor timeout handling (@arnaud-lb) * Feature: DNS retry executor (@arnaud-lb) * Feature: HTTP client (@arnaud-lb) -### 0.2.1 (2012-10-14) +## 0.2.1 (2012-10-14) * Feature: Support HTTP 1.1 continue * Bug fix: Check for EOF in `Buffer::write()` * Bug fix: Make `Espresso\Stack` work with invokables (such as `Espresso\Application`) * Minor adjustments to DNS parser -### 0.2.0 (2012-09-10) +## 0.2.0 (2012-09-10) * Feature: DNS resolver -### 0.1.1 (2012-07-12) +## 0.1.1 (2012-07-12) * Bug fix: Testing and functional against PHP >= 5.3.3 and <= 5.3.8 -### 0.1.0 (2012-07-11) +## 0.1.0 (2012-07-11) * First tagged release diff --git a/README.md b/README.md index 2c9ff6d6..f8e1d0f2 100644 --- a/README.md +++ b/README.md @@ -1,87 +1,294 @@ -# React +
+ ReactPHP Logo +
+ +
+ +
+ Event-driven, non-blocking I/O with PHP. +
-Event-driven, non-blocking I/O with PHP. +
-[![Build Status](https://secure.travis-ci.org/reactphp/react.png?branch=master)](http://travis-ci.org/reactphp/react) +
+ Build Status +
-### Notice - (May 25th, 2014) +
-As of 2014-05-25 we have reversed roles of this and the component repositories. -Instead of reactphp/react being the master code repository it is now the sum of React's components. -All PRs should be made against their corresponding repository found in [/reactphp](https://github.com/reactphp). +ReactPHP is a low-level library for event-driven programming in PHP. At its core +is an event loop, on top of which it provides low-level utilities, such as: +Streams abstraction, async DNS resolver, network client/server, HTTP +client/server and interaction with processes. Third-party libraries can use these +components to create async network clients/servers and more. -## What is it? +```php +listen($socket); + +echo "Server running at http://127.0.0.1:8080" . PHP_EOL; +``` +This simple web server written in ReactPHP responds with "Hello World!" for every request. + +ReactPHP is production ready and battle-tested with millions of installations +from all kinds of projects around the world. Its event-driven architecture makes +it a perfect fit for efficient network servers and clients handling hundreds or +thousands of concurrent connections, long-running applications and many other +forms of cooperative multitasking with non-blocking I/O operations. What makes +ReactPHP special is its vivid ecosystem with hundreds of third-party libraries +allowing you to integrate with many existing systems, such as common network +services, database systems and other third-party APIs. + +* **Production ready** and battle-tested. +* **Rock-solid** with stable long-term support (LTS) releases. +* **Requires no extensions** and runs on any platform - no excuses! +* Takes advantage of **optional extensions** to get better performance when available. +* **Highly recommends latest version of PHP 7+** for best performance and support. +* **Supports legacy PHP 5.3+ and HHVM** for maximum compatibility. +* **Well designed** and **reusable components**. +* **Decoupled parts** so they can be replaced by alternate implementations. +* Carefully **tested** (unit & functional). +* Promotes **standard PSRs** where possible for maximum interoperability. +* Aims to be **technology neutral**, so you can use your preferred application stack. +* Small **core team of professionals** supported by **large network** of outside contributors. + +ReactPHP is non-blocking by default. Use workers for blocking I/O. The event loop is based on the reactor pattern (hence the name) and strongly inspired by libraries such as EventMachine (Ruby), Twisted (Python) and Node.js (V8). -## Design goals +> This repository you're currently looking at is mostly used as a meta + repository to discuss and plan all things @ReactPHP. See the individual + components linked below for more details about each component, its + documentation and source code. + +## Core Components + +* **EventLoop** + ReactPHP's core reactor event-loop. + [Read the documentation](https://github.com/reactphp/event-loop) + +* **Stream** + Event-driven readable and writable streams for non-blocking I/O in ReactPHP. + [Read the documentation](https://github.com/reactphp/stream) + +* **Promise** + Promises/A implementation for PHP. + [Read the documentation](https://github.com/reactphp/promise) + +* **Async** + Async utilities and fibers for ReactPHP. + [Read the documentation](https://github.com/reactphp/async) + +## Network Components + +* **Socket** + Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP. + [Read the documentation](https://github.com/reactphp/socket) + +* **Datagram** + Event-driven UDP client and server sockets for ReactPHP. + [Read the documentation](https://github.com/reactphp/datagram) + +* **HTTP** + Event-driven, streaming HTTP client and server implementation for ReactPHP. + [Read the documentation](https://github.com/reactphp/http) + +* **DNS** + Async DNS resolver for ReactPHP. + [Read the documentation](https://github.com/reactphp/dns) + +## Utility Components + +* **Cache** + Async caching for ReactPHP. + [Read the documentation](https://github.com/reactphp/cache) + +* **ChildProcess** + Library for executing child processes. + [Read the documentation](https://github.com/reactphp/child-process) + +* **PromiseTimer** + Trivial timeout implementation for ReactPHP's Promise lib. + [Read the documentation](https://github.com/reactphp/promise-timer) + +* **PromiseStream** + The missing link between Promise-land and Stream-land, built on top of ReactPHP. + [Read the documentation](https://github.com/reactphp/promise-stream) + +## Built with ReactPHP + +* **Thruway** + PHP Client and Router Library for Autobahn and WAMP (Web Application Messaging + Protocol) for Real-Time Application Messaging + [voryx/Thruway](https://github.com/voryx/Thruway) -* Usable with a bare minimum of PHP extensions, add more extensions to get better performance. -* Provide a standalone event-loop component that can be re-used by other libraries. -* Decouple parts so they can be replaced by alternate implementations. +* **PPM - PHP Process Manager** + PPM is a process manager, supercharger and load balancer for modern PHP + applications. + [php-pm/php-pm](https://github.com/php-pm/php-pm) -React is non-blocking by default. Use workers for blocking I/O. +* **php-ar-drone** + 🚁 Port of node-ar-drone which allows user to control a Parrot AR Drone over + PHP + [jolicode/php-ar-drone](https://github.com/jolicode/php-ar-drone) -## High-level abstractions +* **Ratchet** + Asynchronous WebSocket server + [ratchetphp/Ratchet](https://github.com/ratchetphp/Ratchet) -There are two main abstractions that make dealing with control flow a lot more -manageable. +* **Predis\Async** + Asynchronous PHP client library for Redis built on top of ReactPHP + [nrk/predis-async](https://github.com/nrk/predis-async) -* **Stream:** A stream represents an I/O source (ReadableStream) or - destination (WritableStream). These can be used to model pipes, similar - to a unix pipe that is composed of processes. Streams represent very large - values as chunks. +* **clue/redis-server** + A Redis server implementation in pure PHP + [clue/redis-server](https://github.com/clue/php-redis-server) -* **Promise:** A promise represents an eventual return value. Promises can be - composed and are a lot easier to deal with than traditional CPS callback - spaghetti and allow for almost sane error handling. Promises represent the - computation for producing single values. +[And many more on our wiki page »](https://github.com/reactphp/react/wiki/Users) -You should use these abstractions whenever you can. +## Articles + +* **Sergey Zhuk** + A series of articles covering ReactPHP: from the basics to the real + application examples. + [sergeyzhuk.me](http://sergeyzhuk.me/reactphp-series) + +* **Cees-Jan Kiewiet** + Blog series about several ReactPHP components and how they work. + [blog.wyrihaximus.net](http://blog.wyrihaximus.net/categories/reactphp-series/) + +* **Loïc Faugeron** + Super Speed Symfony - ReactPHP. + [gnugat.github.io](https://gnugat.github.io/2016/04/13/super-speed-sf-react-php.html) + +* **Marc J. Schmidt** + Bring High Performance Into Your PHP App (with ReactPHP). + [marcjschmidt.de](http://marcjschmidt.de/blog/2014/02/08/php-high-performance.html) + +* **Marc Morera** + When ReactPHP meet Symfony + [medium.com/@apisearch](https://medium.com/@apisearch/symfony-and-reactphp-series-82082167f6fb) + +## Talks + +* **Christian Lück** + [Pushing the limits with ReactPHP](https://www.youtube.com/watch?v=-5ZdGUvOqx4) + +* **Jeremy Mikola** + [Async PHP With React](https://www.youtube.com/watch?v=s6xrnYae1FU) + +* **Igor Wiedler** + [Event-driven PHP](https://www.youtube.com/watch?v=MWNcItWuKpI) ## Getting started -React consists of individual components. -This means that instead of installing something like a "React framework", you actually +ReactPHP consists of a set of individual [components](#core-components). +This means that instead of installing something like a "ReactPHP framework", you actually pick only the components that you need. -The recommended way to install these components is [through Composer](http://getcomposer.org). -[New to Composer?](http://getcomposer.org/doc/00-intro.md) +This project follows [SemVer](https://semver.org/) for all its stable components. +The recommended way to install these components is [through Composer](https://getcomposer.org/). +[New to Composer?](https://getcomposer.org/doc/00-intro.md) For example, this may look something like this: ```bash -$ composer require react/event-loop react/http +# recommended install: pick required components +composer require react/event-loop react/http +``` + +As an alternative, we also provide a meta package that will install all stable +components at once. Installing this is only recommended for quick prototyping, +as the list of stable components may change over time. This meta package can be +installed like this: + +```bash +# quick protoyping only: install all stable components +composer require react/react:^1.4 ``` -For more details, check out [React's homepage](http://reactphp.org) for +For more details, check out [ReactPHP's homepage](https://reactphp.org/) for quickstart examples and usage details. -## Documentation +See also the combined [changelog for all ReactPHP components](https://reactphp.org/changelog.html) +for details about version upgrades. + +## Support -Superficial documentation can be found in the README files of the individual -components. See `vendor/react/*/src/README.md`. +Do you have a question and need help with ReactPHP? Don't worry, we're here to help! -## Community +As a first step, check the elaborate documentation that comes with each +component (see links to individual documentation for each component above). +If you find your question is not answered within the documentation, there's a +fair chance that it may be relevant to more people. Please do not hesitate to +file your question as an issue in the relevant component so others can also +participate. -Check out #reactphp on irc.freenode.net. Also follow -[@reactphp](https://twitter.com/reactphp) on twitter. +You can also check out our official [Gitter chat room](https://gitter.im/reactphp/reactphp). +Most of the people involved in this project are available in this chat room, so many +questions get answered in a few minutes to some hours. We also use this chat room +to announce all new releases and ongoing development efforts, so consider +staying in this chat room for a little longer. + +Also follow [@reactphp](https://twitter.com/reactphp) on Twitter for updates. +We use this mostly for noteworthy, bigger updates and to keep the community +updated about ongoing development efforts. You can always use the `#reactphp` +hashtag if you have anything to share! + +We're a very open project and we prefer public communication whenever possible, +so that more people can participate and help getting the best solutions available. +At the same time, we realize that some things are better addressed in private. +Whether you just want to say *thank you*, want to report a security issue or +want to help sponsor a certain feature development, you can reach out to the +core team in private by sending an email to `support@reactphp.org`. Please keep in +mind that we're a small team of volunteers and do our best to support anybody +reaching out. + +Do you want to support ReactPHP? Awesome! Let's start with letting the the world +know why you think ReactPHP is awesome and try to help others getting on board! +Send a tweet, write a blog post, give a talk at your local user group or +conference or even write a book. There are many ways you can help. You can +always reach out to us in private and help others in our support channels. +Thank you! ## Tests -To run the test suite, you need install the dependencies via composer, then -run PHPUnit. +To run the test suite, you first need to clone this repo and then install all +dependencies [through Composer](https://getcomposer.org/): + +```bash +composer install +``` + +To run the test suite, go to the project root and run: - $ composer install - $ phpunit +```bash +vendor/bin/phpunit +``` + +The test suite also contains a number of functional integration tests that rely +on a stable internet connection. Due to the vast number of integration tests, +these are skipped by default during CI runs. If you also do not want to run these, +they can simply be skipped like this: + +```bash +vendor/bin/phpunit --exclude-group internet +``` ## License diff --git a/UPGRADE-0.3.md b/UPGRADE-0.3.md deleted file mode 100644 index e26bce81..00000000 --- a/UPGRADE-0.3.md +++ /dev/null @@ -1,33 +0,0 @@ -UPGRADE for 0.3.x -================= - -EventLoop ---------- - -* The timer callback now receives a `Timer` instance, with the following - useful methods: - - * `cancel` - * `isActive` - * `setData($data)` - * `getData` - - And some other less common ones. These are prefered over - `LoopInterface::cancelTimer` and `LoopInterface::isTimerActive`. - -* You can no longer return a boolean from a periodic timer callback to abort - it. - -HttpClient ----------- - -* `HttpClient\*ConnectionManager` has been moved to `SocketClient\*Connector`, - and the `getConnection` method has been renamed to `create`. - - Before: - - $connectionManager->getConnection($host, $port); - - After: - - $connector->create($host, $port); diff --git a/benchmark/bench.php b/benchmark/bench.php deleted file mode 100644 index 0a21c835..00000000 --- a/benchmark/bench.php +++ /dev/null @@ -1,47 +0,0 @@ -prev = microtime(true); - } - - public function snap() { - $prev = $this->prev; - - $current = microtime(true); - $this->prev = $current; - - return $current - $prev; - } - - public function printSnap($name) { - printf("%-40s: %s s\n", $name, $this->snap()); - } -} - -function benchLoops(array $tests) { - $loops = array( - 'StreamSelectLoop', - 'LibEventLoop', - 'LibEvLoop', - // 'LibUvLoop', - ); - - foreach ($tests as $testName => $test) { - foreach ($loops as $loopName) { - $loopClass = "React\\EventLoop\\$loopName"; - $loop = new $loopClass(); - - $bench = new Bench(); - $bench->start(); - - $test($loop); - - $bench->printSnap("$loopName: $testName"); - } - - printf("----------------------------------------\n"); - } -} diff --git a/benchmark/timers.php b/benchmark/timers.php deleted file mode 100644 index e0c30a34..00000000 --- a/benchmark/timers.php +++ /dev/null @@ -1,32 +0,0 @@ - function ($loop) use ($x) { - for ($i = 0; $i < $x; $i++) { - $loop->addTimer(1, function ($signature, $loop) {}); - } - $loop->run(); - }, - $x . ' periodic timers' => function ($loop) use ($x) { - for ($i = 0; $i < $x; $i++) { - $loop->addPeriodicTimer(2, function ($signature, $loop) use (&$i, $x) { - if ($i >= $x) { - $loop->cancelTimer($signature); - } - }); - } - $loop->run(); - }, -); - -benchLoops($tests); diff --git a/composer.json b/composer.json index 686523b8..3f752a63 100644 --- a/composer.json +++ b/composer.json @@ -1,43 +1,32 @@ { "name": "react/react", - "description": "Nuclear Reactor written in PHP.", - "keywords": ["event-loop", "reactor", "asynchronous"], + "description": "ReactPHP: Event-driven, non-blocking I/O with PHP.", + "keywords": ["reactor", "asynchronous", "ReactPHP"], + "homepage": "https://reactphp.org/", "license": "MIT", "support": { - "issues": "https://github.com/reactphp/react/issues", - "irc": "irc://irc.freenode.org/reactphp" + "chat": "https://gitter.im/reactphp/reactphp" }, "require": { - "php": ">=5.4.0", - "react/cache": "0.4.*", - "react/child-process": "0.4.*", - "react/dns": "0.4.*", - "react/event-loop": "0.4.*", - "react/http-client": "0.4.*", - "react/http": "0.4.*", - "react/promise": "~2.1", - "react/socket-client": "^0.5.3", - "react/socket": "0.4.*", - "react/stream": "0.4.*" + "php": ">=5.3.8", + "react/async": "^4.3 || ^3.2 || ^2.2", + "react/cache": "^1.1", + "react/dns": "^1.13", + "react/event-loop": "^1.5", + "react/http": "^1.11", + "react/promise": "^3.2 || ^2.10 || ^1.3", + "react/promise-stream": "^1.7", + "react/promise-timer": "^1.11", + "react/socket": "^1.15", + "react/stream": "^1.4" }, "require-dev": { - "phpunit/phpunit": "~4.0", - "clue/block-react": "^1.1", - "clue/stream-filter": "^1.3" - }, - "suggest": { - "ext-libevent": "Allows for use of a more performant event-loop implementation.", - "ext-libev": "Allows for use of a more performant event-loop implementation.", - "ext-event": "Allows for use of a more performant event-loop implementation." - }, - "extra": { - "branch-alias": { - "dev-master": "0.5-dev" - } + "clue/stream-filter": "^1.3", + "phpunit/phpunit": "^9.6 || ^7.5 || ^5.7 || ^4.8.36" }, "config": { - "platform": { - "php": "5.4" + "preferred-install": { + "react/*": "source" } } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 1fa818aa..00000000 --- a/composer.lock +++ /dev/null @@ -1,1679 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "e8553796809bcd1f49aba4ccc2dc8088", - "content-hash": "b23752d99957e709b5dffd1700eb660f", - "packages": [ - { - "name": "evenement/evenement", - "version": "v2.0.0", - "source": { - "type": "git", - "url": "https://github.com/igorw/evenement.git", - "reference": "f6e843799fd4f4184d54d8fc7b5b3551c9fa803e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/igorw/evenement/zipball/f6e843799fd4f4184d54d8fc7b5b3551c9fa803e", - "reference": "f6e843799fd4f4184d54d8fc7b5b3551c9fa803e", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-0": { - "Evenement": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch", - "homepage": "http://wiedler.ch/igor/" - } - ], - "description": "Événement is a very simple event dispatching library for PHP", - "keywords": [ - "event-dispatcher", - "event-emitter" - ], - "time": "2012-11-02 14:49:47" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.3.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "PSR-7 message implementation", - "keywords": [ - "http", - "message", - "stream", - "uri" - ], - "time": "2016-06-24 23:00:38" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2016-08-06 14:39:51" - }, - { - "name": "react/cache", - "version": "v0.4.1", - "source": { - "type": "git", - "url": "https://github.com/reactphp/cache.git", - "reference": "558f614891341b1d817a8cdf9a358948ec49638f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/cache/zipball/558f614891341b1d817a8cdf9a358948ec49638f", - "reference": "558f614891341b1d817a8cdf9a358948ec49638f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "react/promise": "~2.0|~1.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\Cache\\": "src\\" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Async caching.", - "keywords": [ - "cache" - ], - "time": "2016-02-25 18:17:16" - }, - { - "name": "react/child-process", - "version": "v0.4.1", - "source": { - "type": "git", - "url": "https://github.com/reactphp/child-process.git", - "reference": "3ab4f83c6f6c5862f7ca28d999a92d327472a671" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/child-process/zipball/3ab4f83c6f6c5862f7ca28d999a92d327472a671", - "reference": "3ab4f83c6f6c5862f7ca28d999a92d327472a671", - "shasum": "" - }, - "require": { - "evenement/evenement": "~2.0", - "php": ">=5.4.0", - "react/event-loop": "0.4.*", - "react/stream": "~0.4.2" - }, - "require-dev": { - "sebastian/environment": "~1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\ChildProcess\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Library for executing child processes.", - "keywords": [ - "process" - ], - "time": "2016-08-01 18:09:48" - }, - { - "name": "react/dns", - "version": "v0.4.3", - "source": { - "type": "git", - "url": "https://github.com/reactphp/dns.git", - "reference": "751b3129556e04944f164e3556a20ca6e201e459" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/dns/zipball/751b3129556e04944f164e3556a20ca6e201e459", - "reference": "751b3129556e04944f164e3556a20ca6e201e459", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "react/cache": "~0.4.0|~0.3.0", - "react/promise": "~2.1|~1.2", - "react/socket": "~0.4.0|~0.3.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\Dns\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Async DNS resolver.", - "keywords": [ - "dns", - "dns-resolver" - ], - "time": "2016-08-01 10:09:07" - }, - { - "name": "react/event-loop", - "version": "v0.4.2", - "source": { - "type": "git", - "url": "https://github.com/reactphp/event-loop.git", - "reference": "164799f73175e1c80bba92a220ea35df6ca371dd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/event-loop/zipball/164799f73175e1c80bba92a220ea35df6ca371dd", - "reference": "164799f73175e1c80bba92a220ea35df6ca371dd", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "suggest": { - "ext-event": "~1.0", - "ext-libev": "*", - "ext-libevent": ">=0.1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.5-dev" - } - }, - "autoload": { - "psr-4": { - "React\\EventLoop\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Event loop abstraction layer that libraries can use for evented I/O.", - "keywords": [ - "asynchronous", - "event-loop" - ], - "time": "2016-03-08 02:09:32" - }, - { - "name": "react/http", - "version": "v0.4.2", - "source": { - "type": "git", - "url": "https://github.com/reactphp/http.git", - "reference": "abedac54967d7ea237ad104cff8274e2c4077cf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/http/zipball/abedac54967d7ea237ad104cff8274e2c4077cf4", - "reference": "abedac54967d7ea237ad104cff8274e2c4077cf4", - "shasum": "" - }, - "require": { - "evenement/evenement": "^2.0", - "guzzlehttp/psr7": "^1.0", - "php": ">=5.4.0", - "react/socket": "^0.4", - "react/stream": "^0.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\Http\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Library for building an evented http server.", - "keywords": [ - "http" - ], - "time": "2016-11-09 15:20:39" - }, - { - "name": "react/http-client", - "version": "v0.4.15", - "source": { - "type": "git", - "url": "https://github.com/reactphp/http-client.git", - "reference": "01e919008363622334f91419a9908b3a51754ccd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/http-client/zipball/01e919008363622334f91419a9908b3a51754ccd", - "reference": "01e919008363622334f91419a9908b3a51754ccd", - "shasum": "" - }, - "require": { - "evenement/evenement": "~2.0", - "guzzlehttp/psr7": "^1.0", - "php": ">=5.4.0", - "react/dns": "0.4.*", - "react/event-loop": "0.4.*", - "react/promise": "~2.2", - "react/socket-client": "^0.5 || ^0.4 || ^0.3", - "react/stream": "0.4.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\HttpClient\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Asynchronous HTTP client library.", - "keywords": [ - "http" - ], - "time": "2016-12-02 10:17:42" - }, - { - "name": "react/promise", - "version": "v2.5.0", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "2760f3898b7e931aa71153852dcd48a75c9b95db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/2760f3898b7e931aa71153852dcd48a75c9b95db", - "reference": "2760f3898b7e931aa71153852dcd48a75c9b95db", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com" - } - ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "keywords": [ - "promise", - "promises" - ], - "time": "2016-12-22 14:09:01" - }, - { - "name": "react/promise-timer", - "version": "v1.1.1", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise-timer.git", - "reference": "ddedc67bfd7f579fc83e66ff67e3564b179297dd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise-timer/zipball/ddedc67bfd7f579fc83e66ff67e3564b179297dd", - "reference": "ddedc67bfd7f579fc83e66ff67e3564b179297dd", - "shasum": "" - }, - "require": { - "php": ">=5.3", - "react/event-loop": "~0.4.0|~0.3.0", - "react/promise": "~2.1|~1.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\Promise\\Timer\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christian Lück", - "email": "christian@lueck.tv" - } - ], - "description": "Trivial timeout implementation for Promises", - "homepage": "https://github.com/react/promise-timer", - "keywords": [ - "async", - "event-loop", - "promise", - "reactphp", - "timeout", - "timer" - ], - "time": "2016-12-27 08:12:19" - }, - { - "name": "react/socket", - "version": "v0.4.4", - "source": { - "type": "git", - "url": "https://github.com/reactphp/socket.git", - "reference": "d61930e1aefb2a704b0adbe6bb97ee4a835d6a96" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/socket/zipball/d61930e1aefb2a704b0adbe6bb97ee4a835d6a96", - "reference": "d61930e1aefb2a704b0adbe6bb97ee4a835d6a96", - "shasum": "" - }, - "require": { - "evenement/evenement": "~2.0|~1.0", - "php": ">=5.3.0", - "react/event-loop": "0.4.*|0.3.*", - "react/stream": "^0.4.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\Socket\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Library for building an evented socket server.", - "keywords": [ - "Socket" - ], - "time": "2016-12-19 22:52:38" - }, - { - "name": "react/socket-client", - "version": "v0.5.3", - "source": { - "type": "git", - "url": "https://github.com/reactphp/socket-client.git", - "reference": "5570838d436f056695e9a5eaf01dd5f80386dd26" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/socket-client/zipball/5570838d436f056695e9a5eaf01dd5f80386dd26", - "reference": "5570838d436f056695e9a5eaf01dd5f80386dd26", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "react/dns": "0.4.*|0.3.*", - "react/event-loop": "0.4.*|0.3.*", - "react/promise": "^2.1 || ^1.2", - "react/promise-timer": "~1.0", - "react/stream": "^0.4.5" - }, - "require-dev": { - "clue/block-react": "^1.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\SocketClient\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Async connector to open TCP/IP and SSL/TLS based connections.", - "keywords": [ - "Socket" - ], - "time": "2016-12-24 11:19:15" - }, - { - "name": "react/stream", - "version": "v0.4.5", - "source": { - "type": "git", - "url": "https://github.com/reactphp/stream.git", - "reference": "23389503012e1ab721ad498a5a1f4b39f7a43c00" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/stream/zipball/23389503012e1ab721ad498a5a1f4b39f7a43c00", - "reference": "23389503012e1ab721ad498a5a1f4b39f7a43c00", - "shasum": "" - }, - "require": { - "evenement/evenement": "^2.0|^1.0", - "php": ">=5.3.8" - }, - "require-dev": { - "clue/stream-filter": "~1.2", - "react/event-loop": "^0.4|^0.3", - "react/promise": "^2.0|^1.0" - }, - "suggest": { - "react/event-loop": "^0.4", - "react/promise": "^2.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\Stream\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Basic readable and writable stream interfaces that support piping.", - "keywords": [ - "pipe", - "stream" - ], - "time": "2016-11-13 17:06:02" - } - ], - "packages-dev": [ - { - "name": "clue/block-react", - "version": "v1.1.0", - "source": { - "type": "git", - "url": "https://github.com/clue/php-block-react.git", - "reference": "ed70f8d497dd265e30bc7dd19cf86b2e149b1ecf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/clue/php-block-react/zipball/ed70f8d497dd265e30bc7dd19cf86b2e149b1ecf", - "reference": "ed70f8d497dd265e30bc7dd19cf86b2e149b1ecf", - "shasum": "" - }, - "require": { - "php": ">=5.3", - "react/event-loop": "0.4.*|0.3.*", - "react/promise": "~2.1|~1.2", - "react/promise-timer": "~1.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christian Lück", - "email": "christian@lueck.tv" - } - ], - "description": "Integrate async React PHP components into your blocking environment", - "homepage": "https://github.com/clue/php-block-react", - "keywords": [ - "async", - "blocking", - "event loop", - "promise", - "reactphp", - "synchronous" - ], - "time": "2016-03-09 15:10:22" - }, - { - "name": "clue/stream-filter", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/clue/php-stream-filter.git", - "reference": "e3bf9415da163d9ad6701dccb407ed501ae69785" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/e3bf9415da163d9ad6701dccb407ed501ae69785", - "reference": "e3bf9415da163d9ad6701dccb407ed501ae69785", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Clue\\StreamFilter\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christian Lück", - "email": "christian@lueck.tv" - } - ], - "description": "A simple and modern approach to stream filtering in PHP", - "homepage": "https://github.com/clue/php-stream-filter", - "keywords": [ - "bucket brigade", - "callback", - "filter", - "php_user_filter", - "stream", - "stream_filter_append", - "stream_filter_register" - ], - "time": "2015-11-08 23:41:30" - }, - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14 21:17:01" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" - } - ], - "time": "2015-02-03 12:10:50" - }, - { - "name": "phpspec/prophecy", - "version": "v1.6.2", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0|^2.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.0", - "phpunit/phpunit": "^4.8 || ^5.6.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com/" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2016-11-21 14:58:47" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2015-10-06 15:47:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2016-10-03 07:40:28" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21 13:50:34" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4|~5" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2016-05-12 18:03:57" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2016-11-15 14:06:22" - }, - { - "name": "phpunit/phpunit", - "version": "4.8.31", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "98b2b39a520766bec663ff5b7ff1b729db9dbfe3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/98b2b39a520766bec663ff5b7ff1b729db9dbfe3", - "reference": "98b2b39a520766bec663ff5b7ff1b729db9dbfe3", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2016-12-09 02:45:31" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2015-10-02 06:51:40" - }, - { - "name": "sebastian/comparator", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2016-11-19 09:18:40" - }, - { - "name": "sebastian/diff", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2015-12-08 07:14:41" - }, - { - "name": "sebastian/environment", - "version": "1.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-08-18 05:49:44" - }, - { - "name": "sebastian/exporter", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-06-17 09:04:28" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12 03:26:01" - }, - { - "name": "sebastian/recursion-context", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" - }, - { - "name": "symfony/yaml", - "version": "v2.8.15", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "befb26a3713c97af90d25dd12e75621ef14d91ff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/befb26a3713c97af90d25dd12e75621ef14d91ff", - "reference": "befb26a3713c97af90d25dd12e75621ef14d91ff", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com/", - "time": "2016-11-14 16:15:57" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.4.0" - }, - "platform-dev": [], - "platform-overrides": { - "php": "5.4" - } -} diff --git a/examples/child-child.php b/examples/child-child.php deleted file mode 100644 index a86064ec..00000000 --- a/examples/child-child.php +++ /dev/null @@ -1,10 +0,0 @@ -on('exit', function($exitCode, $termSignal) { - echo "Child exit\n"; -}); - -$loop->addTimer(0.001, function($timer) use ($process) { - $process->start($timer->getLoop()); - - $process->stdout->on('data', function($output) { - echo "Child script says: {$output}"; - }); -}); - -$loop->addPeriodicTimer(5, function($timer) { - echo "Parent cannot be blocked by child\n"; -}); - -$loop->run(); diff --git a/examples/dns-resolver.php b/examples/dns-resolver.php deleted file mode 100644 index 3cac3bee..00000000 --- a/examples/dns-resolver.php +++ /dev/null @@ -1,23 +0,0 @@ -create('8.8.8.8', $loop); - -$domain = 'igor.io'; - -$dns - ->resolve($domain) - ->then(function ($ip) { - echo "Host: $ip\n"; - }, function ($e) { - echo "Error: {$e->getMessage()}\n"; - }); - -echo "Resolving domain $domain...\n"; - -$loop->run(); diff --git a/examples/echo-server.php b/examples/echo-server.php deleted file mode 100644 index 8f1ec12c..00000000 --- a/examples/echo-server.php +++ /dev/null @@ -1,18 +0,0 @@ -on('connection', function ($conn) { - $conn->pipe($conn); -}); - -echo "Socket server listening on port 4000.\n"; -echo "You can connect to it by running: telnet localhost 4000\n"; - -$socket->listen(4000); -$loop->run(); diff --git a/examples/http-client.php b/examples/http-client.php deleted file mode 100644 index af8925ae..00000000 --- a/examples/http-client.php +++ /dev/null @@ -1,40 +0,0 @@ -createCached('8.8.8.8', $loop); - -$factory = new React\HttpClient\Factory(); -$client = $factory->create($loop, $dnsResolver); - -$request = $client->request('GET', 'https://api.github.com/repos/reactphp/react/commits'); -$request->on('response', function ($response) { - $buffer = ''; - - $response->on('data', function ($data) use (&$buffer) { - $buffer .= $data; - echo "."; - }); - - $response->on('end', function () use (&$buffer) { - $decoded = json_decode($buffer, true); - $latest = $decoded[0]['commit']; - $author = $latest['author']['name']; - $date = date('F j, Y', strtotime($latest['author']['date'])); - - echo "\n"; - echo "Latest commit on react was done by {$author} on {$date}\n"; - echo "{$latest['message']}\n"; - }); -}); -$request->on('end', function ($error, $response) { - echo $error; -}); -$request->end(); - -$loop->run(); diff --git a/examples/next-tick.php b/examples/next-tick.php deleted file mode 100644 index 64b9bcfb..00000000 --- a/examples/next-tick.php +++ /dev/null @@ -1,58 +0,0 @@ -addTimer( - 0, - function () { - echo 'timer' . PHP_EOL; - } -); - -$loop->nextTick( - function ($loop) { - echo 'next-tick #1' . PHP_EOL; - - $loop->nextTick( - function () { - echo 'next-tick #2' . PHP_EOL; - } - ); - } -); - -$loop->futureTick( - function ($loop) { - echo 'future-tick #1' . PHP_EOL; - - $loop->futureTick( - function () { - echo 'future-tick #2' . PHP_EOL; - } - ); - } -); - -$loop->run(); diff --git a/examples/parallel-download.php b/examples/parallel-download.php deleted file mode 100644 index 90c8edf8..00000000 --- a/examples/parallel-download.php +++ /dev/null @@ -1,46 +0,0 @@ - 'http://nodejs.org/dist/v0.6.18/node-v0.6.18.tar.gz', - 'php-5.5.15.tar.gz' => 'http://it.php.net/get/php-5.5.15.tar.gz/from/this/mirror', -); - -foreach ($files as $file => $url) { - $readStream = fopen($url, 'r'); - $writeStream = fopen($file, 'w'); - - stream_set_blocking($readStream, 0); - stream_set_blocking($writeStream, 0); - - $read = new React\Stream\Stream($readStream, $loop); - $write = new React\Stream\Stream($writeStream, $loop); - - $read->on('end', function () use ($file, &$files) { - unset($files[$file]); - echo "Finished downloading $file\n"; - }); - - $read->pipe($write); -} - -$loop->addPeriodicTimer(5, function ($timer) use (&$files) { - if (0 === count($files)) { - $timer->cancel(); - } - - foreach ($files as $file => $url) { - $mbytes = filesize($file) / (1024 * 1024); - $formatted = number_format($mbytes, 3); - echo "$file: $formatted MiB\n"; - } -}); - -echo "This script will show the download status every 5 seconds.\n"; - -$loop->run(); diff --git a/examples/pump-shitload-of-data.php b/examples/pump-shitload-of-data.php deleted file mode 100644 index 7efad58e..00000000 --- a/examples/pump-shitload-of-data.php +++ /dev/null @@ -1,23 +0,0 @@ -on('connection', function ($conn) { - $shitload = str_repeat('a', 1024*1024*32); - $conn->write($shitload); - $conn->end(); -}); - -echo "Socket server listening on port 4000.\n"; -echo "You can connect to it by running: telnet localhost 4000\n"; - -$socket->listen(4000); -$loop->run(); diff --git a/examples/scalability.php b/examples/scalability.php deleted file mode 100644 index 84276118..00000000 --- a/examples/scalability.php +++ /dev/null @@ -1,21 +0,0 @@ -addReadStream($s, function ($s) use ($i) { - $c=stream_socket_accept($s); - $len=strlen($i)+4; - fwrite($c,"HTTP/1.1 200 OK\r\nContent-Length: $len\r\n\r\nHi:$i\n"); - echo "Served on port 800$i\n"; - }); -} - -echo "Access your brand new HTTP server on 127.0.0.1:800x. Replace x with any number from 0-9\n"; - -$loop->run(); diff --git a/examples/tcp-chat.php b/examples/tcp-chat.php deleted file mode 100644 index 8ed2ffc5..00000000 --- a/examples/tcp-chat.php +++ /dev/null @@ -1,35 +0,0 @@ -on('connection', function ($conn) use ($conns) { - $conns->attach($conn); - - $conn->on('data', function ($data) use ($conns, $conn) { - foreach ($conns as $current) { - if ($conn === $current) { - continue; - } - - $current->write($conn->getRemoteAddress().': '); - $current->write($data); - } - }); - - $conn->on('end', function () use ($conns, $conn) { - $conns->detach($conn); - }); -}); - -echo "Socket server listening on port 4000.\n"; -echo "You can connect to it by running: telnet localhost 4000\n"; - -$socket->listen(4000); -$loop->run(); diff --git a/examples/test-close-conn.php b/examples/test-close-conn.php deleted file mode 100644 index a949aeaa..00000000 --- a/examples/test-close-conn.php +++ /dev/null @@ -1,22 +0,0 @@ -on('connection', function ($conn) use (&$i, $loop) { - $i++; - - $conn->on('end', function () use (&$i) { - $i--; - }); -}); - -$loop->addPeriodicTimer(2, function () use (&$i) { - echo "$i open connections?\n"; -}); - -$socket->listen(8080); -$loop->run(); diff --git a/examples/test-memory-http.php b/examples/test-memory-http.php deleted file mode 100644 index 634dd8bc..00000000 --- a/examples/test-memory-http.php +++ /dev/null @@ -1,28 +0,0 @@ -on('request', function ($request, $response) use (&$i) { - $i++; - $response->writeHead(); - $response->end("Hello World!\n"); -}); - -$loop->addPeriodicTimer(2, function () use (&$i) { - $kmem = memory_get_usage(true) / 1024; - echo "Request: $i\n"; - echo "Memory: $kmem KiB\n"; -}); - -$socket->listen(8080); -$loop->run(); diff --git a/examples/test-memory.php b/examples/test-memory.php deleted file mode 100644 index 4e478011..00000000 --- a/examples/test-memory.php +++ /dev/null @@ -1,26 +0,0 @@ -addPeriodicTimer(0.001, function () use (&$i, $loop) { - $i++; - - // $loop->addTimer(1, function ($timer) { - // }); - - $loop->addPeriodicTimer(1, function ($timer) { - $timer->cancel(); - }); -}); - -$loop->addPeriodicTimer(2, function () use (&$i) { - $kmem = memory_get_usage(true) / 1024; - echo "Run: $i\n"; - echo "Memory: $kmem KiB\n"; -}); - -$loop->run(); diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d7f645a3..d5d26a2e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,25 +1,30 @@ - + + cacheResult="false" + colors="true" + convertDeprecationsToExceptions="true"> - + + + ./vendor/react/event-loop/tests/ ./vendor/react/*/tests/ - - - + + ./vendor/react/*/src/ - - + + + + + + + + + + diff --git a/phpunit.xml.legacy b/phpunit.xml.legacy new file mode 100644 index 00000000..2cd2f9b1 --- /dev/null +++ b/phpunit.xml.legacy @@ -0,0 +1,26 @@ + + + + + + + ./vendor/react/*/tests/ + + + + + ./vendor/react/*/src/ + + + + + + + + + + + diff --git a/resources/avatar.png b/resources/avatar.png deleted file mode 100644 index a3a94454..00000000 Binary files a/resources/avatar.png and /dev/null differ diff --git a/resources/logo.png b/resources/logo.png deleted file mode 100644 index 16366398..00000000 Binary files a/resources/logo.png and /dev/null differ diff --git a/resources/logo.psd b/resources/logo.psd deleted file mode 100644 index 849b36c3..00000000 Binary files a/resources/logo.psd and /dev/null differ diff --git a/resources/logo_huge.png b/resources/logo_huge.png deleted file mode 100644 index c08bcdb2..00000000 Binary files a/resources/logo_huge.png and /dev/null differ diff --git a/scripts/travis-init.sh b/scripts/travis-init.sh deleted file mode 100755 index 6360e58f..00000000 --- a/scripts/travis-init.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -set -e -set -o pipefail - -if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then - - # install "libevent" (used by 'event' and 'libevent' PHP extensions) - sudo apt-get install -y libevent-dev - - # install 'event' PHP extension - echo "yes" | pecl install event - - # install 'libevent' PHP extension - curl http://pecl.php.net/get/libevent-0.0.5.tgz | tar -xz - pushd libevent-0.0.5 - phpize - ./configure - make - make install - popd - echo "extension=libevent.so" >> "$(php -r 'echo php_ini_loaded_file();')" - - # install 'libev' PHP extension - git clone --recursive https://github.com/m4rw3r/php-libev - pushd php-libev - phpize - ./configure --with-libev - make - make install - popd - echo "extension=libev.so" >> "$(php -r 'echo php_ini_loaded_file();')" - -fi - -composer self-update -composer install --dev --prefer-source diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 6105242b..2af732cf 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,7 +2,9 @@ $autoload = require __DIR__ . '/../vendor/autoload.php'; -// register all `autoload-dev` paths from React's components +assert($autoload instanceof Composer\Autoload\ClassLoader); + +// register all `autoload-dev` paths from ReactPHP's components foreach (glob(__DIR__ . '/../vendor/react/*/composer.json') as $b) { $config = json_decode(file_get_contents($b), true); @@ -10,13 +12,8 @@ $base = dirname($b) . '/'; foreach ($config['autoload-dev']['psr-4'] as $namespace => $paths) { foreach ((array)$paths as $path) { - $autoload->addPsr4($namespace, $base . trim($path, '\\/')); + $autoload->addPsr4($namespace, $base . $path); } } } } - -// load all legacy test bootstrap scripts from React's components -foreach (glob(__DIR__ . '/../vendor/react/*/tests/bootstrap.php') as $b) { - include $b; -}