Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ae50a61
[#.x] - adjusting .gitignore
niden Sep 1, 2025
c4b40d9
[#.x] - minor changes
niden Sep 1, 2025
b61bd85
[#.x] - added config files
niden Sep 1, 2025
dc0807d
[#.x] - output folder for tests
niden Sep 1, 2025
0e118fa
[#.x] - added output folder to gitignore
niden Sep 1, 2025
a38aec3
[#.x] - added docker-compose file and dockerfile for the dev environment
niden Sep 1, 2025
833206a
[#.x] - added changelog and contributing guidelines
niden Sep 1, 2025
44b4dfb
[#.x] - ignoring .env
niden Sep 1, 2025
4515895
[#.x] - initial folder structure
niden Sep 1, 2025
d3151e0
[#.x] - composer with necessary packages
niden Sep 1, 2025
64205f3
[#.x] - hello world from index
niden Sep 1, 2025
1805893
[#.x] - adding cache folder for composer and adjusting gitignore
niden Sep 1, 2025
c6bde68
[#.x] - added codesniffer config
niden Sep 1, 2025
c8d5828
[#.x] - added phpstan config
niden Sep 1, 2025
fdf3b7c
[#.x] - added phpunit config
niden Sep 1, 2025
5551751
[#.x] - added github actions setup
niden Sep 1, 2025
e08f51c
[#.x] - added more commands to composer
niden Sep 1, 2025
ceff298
[#.x] - correcting path
niden Sep 4, 2025
fcddd72
[#.x] - minor adjustments to names and ini
niden Sep 4, 2025
ce9dcd0
[#.x] - upgrading redis to v8
niden Sep 8, 2025
10970c1
[#.x] - added migrations/seeds folders for phinx
niden Sep 8, 2025
39f158b
[#.x] - added migration for users table and phinx config
niden Sep 8, 2025
8c80051
[#.x] - added project namespace
niden Sep 9, 2025
b3d28a1
[#.x] - added container for the application
niden Sep 9, 2025
26bfc05
[#.x] - bootstrapping the app in index
niden Sep 9, 2025
74bec60
[#.x] - added action/domain/responder classes
niden Sep 9, 2025
cf4ebc5
[#.x] - removing gitkeep
niden Sep 9, 2025
1c16c20
[#.x] - added exception classes
niden Sep 13, 2025
a013323
[#.x] - added interfaces for ADR
niden Sep 13, 2025
09877da
[#.x] - moved actions to actionHandler
niden Sep 13, 2025
f8a1179
[#.x] - new json responder
niden Sep 13, 2025
09412b1
[#.x] - response sender for sendin responses back
niden Sep 13, 2025
681b912
[#.x] - reworked container and domain using payload
niden Sep 13, 2025
243e081
[#.x] - adjustments to use the new services
niden Sep 13, 2025
3756435
[#.x] - added tests for env manager
niden Sep 13, 2025
181be6b
[#.x] - added .env for tests
niden Sep 15, 2025
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
144 changes: 144 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@

# This file is part of Phalcon.
#
# (c) Phalcon Team <team@phalcon.io>
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.

name: REST API v6 CI
on:
push:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
workflow_dispatch:

env:
fail-fast: true

# PHP extensions required by Composer
EXTENSIONS: json, mbstring, pcov, pdo, pdo_mysql

permissions: { }
jobs:

# PHP CodeSniffer inspection
phpcs:
name: "Quality gate"
if: "!contains(github.event.head_commit.message, 'ci skip')"

permissions:
contents: read

runs-on: ubuntu-22.04

strategy:
fail-fast: true
matrix:
php:
- '8.2'
- '8.3'
- '8.4'
steps:
- uses: actions/checkout@v4

- name: "Setup PHP"
uses: shivammathur/setup-php@2.35.4
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.EXTENSIONS }}
tools: pecl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Install development dependencies with Composer"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--prefer-dist"

- name: "PHPCS"
run: |
composer cs

- name: "PHPStan"
run: |
composer analyze

unit-tests:
needs: phpcs

permissions:
contents: read # to fetch code (actions/checkout)

name: Unit tests / PHP-${{ matrix.php }}
runs-on: ubuntu-22.04

strategy:
matrix:
php:
- '8.2'
- '8.3'
- '8.4'

services:
mariadb:
image: mariadb:10.6
ports:
- "3306:3306"
env:
MYSQL_ROOT_PASSWORD: secret
MYSQL_USER: phalcon
MYSQL_DATABASE: phalcon
MYSQL_PASSWORD: secret

steps:
- uses: actions/checkout@v4

- name: "Setup PHP"
uses: shivammathur/setup-php@2.35.4
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.EXTENSIONS }}
tools: pecl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Install development dependencies with Composer"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--prefer-dist"

- name: "Setup Tests"
shell: bash
run: |
cp config/.env.ci .env
mkdir -p tests/_output/coverage/

- name: "Run Migrations"
if: always()
run: |
composer migrate

- name: "Run Unit Tests"
if: always()
run: |
composer test-unit-coverage

- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: ./
args: >
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }}
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}
-Dsonar.sources=src/
-Dsonar.exclusions=vendor/**,cv/**,tests/**
-Dsonar.sourceEncoding=UTF-8
-Dsonar.language=php
-Dsonar.tests=tests/
-Dsonar.php.coverage.reportPaths=tests/_output/cov.xml
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
/cache/
/config/development/
.cache
.config
.local
.composer
composer.lock
vendor/
.bash_history
tests/_output
.env
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.0.0

Under development
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributing to Phalcon

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.

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.

## Contributions

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
follow this format, even those from core contributors.

## Questions & Support

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.

_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._

* Questions should go to [GitHub Discussions](https://phalcon.io/discussions)
* Come join the Phalcon [Discord](https://phalcon.io/discord)
* Our social network accounts are:
* [Telegram](https://phalcon.io/telegram)
* [Gab](https://phalcon.io/gab)
* [MeWe](https://phalcon.io/mewe)
* [Twitter](https://phalcon.io/t)
* [Facebook](https://phalcon.io/fb)
* If you still believe that what you found is a bug, please
[open an issue](https://github.com/phalcon/phalcon/issues/new)

Please report bugs when you've exhausted all of the above options.

## Bug Report Checklist

* Make sure you are using the latest released version of the composer packages.
* 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.
* Be sure that information such as OS, Phalcon version and PHP version are part of the bug report

## Pull Request Checklist

* 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
* Don't put submodule updates in your pull request unless they are to landed commits
* 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).

## Requesting Features

If you have a change or new feature in mind, please fill out an NFR on GitHub.


Thanks!
Phalcon Team
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# rest-api-v6
# REST API with Phalcon v6

A REST API developed with Phalcon v6
Empty file added bin/.gitkeep
Empty file.
65 changes: 65 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "phalcon/rest-api-v6",
"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-v6/graphs/contributors"
}
],
"require": {
"ext-mbstring": "*",
"ext-pdo": "*",
"phalcon/phalcon": "^6.0.x-dev",
"robmorgan/phinx": "^0.16.10",
"vlucas/phpdotenv": "^5.6"
},
"require-dev": {
"pds/composer-script-names": "^1.0",
"pds/skeleton": "^1.0",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^11.5",
"squizlabs/php_codesniffer": "^3.13"
},
"autoload": {
"psr-4": {
"Phalcon\\Api\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Phalcon\\Api\\Tests\\": "tests/"
}
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true,
"cache-dir": ".composer"
},
"replace": {
"symfony/polyfill-php80": "*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-mbstring": "*"
},
"scripts": {
"analyze": "vendor/bin/phpstan analyze -c phpstan.neon",
"cs": "vendor/bin/phpcs --standard=phpcs.xml",
"cs-fix": "vendor/bin/phpcbf --standard=phpcs.xml",
"migrate": "vendor/bin/phinx migrate",
"test-unit": "vendor/bin/phpunit -c phpunit.xml.dist --display-all-issues",
"test-unit-coverage": "vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover tests/_output/cov.xml --display-all-issues",
"test-unit-coverage-html": "vendor/bin/phpunit -c phpunit.xml.dist --coverage-html tests/_output/coverage --display-all-issues"
}
}
16 changes: 16 additions & 0 deletions config/.env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PROJECT_NAME="rest"

# Mariadb
DB_HOST="127.0.0.1"
DB_PORT=3306
DB_USER="root"
DB_PASS="secret"
DB_NAME="phalcon"
DB_CHARSET="utf8"

# Redis
DATA_REDIS_HOST="app-cache"
DATA_REDIS_PORT=6379
DATA_REDIS_NAME="0"

XDEBUG_MODE=coverage
16 changes: 16 additions & 0 deletions config/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PROJECT_NAME="rest"

# Mariadb
DB_HOST="app-db"
DB_PORT=3306
DB_USER="root"
DB_PASS="secret"
DB_NAME="phalcon"
DB_CHARSET= "utf8"

# Redis
DATA_REDIS_HOST="app-cache"
DATA_REDIS_PORT=6379
DATA_REDIS_NAME="0"

XDEBUG_MODE=coverage
Loading
Loading