Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tfirdaus committed Dec 29, 2023
0 parents commit f05be6c
Show file tree
Hide file tree
Showing 22 changed files with 1,823 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "syntatis/php-utils",
"image": "ghcr.io/syntatis/php:7.4-fpm",
"customizations": {
"vscode": {
"settings": {
"php.validate.executablePath": "/usr/local/bin/php",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash",
"args": [
"-l"
]
}
},
"terminal.integrated.defaultProfile.linux": "bash"
},
"extensions": [
"bmewburn.vscode-intelephense-client",
"christian-kohler.path-intellisense",
"editorConfig.editorConfig",
"neilbrayfield.php-docblocker",
"SanderRonde.phpstan-vscode",
"wongjn.php-sniffer"
]
}
}
}
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

[*.{json,neon,neon.dist,yml,md}]
indent_size = 2

[*.{yml,md,neon,neon.dist}]
indent_style = space
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/.devcontainer export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.vscode export-ignore
/docs export-ignore
/phpstan.neon.dist export-ignore
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"

- package-ecosystem: "composer"
versioning-strategy: increase
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
groups:
composer-require:
dependency-type: "production"
update-types:
- "minor"
- "patch"
composer-require-dev:
dependency-type: "development"
update-types:
- "minor"
- "patch"
84 changes: 84 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: php

on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- ".github/workflows/php.yml"
- "**.php"
- "composer.json"
- "composer.lock"
- "phpcs.xml.dist"
- "phpstan.neon.dist"
- "phpunit.xml.dist"
push:
branches:
- main
paths:
- ".github/workflows/php.yml"
- "**.php"
- "composer.json"
- "composer.lock"
- "phpcs.xml.dist"
- "phpstan.neon.dist"
- "phpunit.xml.dist"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4

- name: Install dependencies
run: composer install --prefer-dist --no-ansi --no-interaction --no-progress

- name: Run linter
run: composer phpcs

test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
version: [7.4, 8.0, 8.1, 8.2]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Setup Composer cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ matrix.version }}-${{ hashFiles('**/composer.json') }}
restore-keys: php-${{ matrix.version }}-composer-

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.version }}
tools: composer:v2

- name: Install dependencies
run: composer update --prefer-dist --no-ansi --no-interaction --no-progress

- name: Run test
run: |
composer phpstan
vendor/bin/phpunit --testdox --coverage-clover coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#OS
.DS_*

# Composer
/vendor
composer.lock
auth.json

# Log, cache, and tmp files
*.cache
*.log
*.meta
tmp/

# Dotenv
.env.*
!.env

# Tests #
#############
artifacts/
phpunit.xml
phpstan.neon
phpcs.xml

# Docker
docker-composer.override.yml
14 changes: 14 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"recommendations": [
"bmewburn.vscode-intelephense-client",
"christian-kohler.path-intellisense",
"editorconfig.editorconfig",
"kasik96.latte",
"mikestead.dotenv",
"ms-vscode-remote.remote-containers",
"neilbrayfield.php-docblocker",
"sanderronde.phpstan-vscode",
"wmaurer.change-case",
"dotjoshjohnson.xml"
]
}
103 changes: 103 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"intelephense.stubs": [
"apache",
"bcmath",
"bz2",
"calendar",
"com_dotnet",
"Core",
"ctype",
"curl",
"date",
"dba",
"dom",
"enchant",
"exif",
"FFI",
"fileinfo",
"filter",
"fpm",
"ftp",
"gd",
"gettext",
"gmp",
"hash",
"iconv",
"imap",
"intl",
"json",
"ldap",
"libxml",
"mbstring",
"meta",
"mysqli",
"oci8",
"odbc",
"openssl",
"pcntl",
"pcre",
"pdo_ibm",
"pdo_mysql",
"pdo_pgsql",
"pdo_sqlite",
"PDO",
"pgsql",
"Phar",
"posix",
"pspell",
"readline",
"redis",
"Reflection",
"session",
"shmop",
"SimpleXML",
"snmp",
"soap",
"sockets",
"sodium",
"SPL",
"sqlite3",
"standard",
"superglobals",
"sysvmsg",
"sysvsem",
"sysvshm",
"tidy",
"tokenizer",
"wordpress",
"xml",
"xmlreader",
"xmlrpc",
"xmlwriter",
"xsl",
"Zend OPcache",
"zip",
"zlib"
],
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[php]": {
"editor.defaultFormatter": "wongjn.php-sniffer"
},
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true,
"**/Thumbs.db": true
},
"search.exclude": {
"**/dist": true
},
"intelephense.files.exclude": [
"**/.git/**",
"**/.svn/**",
"**/.hg/**",
"**/.DS_Store/**",
"**/.history/**",
"**/CVS/**"
],
"phpSniffer.autoDetect": true,
"phpSniffer.run": "onSave"
}
Loading

0 comments on commit f05be6c

Please sign in to comment.