Skip to content

Commit 892c559

Browse files
authored
Initial commit
0 parents  commit 892c559

File tree

13 files changed

+302
-0
lines changed

13 files changed

+302
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_size = 4
6+
indent_style = space
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.github export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/tests export-ignore
10+
/.editorconfig export-ignore
11+
/.php_cs.dist export-ignore
12+
/psalm.xml export-ignore
13+
/psalm.xml.dist export-ignore
14+
/testbench.yaml export-ignore

.github/workflows/analyse.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: analyse
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
phpstan:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: 8.2
21+
22+
- name: Cache Composer packages
23+
id: composer-cache
24+
uses: actions/cache@v2
25+
with:
26+
path: vendor
27+
key: ${{ runner.os }}-php-8.2-${{ hashFiles('**/composer.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-php-8.2-
30+
- name: Install dependencies
31+
if: steps.composer-cache.outputs.cache-hit != 'true'
32+
run: |
33+
composer install
34+
composer dump
35+
36+
- name: Run analyse phpstan
37+
run: vendor/bin/phpstan analyse --error-format github

.github/workflows/fix_style.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Fix Styles
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
style:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Setup PHP
15+
uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: 8.2
18+
19+
- name: Cache Composer packages
20+
id: composer-cache
21+
uses: actions/cache@v3
22+
with:
23+
path: vendor
24+
key: ${{ runner.os }}-php-8.2-${{ hashFiles('**/composer.lock') }}
25+
restore-keys: |
26+
${{ runner.os }}-php-8.2
27+
- name: Install dependencies
28+
if: steps.composer-cache.outputs.cache-hit != 'true'
29+
run: |
30+
composer install
31+
composer dump
32+
- name: Fix styles
33+
run: vendor/bin/php-cs-fixer fix
34+
35+
- name: Run style
36+
run: vendor/bin/php-cs-fixer fix --dry-run --diff --format junit
37+
38+
- uses: EndBug/add-and-commit@v9

.github/workflows/test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
phpunit:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
php: [8.2, 8.1, 8.0]
17+
18+
name: PHP${{ matrix.php }}
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php }}
27+
28+
- name: Validate composer.json and composer.lock
29+
run: composer validate
30+
31+
- name: Cache Composer packages
32+
id: composer-cache
33+
uses: actions/cache@v2
34+
with:
35+
path: vendor
36+
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
37+
restore-keys: |
38+
${{ runner.os }}-php-${{ matrix.php }}-
39+
40+
- name: Install dependencies
41+
if: steps.composer-cache.outputs.cache-hit != 'true'
42+
run: |
43+
composer install
44+
composer dump
45+
46+
- name: Run test phpunit
47+
run: composer test

.gitignore

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

.php-cs-fixer.dist.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->in([
5+
__DIR__.'/src',
6+
__DIR__.'/tests',
7+
])
8+
->name('*.php')
9+
->notName('*.blade.php')
10+
->ignoreDotFiles(true)
11+
->ignoreVCS(true);
12+
13+
return (new PhpCsFixer\Config())
14+
->setRules([
15+
'@PSR12' => true,
16+
'array_syntax' => ['syntax' => 'short'],
17+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
18+
'no_unused_imports' => true,
19+
'not_operator_with_successor_space' => true,
20+
'trailing_comma_in_multiline' => true,
21+
'phpdoc_scalar' => true,
22+
'unary_operator_spaces' => true,
23+
'binary_operator_spaces' => true,
24+
'blank_line_before_statement' => [
25+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
26+
],
27+
'phpdoc_single_line_var_spacing' => true,
28+
'phpdoc_var_without_name' => true,
29+
'class_attributes_separation' => [
30+
'elements' => [
31+
'method' => 'one',
32+
],
33+
],
34+
'method_argument_space' => [
35+
'on_multiline' => 'ensure_fully_multiline',
36+
'keep_multiple_spaces_after_comma' => true,
37+
],
38+
'single_trait_insert_per_statement' => true,
39+
'php_unit_method_casing' => ['case' => 'camel_case'],
40+
])
41+
->setFinder($finder);

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# php-skeleton
2+
3+
## Install
4+
5+
Via Composer
6+
7+
```bash
8+
composer require descom/package_name
9+
```
10+
11+
## Usage
12+
13+
```php
14+
$skeleton = new Descom\Skeleton\SkeletonClass;
15+
```
16+
17+
## Testing
18+
19+
``` bash
20+
composer test
21+
```

composer.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "descom/skeleton",
3+
"description": "package_description",
4+
"type": "library",
5+
"require": {
6+
"php": "^8.0"
7+
},
8+
"homepage": "https://github.com/descom/skeleton",
9+
"license": "MIT",
10+
"authors": [
11+
{
12+
"name": "Cesar Garcia",
13+
"email": "cesar@descom.es",
14+
"role": "Developer"
15+
}
16+
],
17+
"config": {
18+
"optimize-autoloader": true,
19+
"preferred-install": "dist",
20+
"sort-packages": true
21+
},
22+
"minimum-stability": "dev",
23+
"prefer-stable": true,
24+
"require-dev": {
25+
"friendsofphp/php-cs-fixer": "^3.4",
26+
"phpunit/phpunit": "^9.5",
27+
"phpstan/phpstan": "^1.9"
28+
},
29+
"autoload": {
30+
"psr-4": {
31+
"Descom\\Skeleton\\": "src"
32+
}
33+
},
34+
"scripts": {
35+
"test": "vendor/bin/phpunit --colors=always",
36+
"style": "vendor/bin/php-cs-fixer fix",
37+
"analyse": "vendor/bin/phpstan analyse"
38+
}
39+
}

phpstan.neon.dist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
parameters:
2+
3+
paths:
4+
- src
5+
- tests
6+
7+
# The level 9 is the highest level
8+
level: 5
9+
10+
checkMissingIterableValueType: false

0 commit comments

Comments
 (0)