From 425bda073c6ab5071cf5d6c1ed7d98202f902cbf Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Sat, 11 Oct 2014 00:21:05 +0200 Subject: [PATCH] Sockets usage --- README.md | 20 +++++++++++++++++++- composer.json | 3 ++- composer.lock | 20 +++++++------------- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index a97683d8d..ef5a97523 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,27 @@ Actually we supports two adapters ### Using UDP/IP Adapter -Actually "socket" php library is used for UDP/IP adapter +In order to use the UDP/IP adapter your must have PHP compiled with the `sockets` extension. + +To verify if you have the `sockets` extension just issue a: + +```bash +php -m | grep sockets ``` + +If you don't have the `sockets` extension, you can proceed in two ways: + +- Recompile your PHP whith the `--enable-sockets` flag +- Or just compile the `sockets` extension extracting it from the PHP source. + 1. Download the source relative to the PHP version that you on from [here](https://github.com/php/php-src/releases) + 2. Enter in the `ext/sockets` directory + 3. Issue a `phpize && ./configure && make -j && sudo make install` + 4. Add `extension=sockets.so` to your php.ini + +**Usage** + +```php $options = new Options(); $adapter = new UdpAdapter($options); diff --git a/composer.json b/composer.json index 9d09071c1..729eaa9d9 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ "require-dev": { "phpspec/phpspec": "2.*", "phpunit/phpunit": "4.*", - "athletic/athletic": "~0.1" + "athletic/athletic": "~0.1", + "ext-sockets": "*" }, "homepage": "http://www.corley.it/", "keywords": ["influxdb", "udp", "sdk"], diff --git a/composer.lock b/composer.lock index 5e318be9e..da029aebb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "ff63d84450d0ba675f2231b385344e9a", + "hash": "b8984634251cdc10c12d585b63e98fbd", "packages": [ { "name": "guzzlehttp/guzzle", @@ -1627,18 +1627,12 @@ "time": "2013-05-29 02:35:23" } ], - "aliases": [ - - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": [ - - ], + "stability-flags": [], "prefer-stable": false, - "platform": [ - - ], - "platform-dev": [ - - ] + "platform": [], + "platform-dev": { + "ext-sockets": "*" + } }