diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2125666 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..51cd273 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.idea +vendor +composer.lock +composer.phar \ No newline at end of file diff --git a/.noninteractive b/.noninteractive new file mode 100644 index 0000000..e69de29 diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 0000000..4e1a7ea --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,119 @@ +filter: + excluded_paths: + - 'test/*' + - 'vendor/*' +checks: + php: + return_doc_comments: true + remove_extra_empty_lines: true + +coding_style: + php: + indentation: + general: + use_tabs: false + size: 4 + switch: + indent_case: true + spaces: + general: + linefeed_character: newline + before_parentheses: + function_declaration: false + closure_definition: false + function_call: false + if: true + for: true + while: true + switch: true + catch: true + array_initializer: false + around_operators: + assignment: true + logical: true + equality: true + relational: true + bitwise: true + additive: true + multiplicative: true + shift: true + unary_additive: false + concatenation: true + negation: false + before_left_brace: + class: true + function: true + if: true + else: true + for: true + while: true + do: true + switch: true + try: true + catch: true + finally: true + before_keywords: + else: true + while: true + catch: true + finally: true + within: + brackets: false + array_initializer: false + grouping: false + function_call: false + function_declaration: false + if: false + for: false + while: false + switch: false + catch: false + type_cast: false + ternary_operator: + before_condition: true + after_condition: true + before_alternative: true + after_alternative: true + in_short_version: false + other: + before_comma: false + after_comma: true + before_semicolon: false + after_semicolon: true + after_type_cast: true + braces: + classes_functions: + class: new-line + function: new-line + closure: end-of-line + if: + opening: new-line + always: false + else_on_new_line: true + for: + opening: new-line + always: true + while: + opening: new-line + always: true + do_while: + opening: new-line + always: true + while_on_new_line: true + switch: + opening: new-line + try: + opening: new-line + catch_on_new_line: true + finally_on_new_line: true + upper_lower_casing: + keywords: + general: lower + constants: + true_false_null: lower + +tools: + external_code_coverage: + timeout: 1800 + runs: 1 + php_code_coverage: false \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7d3558d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +language: php + +dist: trusty +sudo: required + +php: + - 5.6 + - 7.0.20 + - 7.1 + +before_install: + - export PHP_MAJOR="$(echo $TRAVIS_PHP_VERSION | cut -d '.' -f 1,2)" + +install: + - travis_retry composer self-update + - travis_retry composer install --prefer-source --no-interaction --ignore-platform-reqs + - php -m + +script: + - vendor/bin/phpunit -d memory_limit=1024M --coverage-text --coverage-clover=coverage.clover + +after_script: + - if [ "$TRAVIS_PHP_VERSION" = "7.1" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi + - if [ "$TRAVIS_PHP_VERSION" = "7.1" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2a138d1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# Release Notes + +This changelog references the relevant changes, bug and security fixes done. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ea7a9d7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Contributing + +Contributions are **welcome** and accepted via **Pull Requests** on [GitHub](https://github.com/dazzle-php/throwable). + +## Pull Requests + +- **Naming convention** - all pull requests fixing a problem should match "Fix #issue Message" pattern, the new features and non-fix changes should match "Resolve #issue Message", the rest should contain only "Message". +- **Follow our template of code** - all contributions have to follow [PSR-2 coding standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) with an exception of control structures, which have to have opening parenthesis always placed in the next line instead of the same. +- **Add tests** - the contribution won't be accepted if it doesn't have tests. +- **Document any change in behaviour** - make sure the `README.md` is kept up to date. +- **Create feature branches** - don't create pull requests from your master branch. +- **One pull request per feature** - for multiple things that you want to do, send also multiple pull requests. +- **Keep coherent history** - make sure each individual commit in your pull request is meaningful. If you had to make multiple commits during development cycle, please squash them before submitting. + +## Running Tests + +``` +$> vendor/bin/phpunit +``` diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fdde115 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015-2017 Kamil Jamróz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c06f78a --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +# Dazzle Async ZMQ Channel + +[![Build Status](https://travis-ci.org/dazzle-php/channel-zmq.svg)](https://travis-ci.org/dazzle-php/channel-zmq) +[![Code Coverage](https://scrutinizer-ci.com/g/dazzle-php/channel-zmq/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/dazzle-php/channel-zmq/?branch=master) +[![Code Quality](https://scrutinizer-ci.com/g/dazzle-php/channel-zmq/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dazzle-php/channel-zmq/?branch=master) +[![Latest Stable Version](https://poser.pugx.org/dazzle-php/channel-zmq/v/stable)](https://packagist.org/packages/dazzle-php/channel-zmq) +[![Latest Unstable Version](https://poser.pugx.org/dazzle-php/channel-zmq/v/unstable)](https://packagist.org/packages/dazzle-php/channel-zmq) +[![License](https://poser.pugx.org/dazzle-php/channel-zmq/license)](https://packagist.org/packages/dazzle-php/channel-zmq/license) + +
+

+ +

+ +## Description + +Dazzle Channel-ZMQ is a component that uses asynchronous ZMQ bindings to implement transport model for Dazzle Channel. + +## Feature Highlights + +Dazzle Channel-ZMQ features: + +* Channel model implementation using ZMQ bindings, +* Heartbeat mechanism, +* Reconnect mechanism, +* Event-based & Promise-based API, +* ...and more. + +## Requirements + +* PHP-5.6 or PHP-7.0+, +* UNIX or Windows OS. + +## Installation + +``` +$> composer require dazzle-php/channel-zmq +``` + +## Tests + +``` +$> vendor/bin/phpunit -d memory_limit=1024M +``` + +## Contributing + +Thank you for considering contributing to this repository! The contribution guide can be found in the [contribution tips][1]. + +## License + +Dazzle Framework is open-sourced software licensed under the [MIT license][2]. + +[1]: https://github.com/dazzle-php/channel-zmq/blob/master/CONTRIBUTING.md +[2]: http://opensource.org/licenses/MIT diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..43baa50 --- /dev/null +++ b/composer.json @@ -0,0 +1,47 @@ +{ + "name": "dazzle-php/channel-zmq", + "description": "Dazzle Asynchronous ZMQ Channel.", + "keywords": [ + "dazzle", "dazzle-php", "ipc", "inter", "inter-process", "async", "asynchronous", "routing", "router", "message-driven", "message", "service", "service-oriented", "soa", "channel" + ], + "license": "MIT", + "support": { + "issues": "https://github.com/dazzle-php/channel-zmq/issues", + "source": "https://github.com/dazzle-php/channel-zmq" + }, + "authors": [ + { + "name": "Kamil Jamroz", + "homepage": "https://github.com/khelle" + }, + { + "name": "The contributors", + "homepage": "http://github.com/dazzle-php/channel-zmq/contributors" + } + ], + "require": { + "php": ">=5.6.7", + "dazzle-php/channel": "0.5.*", + "dazzle-php/event": "0.5.*", + "dazzle-php/loop": "0.5.*", + "dazzle-php/throwable": "0.5.*", + "dazzle-php/util": "0.5.*", + "dazzle-php/zmq": "0.5.*" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8.0 <5.4.0" + }, + "autoload": { + "psr-4": { + "Dazzle\\ChannelZmq\\": "src/Channel-Zmq", + "Dazzle\\ChannelZmq\\Test\\": "test" + } + }, + "extra": { + "branch-alias": { + "dev-master": "0.5-dev" + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..d445af9 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,33 @@ + + + + + + test/TModule + + + + test/TUnit + + + + + + src + + +