Skip to content

Commit 382fce7

Browse files
authored
Merge pull request #8 from niden-code/T2-composer-setup
T2 composer setup
2 parents 2f07130 + ae882c2 commit 382fce7

File tree

10 files changed

+148
-3
lines changed

10 files changed

+148
-3
lines changed

.github/workflows/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: REST API v6 CI
2+
on:
3+
push:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
jobs:
7+
sonarqube:
8+
name: SonarQube
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
14+
- name: SonarQube Scan
15+
uses: SonarSource/sonarqube-scan-action@v5
16+
env:
17+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
/cache/
2-
/config/development/
1+
.composer
2+
.bash_history
3+
vendor
4+
composer.lock

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 The Phalcon PHP Framework
3+
Copyright (c) 2012-present The Phalcon PHP Framework
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "phalcon/rest-api",
3+
"type": "library",
4+
"description": "Sample REST API application implemented with Phalcon v6",
5+
"keywords": [
6+
"phalcon",
7+
"framework",
8+
"sample app",
9+
"rest-api",
10+
"rest",
11+
"api"
12+
],
13+
"homepage": "https://phalcon.io",
14+
"license": "MIT",
15+
"authors": [
16+
{
17+
"name": "Contributors",
18+
"homepage": "https://github.com/phalcon/rest-api/graphs/contributors"
19+
}
20+
],
21+
"require": {
22+
"php": ">=8.2",
23+
"ext-json": "*",
24+
"ext-mbstring": "*",
25+
"robmorgan/phinx": "^0.16.10",
26+
"vlucas/phpdotenv": "^5.6"
27+
},
28+
"require-dev": {
29+
"pds/composer-script-names": "^1.0",
30+
"pds/skeleton": "*",
31+
"phalcon/phalcon": "^v6.0.x-dev",
32+
"phpstan/phpstan": "^2.1",
33+
"phpunit/phpunit": "^10.5",
34+
"squizlabs/php_codesniffer": "^3.13"
35+
},
36+
"autoload": {
37+
"psr-4": {
38+
"Phalcon\\Api\\": "src/"
39+
}
40+
},
41+
"autoload-dev": {
42+
"psr-4": {
43+
"Phalcon\\Api\\Tests\\": "tests/"
44+
}
45+
},
46+
"config": {
47+
"preferred-install": "dist",
48+
"sort-packages": true,
49+
"optimize-autoloader": true
50+
},
51+
"replace": {
52+
"symfony/polyfill-php80": "*",
53+
"symfony/polyfill-ctype": "*",
54+
"symfony/polyfill-mbstring": "*"
55+
},
56+
"scripts": {
57+
"analyze": "phpstan analyse -c phpstan.neon --memory-limit=512M",
58+
"cs": "vendor/bin/phpcs --standard=phpcs.xml",
59+
"cs-fix": "vendor/bin/phpcbf --standard=phpcs.xml",
60+
"test-unit": "vendor/bin/phpunit -c phpunit.xml.dist --display-all-issues"
61+
}
62+
}

phpcs.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Phalcon-REST-v6">
3+
<description>Phalcon REST API v6 Coding Standards</description>
4+
<arg value="-colors"/>
5+
<arg value="s"/>
6+
<arg value="p"/>
7+
<rule ref="PSR12">
8+
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
9+
</rule>
10+
<file>src</file>
11+
<file>tests/Unit</file>
12+
</ruleset>

phpstan.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
parameters:
2+
level: max
3+
paths:
4+
- src

phpunit.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
ini_set('xdebug.mode', 'coverage');
4+
5+
error_reporting(E_ALL);
6+
7+
$autoloader = __DIR__ . '/vendor/autoload.php';
8+
9+
if (! file_exists($autoloader)) {
10+
echo "Composer autoloader not found: $autoloader" . PHP_EOL;
11+
echo "Please issue 'composer install' and try again." . PHP_EOL;
12+
exit(1);
13+
}
14+
15+
require_once $autoloader;

phpunit.xml.dist

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="./phpunit.php"
5+
cacheDirectory="tests/_output/.phpunit.result.cache"
6+
colors="true"
7+
processIsolation="true"
8+
>
9+
<testsuites>
10+
<testsuite name="unit and mysql tests">
11+
<directory>./tests/Unit/</directory>
12+
</testsuite>
13+
</testsuites>
14+
<source>
15+
<include>
16+
<directory suffix=".php">./src</directory>
17+
</include>
18+
</source>
19+
</phpunit>

sonar-project.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sonar.projectKey=niden-code_phalcon-rest-api-v6
2+
sonar.organization=niden
3+
4+
5+
# This is the name and version displayed in the SonarCloud UI.
6+
#sonar.projectName=phalcon-rest-api-v6
7+
#sonar.projectVersion=1.0
8+
9+
10+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
11+
#sonar.sources=.
12+
13+
# Encoding of the source code. Default is default system encoding
14+
#sonar.sourceEncoding=UTF-8

tests/_output/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)