Skip to content

Commit 86557cb

Browse files
committed
initial commit
0 parents  commit 86557cb

File tree

15 files changed

+3612
-0
lines changed

15 files changed

+3612
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.gitignore merge=ours
2+
* text eol=lf

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
vendor/
2+
.php-cs-fixer.cache
3+
tests.config.php
4+
.phpunit.result.cache
5+
composer.lock

.php-cs-fixer.php

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->exclude(__DIR__ . '/vendor')
5+
->ignoreVCSIgnored(true)
6+
->in(__DIR__ . '/src');
7+
8+
$config = new PhpCsFixer\Config();
9+
10+
return $config
11+
->setRiskyAllowed(true)
12+
->setIndent(str_pad('', 4))
13+
->setRules([
14+
'align_multiline_comment' => ['comment_type' => 'phpdocs_like'],
15+
'array_indentation' => true,
16+
'array_push' => true,
17+
'array_syntax' => true,
18+
'binary_operator_spaces' => ['default' => 'align_single_space_minimal'],
19+
'blank_line_after_namespace' => true,
20+
'blank_line_after_opening_tag' => true,
21+
'blank_line_before_statement' => true,
22+
'blank_line_between_import_groups' => true,
23+
'braces' => ['allow_single_line_anonymous_class_with_empty_body' => true],
24+
'cast_spaces' => true,
25+
'class_attributes_separation' => true,
26+
'class_definition' => true,
27+
'class_reference_name_casing' => true,
28+
'clean_namespace' => true,
29+
'combine_consecutive_issets' => true,
30+
'combine_consecutive_unsets' => true,
31+
'comment_to_phpdoc' => true,
32+
'concat_space' => ['spacing' => 'one'],
33+
'constant_case' => true,
34+
'control_structure_braces' => true,
35+
'control_structure_continuation_position' => true,
36+
'curly_braces_position' => true,
37+
'dir_constant' => true,
38+
'elseif' => true,
39+
'empty_loop_body' => true,
40+
'empty_loop_condition' => true,
41+
'encoding' => true,
42+
'ereg_to_preg' => true,
43+
'explicit_indirect_variable' => true,
44+
'explicit_string_variable' => true,
45+
'function_declaration' => true,
46+
'function_to_constant' => true,
47+
'global_namespace_import' => ['import_constants' => false, 'import_functions' => false, 'import_classes' => true],
48+
'group_import' => false,
49+
'include' => true,
50+
'indentation_type' => true,
51+
'integer_literal_case' => true,
52+
'line_ending' => true,
53+
'linebreak_after_opening_tag' => true,
54+
'lowercase_cast' => true,
55+
'lowercase_keywords' => true,
56+
'lowercase_static_reference' => true,
57+
'magic_constant_casing' => true,
58+
'magic_method_casing' => true,
59+
'method_chaining_indentation' => true,
60+
'multiline_comment_opening_closing' => true,
61+
'multiline_whitespace_before_semicolons' => true,
62+
'native_function_casing' => true,
63+
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
64+
'new_with_braces' => true,
65+
'no_alias_language_construct_call' => true,
66+
'no_alternative_syntax' => true,
67+
'no_binary_string' => true,
68+
'no_blank_lines_after_class_opening' => true,
69+
'no_blank_lines_after_phpdoc' => true,
70+
'no_break_comment' => true,
71+
'no_closing_tag' => true,
72+
'no_empty_phpdoc' => true,
73+
'no_empty_statement' => true,
74+
'no_extra_blank_lines' => true,
75+
'no_leading_import_slash' => true,
76+
'no_leading_namespace_whitespace' => true,
77+
'no_multiple_statements_per_line' => true,
78+
'no_null_property_initialization' => true,
79+
'no_short_bool_cast' => true,
80+
'no_singleline_whitespace_before_semicolons' => true,
81+
'no_space_around_double_colon' => true,
82+
'no_spaces_after_function_name' => true,
83+
'no_spaces_around_offset' => true,
84+
'no_trailing_comma_in_singleline' => true,
85+
'no_trailing_whitespace' => true,
86+
'no_trailing_whitespace_in_comment' => true,
87+
'no_unneeded_control_parentheses' => true,
88+
'no_unneeded_curly_braces' => true,
89+
'no_unneeded_import_alias' => true,
90+
'no_unused_imports' => true,
91+
'no_useless_else' => true,
92+
'no_useless_return' => true,
93+
'no_whitespace_in_blank_line' => true,
94+
'no_spaces_inside_parenthesis' => true,
95+
'object_operator_without_whitespace' => true,
96+
'operator_linebreak' => true,
97+
'ordered_class_elements' => true,
98+
'ordered_imports' => true,
99+
'php_unit_internal_class' => true,
100+
'php_unit_method_casing' => true,
101+
'php_unit_test_class_requires_covers' => true,
102+
'phpdoc_add_missing_param_annotation' => true,
103+
'phpdoc_align' => true,
104+
'phpdoc_indent' => true,
105+
'phpdoc_line_span' => true,
106+
'phpdoc_no_package' => true,
107+
'phpdoc_no_useless_inheritdoc' => true,
108+
'phpdoc_order' => true,
109+
'phpdoc_return_self_reference' => true,
110+
'phpdoc_scalar' => true,
111+
'phpdoc_separation' => true,
112+
'phpdoc_tag_casing' => true,
113+
'phpdoc_tag_type' => true,
114+
'phpdoc_trim' => true,
115+
'phpdoc_trim_consecutive_blank_line_separation' => true,
116+
'phpdoc_types' => true,
117+
'random_api_migration' => true,
118+
'return_assignment' => true,
119+
'simplified_if_return' => true,
120+
'simplified_null_return' => true,
121+
'single_blank_line_at_eof' => true,
122+
'single_blank_line_before_namespace' => true,
123+
'single_class_element_per_statement' => true,
124+
'single_line_after_imports' => true,
125+
'single_line_comment_spacing' => true,
126+
'single_line_comment_style' => true,
127+
'single_line_throw' => true,
128+
'single_quote' => true,
129+
'single_space_after_construct' => true,
130+
'standardize_increment' => true,
131+
'standardize_not_equals' => true,
132+
'statement_indentation' => true,
133+
'switch_continue_to_break' => true,
134+
'ternary_operator_spaces' => true,
135+
])
136+
->setFinder($finder);

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"junstyle.php-cs-fixer",
4+
"bmewburn.vscode-intelephense-client"
5+
]
6+
}

.vscode/settings.json

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"php-cs-fixer.onsave": true,
3+
"php-cs-fixer.executablePath": "${workspaceFolder}/vendor/bin/php-cs-fixer",
4+
"php-cs-fixer.documentFormattingProvider": true,
5+
"php-cs-fixer.executablePathWindows": "${workspaceFolder}\\vendor\\bin\\php-cs-fixer.bat",
6+
"php-cs-fixer.config": ".php-cs-fixer.php",
7+
"search.useGlobalIgnoreFiles": false,
8+
"search.useParentIgnoreFiles": false,
9+
"prettier.enable": true,
10+
"editor.defaultFormatter": "esbenp.prettier-vscode",
11+
"editor.formatOnSave": true,
12+
"editor.codeActionsOnSave": {
13+
"source.fixAll.eslint": true
14+
},
15+
"stylelint.snippet": ["css", "scss"],
16+
"stylelint.validate": ["css", "scss", "postcss"],
17+
"files.eol": "\n",
18+
"search.exclude": {
19+
"**/.git": true,
20+
"**/.github": true,
21+
"**/.nuxt": true,
22+
"**/.output": true,
23+
"**/.pnpm": true,
24+
"**/.vscode": true,
25+
"**/.yarn": true,
26+
"**/bower_components": true,
27+
"**/dist/**": true,
28+
"**/logs": true,
29+
"**/node_modules": true,
30+
"**/out/**": true,
31+
"**/package-lock.json": true,
32+
"**/pnpm-lock.yaml": true,
33+
"**/tmp": true,
34+
"**/yarn.lock": true
35+
},
36+
"typescript.tsdk": "node_modules\\typescript\\lib",
37+
"css.lint.validProperties": ["composes"],
38+
"cSpell.words": [
39+
"antd",
40+
"autoload",
41+
"bitapps",
42+
"commitlint",
43+
"compat",
44+
"cssinjs",
45+
"dealerdirect",
46+
"friendsofphp",
47+
"immer",
48+
"incstr",
49+
"intelephense",
50+
"lefthook",
51+
"Lucide",
52+
"phpcodesniffer",
53+
"phpcompatibility",
54+
"phpcs",
55+
"phpunit",
56+
"pnpm",
57+
"Popconfirm",
58+
"Sider",
59+
"sirbrillig",
60+
"stylelint",
61+
"testdox",
62+
"yoast"
63+
],
64+
"[typescript, javascript, typescriptreact, json, css]": {
65+
"editor.defaultFormatter": "esbenp.prettier-vscode"
66+
},
67+
"[php]": {
68+
"editor.defaultFormatter": "junstyle.php-cs-fixer"
69+
}
70+
}

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
### WPKit/Database
2+
3+
---
4+
5+
# usage
6+
7+
1. Add this repository in composer.json
8+
9+
```
10+
"repositories": [
11+
{
12+
"type": "vcs",
13+
"url": "https://github.com/Bit-Apps-Pro/wp-database"
14+
}
15+
]
16+
```
17+
18+
2. Then install the package
19+
20+
```
21+
composer require bitapps/wp-database:dev-main
22+
```

composer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "bitapps/wp-database",
3+
"version": "1.0.0",
4+
"description": "A wpdb wrapper",
5+
"license": "gpl-2",
6+
"archive": {
7+
"exclude": [
8+
".gitattributes",
9+
".gitignore",
10+
"lefthook.yml",
11+
".php-cs-fixer.php",
12+
"composer.lock"
13+
]
14+
},
15+
"autoload": {
16+
"psr-4": {
17+
"BitApps\\WPDatabase\\": "./src"
18+
}
19+
},
20+
"scripts": {
21+
"lint": "./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php",
22+
"compat": "./vendor/bin/phpcs -p ./src --standard=PHPCompatibilityWP --runtime-set testVersion 7.4-"
23+
},
24+
"require-dev": {
25+
"friendsofphp/php-cs-fixer": "^3.10",
26+
"sirbrillig/phpcs-variable-analysis": "*",
27+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
28+
"phpcompatibility/phpcompatibility-wp": "*"
29+
},
30+
"config": {
31+
"allow-plugins": {
32+
"dealerdirect/phpcodesniffer-composer-installer": true
33+
}
34+
}
35+
}

lefthook.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pre-commit:
2+
# piped: true
3+
parallel: true
4+
commands:
5+
php-lint:
6+
glob: "*.{php}"
7+
run: composer lint {staged_files}
8+
php-compatibility:
9+
glob: "src/**/*.php"
10+
run: composer compat {staged_files}

0 commit comments

Comments
 (0)