Skip to content

Commit a978986

Browse files
authored
Merge pull request #12 from niden-code/1.x
Sync with 1.x
2 parents 2f07130 + 181be6b commit a978986

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1768
-3
lines changed

.github/workflows/main.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
2+
# This file is part of Phalcon.
3+
#
4+
# (c) Phalcon Team <team@phalcon.io>
5+
#
6+
# For the full copyright and license information, please view
7+
# the LICENSE file that was distributed with this source code.
8+
9+
name: REST API v6 CI
10+
on:
11+
push:
12+
paths-ignore:
13+
- '**.md'
14+
- '**.txt'
15+
pull_request:
16+
workflow_dispatch:
17+
18+
env:
19+
fail-fast: true
20+
21+
# PHP extensions required by Composer
22+
EXTENSIONS: json, mbstring, pcov, pdo, pdo_mysql
23+
24+
permissions: { }
25+
jobs:
26+
27+
# PHP CodeSniffer inspection
28+
phpcs:
29+
name: "Quality gate"
30+
if: "!contains(github.event.head_commit.message, 'ci skip')"
31+
32+
permissions:
33+
contents: read
34+
35+
runs-on: ubuntu-22.04
36+
37+
strategy:
38+
fail-fast: true
39+
matrix:
40+
php:
41+
- '8.2'
42+
- '8.3'
43+
- '8.4'
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- name: "Setup PHP"
48+
uses: shivammathur/setup-php@2.35.4
49+
with:
50+
php-version: ${{ matrix.php }}
51+
extensions: ${{ env.EXTENSIONS }}
52+
tools: pecl
53+
env:
54+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: "Install development dependencies with Composer"
57+
uses: "ramsey/composer-install@v3"
58+
with:
59+
composer-options: "--prefer-dist"
60+
61+
- name: "PHPCS"
62+
run: |
63+
composer cs
64+
65+
- name: "PHPStan"
66+
run: |
67+
composer analyze
68+
69+
unit-tests:
70+
needs: phpcs
71+
72+
permissions:
73+
contents: read # to fetch code (actions/checkout)
74+
75+
name: Unit tests / PHP-${{ matrix.php }}
76+
runs-on: ubuntu-22.04
77+
78+
strategy:
79+
matrix:
80+
php:
81+
- '8.2'
82+
- '8.3'
83+
- '8.4'
84+
85+
services:
86+
mariadb:
87+
image: mariadb:10.6
88+
ports:
89+
- "3306:3306"
90+
env:
91+
MYSQL_ROOT_PASSWORD: secret
92+
MYSQL_USER: phalcon
93+
MYSQL_DATABASE: phalcon
94+
MYSQL_PASSWORD: secret
95+
96+
steps:
97+
- uses: actions/checkout@v4
98+
99+
- name: "Setup PHP"
100+
uses: shivammathur/setup-php@2.35.4
101+
with:
102+
php-version: ${{ matrix.php }}
103+
extensions: ${{ env.EXTENSIONS }}
104+
tools: pecl
105+
env:
106+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
108+
- name: "Install development dependencies with Composer"
109+
uses: "ramsey/composer-install@v3"
110+
with:
111+
composer-options: "--prefer-dist"
112+
113+
- name: "Setup Tests"
114+
shell: bash
115+
run: |
116+
cp config/.env.ci .env
117+
mkdir -p tests/_output/coverage/
118+
119+
- name: "Run Migrations"
120+
if: always()
121+
run: |
122+
composer migrate
123+
124+
- name: "Run Unit Tests"
125+
if: always()
126+
run: |
127+
composer test-unit-coverage
128+
129+
- name: SonarCloud Scan
130+
uses: SonarSource/sonarqube-scan-action@v5
131+
env:
132+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
134+
with:
135+
projectBaseDir: ./
136+
args: >
137+
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }}
138+
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}
139+
-Dsonar.sources=src/
140+
-Dsonar.exclusions=vendor/**,cv/**,tests/**
141+
-Dsonar.sourceEncoding=UTF-8
142+
-Dsonar.language=php
143+
-Dsonar.tests=tests/
144+
-Dsonar.php.coverage.reportPaths=tests/_output/cov.xml

.gitignore

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
/cache/
2-
/config/development/
1+
.cache
2+
.config
3+
.local
4+
.composer
5+
composer.lock
6+
vendor/
7+
.bash_history
8+
tests/_output
9+
.env

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 1.0.0
2+
3+
Under development

CONTRIBUTING.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Contributing to Phalcon
2+
3+
Phalcon is an open source project and a volunteer effort. Phalcon welcomes contribution from everyone. Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
4+
5+
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
6+
7+
## Contributions
8+
9+
Contributions to Phalcon should be made in the form of GitHub pull requests. Each pull request will be reviewed by a core contributor (someone with permission to merge patches). Feedback can be provided and potentially changes requested or the pull request will be merged. All contributions should
10+
follow this format, even those from core contributors.
11+
12+
## Questions & Support
13+
14+
We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address all of them. Thus we only accept bug reports, new feature requests and pull requests in GitHub. Our great community and contributors are happy to help you though! Please use these community resources for obtaining help.
15+
16+
_Please use the [Documentation](https://phalcon.io/docs) before anything else. You can also use the search feature in our documents to find what you are looking for. If your question is still not answered, there are more options below._
17+
18+
* Questions should go to [GitHub Discussions](https://phalcon.io/discussions)
19+
* Come join the Phalcon [Discord](https://phalcon.io/discord)
20+
* Our social network accounts are:
21+
* [Telegram](https://phalcon.io/telegram)
22+
* [Gab](https://phalcon.io/gab)
23+
* [MeWe](https://phalcon.io/mewe)
24+
* [Twitter](https://phalcon.io/t)
25+
* [Facebook](https://phalcon.io/fb)
26+
* If you still believe that what you found is a bug, please
27+
[open an issue](https://github.com/phalcon/phalcon/issues/new)
28+
29+
Please report bugs when you've exhausted all of the above options.
30+
31+
## Bug Report Checklist
32+
33+
* Make sure you are using the latest released version of the composer packages.
34+
* If you have found a bug it is important to add relevant reproducibility information to your issue to allow us to reproduce the bug and fix it quicker. Add a script, small program or repository providing the necessary code to make everyone reproduce the issue reported easily.
35+
* Be sure that information such as OS, Phalcon version and PHP version are part of the bug report
36+
37+
## Pull Request Checklist
38+
39+
* Don't submit your pull requests to the `master` branch. Branch from the required branch and, if needed, rebase to the proper branch before submitting your pull request. If it doesn't merge cleanly with master you may be asked to rebase your changes
40+
* Don't put submodule updates in your pull request unless they are to landed commits
41+
* Add tests relevant to the fixed bug or new feature. Test classes should follow the [PSR-12 coding style guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-coding-style-guide.md).
42+
43+
## Requesting Features
44+
45+
If you have a change or new feature in mind, please fill out an NFR on GitHub.
46+
47+
48+
Thanks!
49+
Phalcon Team

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# rest-api-v6
1+
# REST API with Phalcon v6
2+
23
A REST API developed with Phalcon v6

bin/.gitkeep

Whitespace-only changes.

composer.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"name": "phalcon/rest-api-v6",
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-v6/graphs/contributors"
19+
}
20+
],
21+
"require": {
22+
"ext-mbstring": "*",
23+
"ext-pdo": "*",
24+
"phalcon/phalcon": "^6.0.x-dev",
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": "^1.0",
31+
"phpstan/phpstan": "^2.1",
32+
"phpunit/phpunit": "^11.5",
33+
"squizlabs/php_codesniffer": "^3.13"
34+
},
35+
"autoload": {
36+
"psr-4": {
37+
"Phalcon\\Api\\": "src/"
38+
}
39+
},
40+
"autoload-dev": {
41+
"psr-4": {
42+
"Phalcon\\Api\\Tests\\": "tests/"
43+
}
44+
},
45+
"config": {
46+
"preferred-install": "dist",
47+
"sort-packages": true,
48+
"optimize-autoloader": true,
49+
"cache-dir": ".composer"
50+
},
51+
"replace": {
52+
"symfony/polyfill-php80": "*",
53+
"symfony/polyfill-ctype": "*",
54+
"symfony/polyfill-mbstring": "*"
55+
},
56+
"scripts": {
57+
"analyze": "vendor/bin/phpstan analyze -c phpstan.neon",
58+
"cs": "vendor/bin/phpcs --standard=phpcs.xml",
59+
"cs-fix": "vendor/bin/phpcbf --standard=phpcs.xml",
60+
"migrate": "vendor/bin/phinx migrate",
61+
"test-unit": "vendor/bin/phpunit -c phpunit.xml.dist --display-all-issues",
62+
"test-unit-coverage": "vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover tests/_output/cov.xml --display-all-issues",
63+
"test-unit-coverage-html": "vendor/bin/phpunit -c phpunit.xml.dist --coverage-html tests/_output/coverage --display-all-issues"
64+
}
65+
}

config/.env.ci

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
PROJECT_NAME="rest"
2+
3+
# Mariadb
4+
DB_HOST="127.0.0.1"
5+
DB_PORT=3306
6+
DB_USER="root"
7+
DB_PASS="secret"
8+
DB_NAME="phalcon"
9+
DB_CHARSET="utf8"
10+
11+
# Redis
12+
DATA_REDIS_HOST="app-cache"
13+
DATA_REDIS_PORT=6379
14+
DATA_REDIS_NAME="0"
15+
16+
XDEBUG_MODE=coverage

config/.env.example

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
PROJECT_NAME="rest"
2+
3+
# Mariadb
4+
DB_HOST="app-db"
5+
DB_PORT=3306
6+
DB_USER="root"
7+
DB_PASS="secret"
8+
DB_NAME="phalcon"
9+
DB_CHARSET= "utf8"
10+
11+
# Redis
12+
DATA_REDIS_HOST="app-cache"
13+
DATA_REDIS_PORT=6379
14+
DATA_REDIS_NAME="0"
15+
16+
XDEBUG_MODE=coverage

0 commit comments

Comments
 (0)