-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0f6813f
Showing
16 changed files
with
512 additions
and
0 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,2 @@ | ||
/tests export-ignore | ||
/.github 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
name: Release | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false |
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,68 @@ | ||
name: PHPUnit | ||
|
||
on: [ push, pull_request ] | ||
|
||
env: | ||
SWOOLE_VERSION: '5.1.1' | ||
SWOW_VERSION: 'v1.2.0' | ||
|
||
jobs: | ||
ci: | ||
name: Test PHP ${{ matrix.php-version }} on ${{ matrix.engine }} | ||
runs-on: "${{ matrix.os }}" | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
php-version: [ '8.1', '8.2', '8.3' ] | ||
engine: [ 'none', 'swoole', 'swow' ] | ||
max-parallel: 9 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
tools: phpize | ||
ini-values: opcache.enable_cli=0 | ||
coverage: none | ||
- name: Setup Swoole | ||
if: ${{ matrix.engine == 'swoole' }} | ||
run: | | ||
cd /tmp | ||
sudo apt-get update | ||
sudo apt-get install libcurl4-openssl-dev libc-ares-dev libpq-dev | ||
wget https://github.com/swoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz | ||
mkdir -p swoole | ||
tar -xf swoole.tar.gz -C swoole --strip-components=1 | ||
rm swoole.tar.gz | ||
cd swoole | ||
phpize | ||
./configure --enable-openssl --enable-swoole-curl --enable-cares --enable-swoole-pgsql | ||
make -j$(nproc) | ||
sudo make install | ||
sudo sh -c "echo extension=swoole > /etc/php/${{ matrix.php-version }}/cli/conf.d/swoole.ini" | ||
php --ri swoole | ||
- name: Setup Swow | ||
if: ${{ matrix.engine == 'swow' }} | ||
run: | | ||
cd /tmp | ||
wget https://github.com/swow/swow/archive/"${SWOW_VERSION}".tar.gz -O swow.tar.gz | ||
mkdir -p swow | ||
tar -xf swow.tar.gz -C swow --strip-components=1 | ||
rm swow.tar.gz | ||
cd swow/ext || exit | ||
phpize | ||
./configure --enable-swow --enable-swow-ssl --enable-swow-curl | ||
make -j "$(nproc)" | ||
sudo make install | ||
sudo sh -c "echo extension=swow > /etc/php/${{ matrix.php-version }}/cli/conf.d/swow.ini" | ||
php --ri swow | ||
- name: Setup Packages | ||
run: composer update -o --no-scripts | ||
- name: Run Test Cases | ||
run: | | ||
vendor/bin/php-cs-fixer fix --dry-run | ||
composer analyse | ||
composer test |
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,5 @@ | ||
/.idea | ||
/vendor/ | ||
composer.lock | ||
*.cache | ||
*.log |
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,96 @@ | ||
<?php | ||
|
||
$header = <<<'EOF' | ||
This file is part of Hyperf. | ||
@link https://www.hyperf.io | ||
@document https://hyperf.wiki | ||
@contact [email protected] | ||
@license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
EOF; | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PSR2' => true, | ||
'@Symfony' => true, | ||
'@DoctrineAnnotation' => true, | ||
'@PhpCsFixer' => true, | ||
'header_comment' => [ | ||
'comment_type' => 'PHPDoc', | ||
'header' => $header, | ||
'separate' => 'none', | ||
'location' => 'after_declare_strict', | ||
], | ||
'array_syntax' => [ | ||
'syntax' => 'short' | ||
], | ||
'list_syntax' => [ | ||
'syntax' => 'short' | ||
], | ||
'concat_space' => [ | ||
'spacing' => 'one' | ||
], | ||
'blank_line_before_statement' => [ | ||
'statements' => [ | ||
'declare', | ||
], | ||
], | ||
'general_phpdoc_annotation_remove' => [ | ||
'annotations' => [ | ||
'author' | ||
], | ||
], | ||
'ordered_imports' => [ | ||
'imports_order' => [ | ||
'class', 'function', 'const', | ||
], | ||
'sort_algorithm' => 'alpha', | ||
], | ||
'single_line_comment_style' => [ | ||
'comment_types' => [ | ||
], | ||
], | ||
'yoda_style' => [ | ||
'always_move_variable' => false, | ||
'equal' => false, | ||
'identical' => false, | ||
], | ||
'phpdoc_align' => [ | ||
'align' => 'left', | ||
], | ||
'multiline_whitespace_before_semicolons' => [ | ||
'strategy' => 'no_multi_line', | ||
], | ||
'constant_case' => [ | ||
'case' => 'lower', | ||
], | ||
'global_namespace_import' => [ | ||
'import_classes' => true, | ||
'import_constants' => true, | ||
'import_functions' => true, | ||
], | ||
'phpdoc_to_comment' => false, | ||
'class_attributes_separation' => true, | ||
'combine_consecutive_unsets' => true, | ||
'declare_strict_types' => true, | ||
'linebreak_after_opening_tag' => true, | ||
'lowercase_static_reference' => true, | ||
'no_useless_else' => true, | ||
'no_unused_imports' => true, | ||
'not_operator_with_successor_space' => true, | ||
'not_operator_with_space' => false, | ||
'ordered_class_elements' => true, | ||
'php_unit_strict' => false, | ||
'phpdoc_separation' => false, | ||
'single_quote' => true, | ||
'standardize_not_equals' => true, | ||
'multiline_comment_opening_closing' => true, | ||
'single_line_empty_body' => false, | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->exclude('vendor') | ||
->in(__DIR__) | ||
) | ||
->setUsingCache(false); |
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,6 @@ | ||
<?php | ||
|
||
namespace PHPSTORM_META { | ||
// Reflect | ||
override(\Psr\Container\ContainerInterface::get(0), map('@')); | ||
} |
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 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) Hyperf | ||
|
||
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,12 @@ | ||
# component-creator | ||
|
||
``` | ||
composer create-project hyperf/component-creator | ||
``` | ||
|
||
git init | ||
git add README.md | ||
git commit -m "first commit" | ||
git branch -M main | ||
git remote add origin [email protected]:Gemini-D/plt-common.git | ||
git push -u origin main |
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,54 @@ | ||
{ | ||
"name": "gemini-d/plt-common", | ||
"type": "library", | ||
"license": "MIT", | ||
"keywords": [ | ||
"php", | ||
"hyperf" | ||
], | ||
"description": "", | ||
"autoload": { | ||
"psr-4": { | ||
"GeminiD\\PltCommon\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"HyperfTest\\": "tests" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=8.1", | ||
"hyperf/config": "^3.1", | ||
"hyperf/event": "^3.1", | ||
"hyperf/framework": "^3.1", | ||
"hyperf/rpc-multiplex": "^3.1", | ||
"hyperf/support": "^3.1" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^3.0", | ||
"mockery/mockery": "^1.0", | ||
"phpstan/phpstan": "^1.0", | ||
"phpunit/phpunit": "^10.0", | ||
"swoole/ide-helper": "dev-master" | ||
}, | ||
"suggest": { | ||
"swow/swow": "Required to create swow components." | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"config": { | ||
"optimize-autoloader": true, | ||
"sort-packages": true | ||
}, | ||
"scripts": { | ||
"test": "phpunit -c phpunit.xml --colors=always", | ||
"analyse": "phpstan analyse --memory-limit 1024M -l 0 ./src", | ||
"cs-fix": "php-cs-fixer fix $1" | ||
}, | ||
"extra": { | ||
"hyperf": { | ||
"config": "GeminiD\\PltCommon\\ConfigProvider" | ||
} | ||
} | ||
} |
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,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
bootstrap="tests/bootstrap.php" | ||
backupGlobals="false" | ||
colors="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" | ||
cacheDirectory=".phpunit.cache" | ||
backupStaticProperties="false" | ||
> | ||
<testsuite name="Testsuite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace GeminiD\PltCommon; | ||
|
||
class ConfigProvider | ||
{ | ||
public function __invoke(): array | ||
{ | ||
return [ | ||
'annotations' => [ | ||
'scan' => [ | ||
'paths' => [ | ||
__DIR__, | ||
], | ||
], | ||
], | ||
]; | ||
} | ||
} |
Oops, something went wrong.