Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Event-driven, non-blocking I/O with PHP.

License

NotificationsYou must be signed in to change notification settings

reactphp/reactphp

Repository files navigation

ReactPHP Logo

Event-driven, non-blocking I/O with PHP.

Build Status

ReactPHP is a low-level library for event-driven programming in PHP. At its coreis an event loop, on top of which it provides low-level utilities, such as:Streams abstraction, async DNS resolver, network client/server, HTTPclient/server and interaction with processes. Third-party libraries can use thesecomponents to create async network clients/servers and more.

<?php// $ composer require react/http react/socket # install example using Composer// $ php example.php # run example on command line, requires no additional web serverrequire__DIR__ .'/vendor/autoload.php';$server =newReact\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface$request) {returnReact\Http\Message\Response::plaintext("Hello World!\n"    );});$socket =newReact\Socket\SocketServer('127.0.0.1:8080');$server->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 installationsfrom all kinds of projects around the world. Its event-driven architecture makesit a perfect fit for efficient network servers and clients handling hundreds orthousands of concurrent connections, long-running applications and many otherforms of cooperative multitasking with non-blocking I/O operations. What makesReactPHP special is its vivid ecosystem with hundreds of third-party librariesallowing you to integrate with many existing systems, such as common networkservices, 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 ofoptional 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 andreusable components.
  • Decoupled parts so they can be replaced by alternate implementations.
  • Carefullytested (unit & functional).
  • Promotesstandard PSRs where possible for maximum interoperability.
  • Aims to betechnology neutral, so you can use your preferred application stack.
  • Smallcore team of professionals supported bylarge 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 stronglyinspired by libraries such as EventMachine (Ruby), Twisted (Python) andNode.js (V8).

This repository you're currently looking at is mostly used as a metarepository to discuss and plan all things @ReactPHP. See the individualcomponents linked below for more details about each component, itsdocumentation and source code.

Core Components

Network Components

Utility Components

Built with ReactPHP

  • ThruwayPHP Client and Router Library for Autobahn and WAMP (Web Application MessagingProtocol) for Real-Time Application Messagingvoryx/Thruway

  • PPM - PHP Process ManagerPPM is a process manager, supercharger and load balancer for modern PHPapplications.php-pm/php-pm

  • php-ar-drone🚁 Port of node-ar-drone which allows user to control a Parrot AR Drone overPHPjolicode/php-ar-drone

  • RatchetAsynchronous WebSocket serverratchetphp/Ratchet

  • Predis\AsyncAsynchronous PHP client library for Redis built on top of ReactPHPnrk/predis-async

  • clue/redis-serverA Redis server implementation in pure PHPclue/redis-server

And many more on our wiki page »

Articles

Talks

Getting started

ReactPHP consists of a set of individualcomponents.This means that instead of installing something like a "ReactPHP framework", you actuallypick only the components that you need.

This project followsSemVer for all its stable components.The recommended way to install these components isthrough Composer.New to Composer?

For example, this may look something like this:

# recommended install: pick required componentscomposer require react/event-loop react/http

As an alternative, we also provide a meta package that will install all stablecomponents at once. Installing this is only recommended for quick prototyping,as the list of stable components may change over time. This meta package can beinstalled like this:

# quick protoyping only: install all stable componentscomposer require react/react:^1.4

For more details, check outReactPHP's homepage forquickstart examples and usage details.

See also the combinedchangelog for all ReactPHP componentsfor details about version upgrades.

Support

Do you have a question and need help with ReactPHP? Don't worry, we're here to help!

As a first step, check the elaborate documentation that comes with eachcomponent (see links to individual documentation for each component above).If you find your question is not answered within the documentation, there's afair chance that it may be relevant to more people. Please do not hesitate tofile your question as an issue in the relevant component so others can alsoparticipate.

You can also check out our officialGitter chat room.Most of the people involved in this project are available in this chat room, so manyquestions get answered in a few minutes to some hours. We also use this chat roomto announce all new releases and ongoing development efforts, so considerstaying in this chat room for a little longer.

Also follow@reactphp on Twitter for updates.We use this mostly for noteworthy, bigger updates and to keep the communityupdated about ongoing development efforts. You can always use the#reactphphashtag 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 saythank you, want to report a security issue orwant to help sponsor a certain feature development, you can reach out to thecore team in private by sending an email tosupport@reactphp.org. Please keep inmind that we're a small team of volunteers and do our best to support anybodyreaching out.

Do you want to support ReactPHP? Awesome! Let's start with letting the the worldknow 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 orconference or even write a book. There are many ways you can help. You canalways reach out to us in private and help others in our support channels.Thank you!

Tests

To run the test suite, you first need to clone this repo and then install alldependenciesthrough Composer:

composer install

To run the test suite, go to the project root and run:

vendor/bin/phpunit

The test suite also contains a number of functional integration tests that relyon 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:

vendor/bin/phpunit --exclude-group internet

License

MIT, see LICENSE.

About

Event-driven, non-blocking I/O with PHP.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp