-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from roadrunner-php/feature/refactoring
Code refactoring
- Loading branch information
Showing
15 changed files
with
478 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
/tests export-ignore | ||
/.github export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/tests export-ignore | ||
/.editorconfig export-ignore | ||
/.php_cs.dist.php export-ignore | ||
/psalm.xml export-ignore | ||
/psalm.xml.dist export-ignore | ||
/UPGRADING.md export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- 1.* | ||
|
||
name: phpunit | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- 1.* | ||
|
||
name: static analysis | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,11 @@ | ||
# IDEA | ||
.idea/ | ||
*.iml | ||
|
||
# Composer | ||
composer.phar | ||
vendor | ||
composer.lock | ||
|
||
# OS | ||
.DS_Store | ||
Thumbs.db | ||
*.exe | ||
|
||
# Other | ||
.phpunit.result.cache | ||
.idea | ||
.php_cs | ||
.php_cs.cache | ||
clover.xml | ||
.env | ||
builds | ||
|
||
.phpunit.result.cache | ||
build | ||
composer.lock | ||
coverage | ||
docs | ||
vendor | ||
node_modules | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
preset: psr12 | ||
risky: true | ||
|
||
version: 8 | ||
|
||
enabled: | ||
- alpha_ordered_traits | ||
- array_indentation | ||
- array_push | ||
- combine_consecutive_issets | ||
- combine_consecutive_unsets | ||
- combine_nested_dirname | ||
- declare_strict_types | ||
- dir_constant | ||
- fully_qualified_strict_types | ||
- function_to_constant | ||
- is_null | ||
- magic_constant_casing | ||
- magic_method_casing | ||
- method_separation | ||
- modernize_types_casting | ||
- native_function_casing | ||
- native_function_type_declaration_casing | ||
- no_alias_functions | ||
- no_empty_comment | ||
- no_empty_phpdoc | ||
- no_empty_statement | ||
- no_extra_block_blank_lines | ||
- no_short_bool_cast | ||
- no_superfluous_elseif | ||
- no_unneeded_control_parentheses | ||
- no_unneeded_curly_braces | ||
- no_unneeded_final_method | ||
- no_unset_cast | ||
- no_unused_imports | ||
- no_unused_lambda_imports | ||
- no_useless_else | ||
- no_useless_return | ||
- normalize_index_brace | ||
- php_unit_dedicate_assert | ||
- php_unit_dedicate_assert_internal_type | ||
- php_unit_expectation | ||
- php_unit_mock | ||
- php_unit_mock_short_will_return | ||
- php_unit_namespaced | ||
- php_unit_no_expectation_annotation | ||
- phpdoc_no_empty_return | ||
- phpdoc_no_useless_inheritdoc | ||
- phpdoc_order | ||
- phpdoc_property | ||
- phpdoc_scalar | ||
- phpdoc_separation | ||
- phpdoc_singular_inheritdoc | ||
- phpdoc_trim | ||
- phpdoc_trim_consecutive_blank_line_separation | ||
- phpdoc_type_to_var | ||
- phpdoc_types | ||
- phpdoc_types_order | ||
- print_to_echo | ||
- regular_callable_call | ||
- return_assignment | ||
- self_accessor | ||
- self_static_accessor | ||
- set_type_to_cast | ||
- short_array_syntax | ||
- short_list_syntax | ||
- simplified_if_return | ||
- single_quote | ||
- standardize_not_equals | ||
- ternary_to_null_coalescing | ||
- trailing_comma_in_multiline_array | ||
- unalign_double_arrow | ||
- unalign_equals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Spiral Scout | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# RoadRunner Lock Integration for Symfony | ||
|
||
[![PHP Version Require](https://poser.pugx.org/roadrunner-php/symfony-lock-driver/require/php)](https://packagist.org/packages/roadrunner-php/symfony-lock-driver) | ||
[![Latest Stable Version](https://poser.pugx.org/roadrunner-php/symfony-lock-driver/v/stable)](https://packagist.org/packages/roadrunner-php/symfony-lock-driver) | ||
[![phpunit](https://github.com/roadrunner-php/symfony-lock-driver/actions/workflows/phpunit.yml/badge.svg)](https://github.com/roadrunner-php/symfony-lock-driver/actions) | ||
[![psalm](https://github.com/roadrunner-php/symfony-lock-driver/actions/workflows/psalm.yml/badge.svg)](https://github.com/roadrunner-php/symfony-lock-driver/actions) | ||
[![Codecov](https://codecov.io/gh/roadrunner-php/symfony-lock-driver/branch/master/graph/badge.svg)](https://codecov.io/gh/roadrunner-php/symfony-lock-driver/) | ||
[![Total Downloads](https://poser.pugx.org/roadrunner-php/symfony-lock-driver/downloads)](https://packagist.org/roadrunner-php/symfony-lock-driver/phpunit) | ||
<a href="https://discord.gg/8bZsjYhVVk"><img src="https://img.shields.io/badge/discord-chat-magenta.svg"></a> | ||
|
||
This package is a bridge that connects the powerful RoadRunner Lock plugin with the Symfony Lock component. It's | ||
designed to help you easily manage distributed locks in your PHP applications, particularly when you're working with | ||
high-traffic web applications and microservices. | ||
|
||
## Requirements | ||
|
||
Make sure that your server is configured with following PHP version and extensions: | ||
|
||
- PHP 8.1+ | ||
|
||
## Installation | ||
|
||
You can install the package via composer: | ||
|
||
```bash | ||
composer require roadrunner-php/symfony-lock-driver | ||
|
||
``` | ||
|
||
## Usage | ||
|
||
Using the RoadRunner Lock with Symfony is straightforward. Here's a simple example: | ||
|
||
```php | ||
use RoadRunner\Lock\Lock; | ||
use Spiral\Goridge\RPC\RPC; | ||
use Spiral\RoadRunner\Symfony\Lock\RoadRunnerStore; | ||
use Symfony\Component\Lock\LockFactory; | ||
|
||
require __DIR__ . '/vendor/autoload.php'; | ||
|
||
$lock = new Lock(RPC::create('tcp://127.0.0.1:6001')); | ||
$factory = new LockFactory( | ||
new RoadRunnerStore($lock) | ||
); | ||
``` | ||
|
||
Read more about using Symfony Lock component [here](https://symfony.com/doc/current/components/lock.html). | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! If you find an issue or have a feature request, please open | ||
an [issue](https://github.com/roadrunner-php/issues) or submit a pull request. | ||
|
||
## Credits | ||
|
||
- [gam6itko](https://github.com/gam6itko) | ||
- [butschster](https://github.com/butschster) | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,68 @@ | ||
{ | ||
"name": "roadrunner-php/symfony-lock-driver", | ||
"type": "library", | ||
"description": "RoadRunner: symfony/lock bridge", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Pavel Buchnev (butschster)", | ||
"email": "[email protected]" | ||
"name": "roadrunner-php/symfony-lock-driver", | ||
"type": "library", | ||
"description": "RoadRunner: symfony/lock bridge", | ||
"keywords": [ | ||
"roadrunner-php", | ||
"symfony", | ||
"roadrunner", | ||
"spiral", | ||
"lock" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Pavel Buchnev (butschster)", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Alexander Strizhak", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"homepage": "https://spiral.dev/", | ||
"support": { | ||
"docs": "https://roadrunner.dev/docs", | ||
"issues": "https://github.com/roadrunner-server/roadrunner/issues", | ||
"forum": "https://forum.roadrunner.dev/", | ||
"chat": "https://discord.gg/V6EK4he" | ||
}, | ||
{ | ||
"name": "Alexander Strizhak", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"homepage": "https://spiral.dev/", | ||
"support": { | ||
"docs": "https://roadrunner.dev/docs", | ||
"issues": "https://github.com/roadrunner-server/roadrunner/issues", | ||
"forum": "https://forum.roadrunner.dev/", | ||
"chat": "https://discord.gg/V6EK4he" | ||
}, | ||
"require": { | ||
"php": ">=8.1", | ||
"roadrunner-php/lock": "^1.0", | ||
"symfony/lock": "^6.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^10.0", | ||
"vimeo/psalm": "^5.9" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Spiral\\RoadRunner\\Symfony\\Lock\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Spiral\\RoadRunner\\Symfony\\Lock\\Tests\\": "tests" | ||
} | ||
}, | ||
"funding": [ | ||
{ | ||
"type": "github", | ||
"url": "https://github.com/sponsors/roadrunner-server" | ||
} | ||
], | ||
"scripts": { | ||
"analyze": "psalm" | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-main": "1.0-dev" | ||
"require": { | ||
"php": ">=8.1", | ||
"roadrunner-php/lock": "^1.0", | ||
"symfony/lock": "^6.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^10.0", | ||
"vimeo/psalm": "^5.9" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Spiral\\RoadRunner\\Symfony\\Lock\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Spiral\\RoadRunner\\Symfony\\Lock\\Tests\\": "tests" | ||
} | ||
}, | ||
"funding": [ | ||
{ | ||
"type": "github", | ||
"url": "https://github.com/sponsors/roadrunner-server" | ||
} | ||
], | ||
"scripts": { | ||
"analyze": "psalm" | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-main": "1.0-dev" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.