diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..35fbaac --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,17 @@ +name: REST API v6 CI +on: + push: + pull_request: + types: [opened, synchronize, reopened] +jobs: + sonarqube: + name: SonarQube + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.gitignore b/.gitignore index 6ffe3aa..4bb08c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -/cache/ -/config/development/ +.composer +.bash_history +vendor diff --git a/LICENSE b/LICENSE index e9a74a6..cec7c50 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 The Phalcon PHP Framework +Copyright (c) 2012-present The Phalcon PHP Framework Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..725d63d --- /dev/null +++ b/composer.json @@ -0,0 +1,53 @@ +{ + "name": "phalcon/rest-api", + "type": "library", + "description": "Sample REST API application implemented with Phalcon v6", + "keywords": [ + "phalcon", + "framework", + "sample app", + "rest-api", + "rest", + "api" + ], + "homepage": "https://phalcon.io", + "license": "MIT", + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/phalcon/rest-api/graphs/contributors" + } + ], + "require": { + "php": ">=8.2", + "ext-json": "*", + "ext-mbstring": "*", + "robmorgan/phinx": "^0.16.10", + "vlucas/phpdotenv": "^5.6" + }, + "require-dev": { + "pds/composer-script-names": "^1.0", + "pds/skeleton": "*", + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^10.5", + "squizlabs/php_codesniffer": "^3.13" + }, + "config": { + "preferred-install": "dist", + "sort-packages": true, + "optimize-autoloader": true + }, + "replace": { + "symfony/polyfill-php80": "*", + "symfony/polyfill-php81": "*", + "symfony/polyfill-php82": "*", + "symfony/polyfill-ctype": "*", + "symfony/polyfill-mbstring": "*" + }, + "scripts": { + "analyze": "phpstan analyse -c phpstan.neon --memory-limit=512M", + "cs": "vendor/bin/phpcs --standard=phpcs.xml", + "cs-fix": "vendor/bin/phpcbf --standard=phpcs.xml", + "test-unit": "vendor/bin/phpunit -c phpunit.xml.dist --display-all-issues" + } +} diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..d06467d --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,12 @@ + + + Phalcon REST API v6 Coding Standards + + + + + + + src + tests/Unit + diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..776ccd8 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,4 @@ +parameters: + level: max + paths: + - src diff --git a/phpunit.php b/phpunit.php new file mode 100644 index 0000000..39cfdb6 --- /dev/null +++ b/phpunit.php @@ -0,0 +1,15 @@ + + + + + ./tests/Unit/ + + + + + ./src + + + diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..f3412ca --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,14 @@ +sonar.projectKey=niden-code_phalcon-rest-api-v6 +sonar.organization=niden + + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=phalcon-rest-api-v6 +#sonar.projectVersion=1.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 diff --git a/tests/_output/.gitkeep b/tests/_output/.gitkeep new file mode 100644 index 0000000..e69de29