Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow uses SonarSource/sonarqube-scan-action@v5 but lacks the SONAR_HOST_URL environment variable. For SonarQube Server, this variable is required. If using SonarCloud (as indicated by sonar-project.properties), this is acceptable, but consider adding a comment clarifying this is for SonarCloud to avoid confusion.

Suggested change
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
# This scan uses SonarCloud, so SONAR_HOST_URL is not required.

Copilot uses AI. Check for mistakes.
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/cache/
/config/development/
.composer
.bash_history
vendor
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
53 changes: 53 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
12 changes: 12 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<ruleset name="Phalcon-REST-v6">
<description>Phalcon REST API v6 Coding Standards</description>
<arg value="--colors"/>
<arg value="s"/>
<arg value="p"/>
<rule ref="PSR12">
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
</rule>
<file>src</file>
<file>tests/Unit</file>
</ruleset>
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: max
paths:
- src
15 changes: 15 additions & 0 deletions phpunit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

ini_set('xdebug.mode', 'coverage');

error_reporting(E_ALL);

$autoloader = __DIR__ . '/vendor/autoload.php';

if (! file_exists($autoloader)) {
echo "Composer autoloader not found: $autoloader" . PHP_EOL;
echo "Please issue 'composer install' and try again." . PHP_EOL;
exit(1);
}

require_once $autoloader;
19 changes: 19 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="./phpunit.php"
cacheDirectory="tests/_output/.phpunit.result.cache"
colors="true"
processIsolation="true"
>
<testsuites>
<testsuite name="unit and mysql tests">
<directory>./tests/Unit/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
14 changes: 14 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sonar.projectKey=niden-code_phalcon-rest-api-v6
sonar.organization=niden
Comment on lines +1 to +2
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sonar.projectKey includes 'niden-code' and organization is 'niden', which appears to be a personal account configuration rather than the Phalcon organization. Consider updating these to match the actual organization (e.g., 'phalcon' or 'phalcon-rest-api-v6') to align with the project's GitHub repository under github.com/phalcon/rest-api.

Suggested change
sonar.projectKey=niden-code_phalcon-rest-api-v6
sonar.organization=niden
sonar.projectKey=phalcon-rest-api-v6
sonar.organization=phalcon

Copilot uses AI. Check for mistakes.


# 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
Empty file added tests/_output/.gitkeep
Empty file.
Loading