Skip to content

Commit

Permalink
Merge branch 'refs/heads/standalone'
Browse files Browse the repository at this point in the history
  • Loading branch information
cboden committed May 25, 2014
2 parents 8cac929 + 4b64274 commit a6acf40
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
composer.lock
vendor
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- hhvm

matrix:
allow_failures:
- php: hhvm

before_script:
- composer install --dev --prefer-source
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Socket Component

[![Build Status](https://secure.travis-ci.org/reactphp/socket.png?branch=master)](http://travis-ci.org/reactphp/socket)

Library for building an evented socket server.

The socket component provides a more usable interface for a socket-layer
Expand All @@ -18,7 +20,7 @@ or in a client context.
## Usage

Here is a server that closes the connection if you send it anything.

```php
$loop = React\EventLoop\Factory::create();

$socket = new React\Socket\Server($loop);
Expand All @@ -34,15 +36,15 @@ Here is a server that closes the connection if you send it anything.
$socket->listen(1337);

$loop->run();

```
You can change the host the socket is listening on through a second parameter
provided to the listen method:

```php
$socket->listen(1337, '192.168.0.1');

```
Here's a client that outputs the output of said server and then attempts to
send it a string.

```php
$loop = React\EventLoop\Factory::create();

$client = stream_socket_client('tcp://127.0.0.1:1337');
Expand All @@ -51,3 +53,4 @@ send it a string.
$conn->write("Hello World!\n");

$loop->run();
```
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"react/stream": "0.4.*"
},
"autoload": {
"psr-4": { "React\\Socket\\": "" }
"psr-4": {
"React\\Socket\\": "src"
}
},
"extra": {
"branch-alias": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

$loader = @include __DIR__ . '/../vendor/autoload.php';
if (!$loader) {
$loader = require __DIR__ . '/../../../vendor/autoload.php';
$loader = require __DIR__ . '/../../../../vendor/autoload.php';
}
$loader->addPsr4('React\\Tests\\Socket\\', __DIR__);

0 comments on commit a6acf40

Please sign in to comment.