Skip to content

Commit 93b0bd9

Browse files
author
Vitalii Livandovskyi
committed
feat(hyperf-app-settings): Initialization of package;
0 parents  commit 93b0bd9

12 files changed

+305
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/tests export-ignore
2+
/.github export-ignore

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/.idea
2+
/vendor/
3+
composer.lock
4+
*.cache
5+
*.log

.php-cs-fixer.php

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
3+
$header = <<<'EOF'
4+
This file is part of Hyperf.
5+
6+
@link https://www.hyperf.io
7+
@document https://hyperf.wiki
8+
9+
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
10+
EOF;
11+
12+
return (new PhpCsFixer\Config())
13+
->setRiskyAllowed(true)
14+
->setRules([
15+
'@PSR2' => true,
16+
'@Symfony' => true,
17+
'@DoctrineAnnotation' => true,
18+
'@PhpCsFixer' => true,
19+
'header_comment' => [
20+
'comment_type' => 'PHPDoc',
21+
'header' => $header,
22+
'separate' => 'none',
23+
'location' => 'after_declare_strict',
24+
],
25+
'array_syntax' => [
26+
'syntax' => 'short'
27+
],
28+
'list_syntax' => [
29+
'syntax' => 'short'
30+
],
31+
'concat_space' => [
32+
'spacing' => 'one'
33+
],
34+
'blank_line_before_statement' => [
35+
'statements' => [
36+
'declare',
37+
],
38+
],
39+
'general_phpdoc_annotation_remove' => [
40+
'annotations' => [
41+
'author'
42+
],
43+
],
44+
'ordered_imports' => [
45+
'imports_order' => [
46+
'class', 'function', 'const',
47+
],
48+
'sort_algorithm' => 'alpha',
49+
],
50+
'single_line_comment_style' => [
51+
'comment_types' => [
52+
],
53+
],
54+
'yoda_style' => [
55+
'always_move_variable' => false,
56+
'equal' => false,
57+
'identical' => false,
58+
],
59+
'phpdoc_align' => [
60+
'align' => 'left',
61+
],
62+
'multiline_whitespace_before_semicolons' => [
63+
'strategy' => 'no_multi_line',
64+
],
65+
'constant_case' => [
66+
'case' => 'lower',
67+
],
68+
'class_attributes_separation' => true,
69+
'combine_consecutive_unsets' => true,
70+
'declare_strict_types' => true,
71+
'linebreak_after_opening_tag' => true,
72+
'lowercase_static_reference' => true,
73+
'no_useless_else' => true,
74+
'no_unused_imports' => true,
75+
'not_operator_with_successor_space' => true,
76+
'not_operator_with_space' => false,
77+
'ordered_class_elements' => true,
78+
'php_unit_strict' => false,
79+
'phpdoc_separation' => false,
80+
'single_quote' => true,
81+
'standardize_not_equals' => true,
82+
'multiline_comment_opening_closing' => true,
83+
])
84+
->setFinder(
85+
PhpCsFixer\Finder::create()
86+
->exclude('vendor')
87+
->in(__DIR__)
88+
)
89+
->setUsingCache(false);

.phpstorm.meta.php

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
namespace PHPSTORM_META {
4+
// Reflect
5+
override(\Psr\Container\ContainerInterface::get(0), map('@'));
6+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Hyperf
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Hyperf-app-settings component
2+
3+
Includes the following classes:
4+
5+
- Exception:
6+
- BusinessException.
7+
- Event:
8+
- Action.
9+
- Constants:
10+
- AppSettings;
11+
- ErrorCode;
12+
- Time.
13+
- DTO:
14+
- UpdateAppSettingDTO.
15+
- Model:
16+
- AppSetting;
17+
- User.
18+
- Repository:
19+
- AppSettingsRepository.
20+
- Service:
21+
- AppSettingsService.
22+
- UpdateAppSettingsService.
23+
24+
Install:
25+
```shell script
26+
composer require onix-systems-php/hyperf-app-settings
27+
```

composer.json

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"name": "onix-systems-php/hyperf-app-settings",
3+
"type": "extension",
4+
"license": "MIT",
5+
"keywords": [
6+
"php",
7+
"hyperf"
8+
],
9+
"description": "An extension that consists of settings for an application",
10+
"autoload": {
11+
"psr-4": {
12+
"OnixSystemsPHP\\HyperfAppSettings\\": "src/"
13+
}
14+
},
15+
"autoload-dev": {
16+
"psr-4": {
17+
"OnixSystemsPHP\\HyperfAppSettings\\Test\\": "tests"
18+
}
19+
},
20+
"require": {
21+
"php": ">=8.0",
22+
"ext-json": "*",
23+
"96qbhy/hyperf-auth": "^2.6",
24+
"fakerphp/faker": "^1.20",
25+
"onix-systems-php/hyperf-core": "^1.0",
26+
"hyperf-ext/mail": "^2.2",
27+
"hyperf/command": "^2.2|^3.0",
28+
"hyperf/config": "~2.2.0|^3.0",
29+
"hyperf/contract": "^2.2|^3.0",
30+
"hyperf/cache": "~2.2.0|^3.0",
31+
"hyperf/context": "^2.0.0|^3.0",
32+
"hyperf/database": "^2.2|^3.0",
33+
"hyperf/db-connection": "^2.2|^3.0",
34+
"hyperf/di": "^2.2|^3.0",
35+
"hyperf/framework": "^2.2|^3.0",
36+
"hyperf/filesystem": "^2.2|^3.0",
37+
"hyperf/http-server": "^2.2|^3.0",
38+
"hyperf/resource": "^2.2|^3.0",
39+
"hyperf/session": "^2.2|^3.0",
40+
"hyperf/testing": "^2.2|^3.0",
41+
"hyperf/validation": "^2.2|^3.0",
42+
"hyperf/utils": "^2.2|^3.0",
43+
"intervention/image": "^2.7",
44+
"yzen.dev/plain-to-class": "^1.0"
45+
},
46+
"require-dev": {
47+
"friendsofphp/php-cs-fixer": "^2.2|^3.0",
48+
"mockery/mockery": "^1.0",
49+
"phpstan/phpstan": "^1.0",
50+
"phpunit/phpunit": ">=7.0",
51+
"swoole/ide-helper": "^4.5"
52+
},
53+
"suggest": {
54+
"swow/swow": "Required to create swow components."
55+
},
56+
"minimum-stability": "dev",
57+
"prefer-stable": true,
58+
"config": {
59+
"optimize-autoloader": true,
60+
"sort-packages": true
61+
},
62+
"scripts": {
63+
"test": "phpunit -c phpunit.xml --colors=always",
64+
"analyse": "phpstan analyse --memory-limit 1024M -l 0 ./src",
65+
"cs-fix": "php-cs-fixer fix $1"
66+
},
67+
"extra": {
68+
"hyperf": {
69+
"config": "OnixSystemsPHP\\HyperfAppSettings\\ConfigProvider"
70+
}
71+
}
72+
}

phpunit.xml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="tests/bootstrap.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
verbose="true"
6+
colors="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuite name="Testsuite">
13+
<directory>./tests/</directory>
14+
</testsuite>
15+
</phpunit>

src/ConfigProvider.php

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of Hyperf.
6+
*
7+
* @link https://www.hyperf.io
8+
* @document https://doc.hyperf.io
9+
* @contact [email protected]
10+
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
11+
*/
12+
namespace OnixSystemsPHP\HyperfAppSettings;
13+
14+
class ConfigProvider
15+
{
16+
public function __invoke(): array
17+
{
18+
return [
19+
'dependencies' => [
20+
],
21+
'commands' => [
22+
],
23+
'annotations' => [
24+
'scan' => [
25+
'paths' => [
26+
__DIR__,
27+
],
28+
],
29+
],
30+
];
31+
}
32+
}

tests/Cases/AbstractTestCase.php

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace OnixSystemsPHP\HyperfAppSettings\Test\Cases;
6+
7+
use PHPUnit\Framework\TestCase;
8+
9+
/**
10+
* Class AbstractTestCase.
11+
*/
12+
abstract class AbstractTestCase extends TestCase
13+
{
14+
}

tests/Cases/ExampleTest.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace OnixSystemsPHP\HyperfAppSettings\Test\Cases;
6+
7+
/**
8+
* @internal
9+
* @coversNothing
10+
*/
11+
class ExampleTest extends AbstractTestCase
12+
{
13+
public function testExample()
14+
{
15+
$this->assertTrue(true);
16+
}
17+
}

tests/bootstrap.php

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
require_once dirname(dirname(__FILE__)) . '/vendor/autoload.php';

0 commit comments

Comments
 (0)