Skip to content

Commit

Permalink
php 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikzogg committed Dec 31, 2023
1 parent 0492739 commit eefe67a
Show file tree
Hide file tree
Showing 47 changed files with 349 additions and 303 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
docker-compose:
name: docker-compose (production container)
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v3
Expand All @@ -22,9 +22,9 @@ jobs:
run: curl --insecure https://localhost/openapi -vvv
- name: docker stop
run: docker-compose -f docker-compose.ci.yml stop
php80:
name: PHP 8.0
runs-on: ubuntu-20.04
php81:
name: PHP 8.1
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:14
Expand All @@ -40,7 +40,7 @@ jobs:
run: |
while ! nc -z localhost 5432; do sleep 0.1; done
- name: composer test
uses: docker://chubbyphp/ci-php80:latest
uses: docker://chubbyphp/ci-php81:latest
env:
APP_ENV: phpunit
DATABASE_USER: root
Expand All @@ -50,9 +50,9 @@ jobs:
DATABASE_PORT: 5432
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
php81:
name: PHP 8.1
runs-on: ubuntu-20.04
php82:
name: PHP 8.2
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:14
Expand All @@ -68,7 +68,7 @@ jobs:
run: |
while ! nc -z localhost 5432; do sleep 0.1; done
- name: composer test
uses: docker://chubbyphp/ci-php81:latest
uses: docker://chubbyphp/ci-php82:latest
env:
APP_ENV: phpunit
DATABASE_USER: root
Expand All @@ -78,9 +78,9 @@ jobs:
DATABASE_PORT: 5432
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
php82:
name: PHP 8.2
runs-on: ubuntu-20.04
php83:
name: PHP 8.3
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:14
Expand All @@ -96,7 +96,7 @@ jobs:
run: |
while ! nc -z localhost 5432; do sleep 0.1; done
- name: composer test
uses: docker://chubbyphp/ci-php82:latest
uses: docker://chubbyphp/ci-php83:latest
env:
APP_ENV: phpunit
DATABASE_USER: root
Expand Down
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
build
.DS_Store
.idea/
.phpunit.cache
.vscode/
build/
composer.lock
database
var
vendor
var/
vendor/
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@

[![CI](https://github.com/chubbyphp/petstore/workflows/CI/badge.svg?branch=chubbyphp)](https://github.com/chubbyphp/petstore/actions?query=workflow%3ACI)
[![Coverage Status](https://coveralls.io/repos/github/chubbyphp/petstore/badge.svg?branch=chubbyphp)](https://coveralls.io/github/chubbyphp/petstore?branch=chubbyphp)
[![Infection MSI](https://badge.stryker-mutator.io/github.com/chubbyphp/petstore/chubbyphp)](https://dashboard.stryker-mutator.io/reports/github.com/chubbyphp/petstore/chubbyphp)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fchubbyphp%2Fpetstore%2Fchubbyphp)](https://dashboard.stryker-mutator.io/reports/github.com/chubbyphp/petstore/chubbyphp)

## Description

A simple skeleton to build api's based on the [chubbyphp-framework][1].

## Requirements

* php: ^8.0
* [chubbyphp/chubbyphp-api-http][2]: ^5.0.1
* [chubbyphp/chubbyphp-clean-directories][3]: ^1.2
* [chubbyphp/chubbyphp-cors][4]: ^1.4
* [chubbyphp/chubbyphp-decode-encode][5]: ^1.0.1
* [chubbyphp/chubbyphp-deserialization][6]: ^3.5.2
* [chubbyphp/chubbyphp-framework][7]: ^5.0.3
* [chubbyphp/chubbyphp-framework-router-fastroute][8]: ^2.0.1
* [chubbyphp/chubbyphp-http-exception][9]: ^1.0.1
* [chubbyphp/chubbyphp-laminas-config][10]: ^1.3
* [chubbyphp/chubbyphp-laminas-config-doctrine][11]: ^2.0.3
* [chubbyphp/chubbyphp-laminas-config-factory][12]: ^1.2
* [chubbyphp/chubbyphp-negotiation][13]: ^1.9
* [chubbyphp/chubbyphp-serialization][14]: ^3.3.1
* [chubbyphp/chubbyphp-validation][15]: ^3.12.4
* [doctrine/orm][16]: ^2.14
* [monolog/monolog][17]: ^2.8
* [ramsey/uuid][18]: ^4.7
* [slim/psr7][19]: ^1.6
* [symfony/console][20]: ^6.0.17
* php: ^8.1
* [chubbyphp/chubbyphp-api-http][2]: ^6.0
* [chubbyphp/chubbyphp-clean-directories][3]: ^1.3.1
* [chubbyphp/chubbyphp-cors][4]: ^1.5
* [chubbyphp/chubbyphp-decode-encode][5]: ^1.1
* [chubbyphp/chubbyphp-deserialization][6]: ^4.1
* [chubbyphp/chubbyphp-framework][7]: ^5.1.1
* [chubbyphp/chubbyphp-framework-router-fastroute][8]: ^2.1
* [chubbyphp/chubbyphp-http-exception][9]: ^1.1
* [chubbyphp/chubbyphp-laminas-config][10]: ^1.4
* [chubbyphp/chubbyphp-laminas-config-doctrine][11]: ^2.2
* [chubbyphp/chubbyphp-laminas-config-factory][12]: ^1.3
* [chubbyphp/chubbyphp-negotiation][13]: ^2.0
* [chubbyphp/chubbyphp-serialization][14]: ^4.0
* [chubbyphp/chubbyphp-validation][15]: ^4.0
* [doctrine/orm][16]: ^2.17.2
* [monolog/monolog][17]: ^3.5
* [ramsey/uuid][18]: ^4.7.5
* [slim/psr7][19]: ^1.6.1
* [symfony/console][20]: ^6.4.2

## Environment

Expand Down
55 changes: 26 additions & 29 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,35 @@
}
],
"require": {
"php": "^8.0",
"chubbyphp/chubbyphp-api-http": "^5.0.1",
"chubbyphp/chubbyphp-clean-directories": "^1.2",
"chubbyphp/chubbyphp-cors": "^1.4",
"chubbyphp/chubbyphp-decode-encode": "^1.0.1",
"chubbyphp/chubbyphp-deserialization": "^3.5.2",
"chubbyphp/chubbyphp-framework": "^5.0.3",
"chubbyphp/chubbyphp-framework-router-fastroute": "^2.0.1",
"chubbyphp/chubbyphp-http-exception": "^1.0.1",
"chubbyphp/chubbyphp-laminas-config": "^1.3",
"chubbyphp/chubbyphp-laminas-config-doctrine": "^2.0.3",
"chubbyphp/chubbyphp-laminas-config-factory": "^1.2",
"chubbyphp/chubbyphp-negotiation": "^1.9",
"chubbyphp/chubbyphp-serialization": "^3.3.1",
"chubbyphp/chubbyphp-validation": "^3.12.4",
"doctrine/orm": "^2.14",
"monolog/monolog": "^2.8",
"ramsey/uuid": "^4.7",
"slim/psr7": "^1.6",
"symfony/console": "^6.0.17"
"php": "^8.1",
"chubbyphp/chubbyphp-api-http": "^6.0",
"chubbyphp/chubbyphp-clean-directories": "^1.3.1",
"chubbyphp/chubbyphp-cors": "^1.5",
"chubbyphp/chubbyphp-decode-encode": "^1.1",
"chubbyphp/chubbyphp-deserialization": "^4.1",
"chubbyphp/chubbyphp-framework": "^5.1.1",
"chubbyphp/chubbyphp-framework-router-fastroute": "^2.1",
"chubbyphp/chubbyphp-http-exception": "^1.1",
"chubbyphp/chubbyphp-laminas-config": "^1.4",
"chubbyphp/chubbyphp-laminas-config-doctrine": "^2.1",
"chubbyphp/chubbyphp-laminas-config-factory": "^1.3",
"chubbyphp/chubbyphp-negotiation": "^2.0",
"chubbyphp/chubbyphp-serialization": "^4.0",
"chubbyphp/chubbyphp-validation": "^4.0",
"doctrine/orm": "^2.17.2",
"monolog/monolog": "^3.5",
"ramsey/uuid": "^4.7.5",
"slim/psr7": "^1.6.1",
"symfony/console": "^6.4.2"
},
"require-dev": {
"chubbyphp/chubbyphp-dev-helper": "dev-master",
"chubbyphp/chubbyphp-mock": "^1.6.2",
"infection/infection": "^0.26.16",
"php-coveralls/php-coveralls": "^2.5.3",
"phploc/phploc": "^7.0.2",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.9.4",
"phpunit/phpunit": "^9.5.27"
"chubbyphp/chubbyphp-mock": "^1.7",
"infection/infection": "^0.27.9",
"php-coveralls/php-coveralls": "^2.7",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.50",
"phpunit/phpunit": "^10.5.5"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -89,15 +88,13 @@
"@test:infection",
"@test:integration",
"@test:static-analysis",
"@test:loc",
"@test:cs"
],
"test:cs": "mkdir -p build && PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --cache-file=build/phpcs.cache",
"test:infection": "vendor/bin/infection --threads=$(nproc) --min-msi=97 --verbose --coverage=build/phpunit",
"test:integration": "vendor/bin/phpunit --configuration phpunit.integration.xml --cache-result-file=build/phpunit/result.integration.cache",
"test:lint": "mkdir -p build && find src tests -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php -l | tee build/phplint.log",
"test:static-analysis": "mkdir -p build && bash -c 'vendor/bin/phpstan analyse src --no-progress --level=8 --error-format=junit | tee build/phpstan.junit.xml; if [ ${PIPESTATUS[0]} -ne \"0\" ]; then exit 1; fi'",
"test:loc": "mkdir -p build && vendor/bin/phploc src | tee build/phploc.log",
"test:unit": "vendor/bin/phpunit --coverage-text --coverage-clover=build/phpunit/clover.xml --coverage-html=build/phpunit/coverage-html --coverage-xml=build/phpunit/coverage-xml --log-junit=build/phpunit/junit.xml --cache-result-file=build/phpunit/result.cache"
}
}
7 changes: 3 additions & 4 deletions config/dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
declare(strict_types=1);

use Chubbyphp\Cors\Negotiation\Origin\AllowOriginRegex;
use Chubbyphp\Laminas\Config\Doctrine\ServiceFactory\Common\Cache\ArrayCacheFactory;
use Monolog\Logger;
use Monolog\Level;

$config = require __DIR__.'/prod.php';

$config['chubbyphp']['cors']['allowOrigins']['^https?\:\/\/(localhost|127\.\d+.\d+.\d+)(\:\d+)?$'] = AllowOriginRegex::class;
$config['debug'] = true;
$config['dependencies']['factories'][Cache::class] = ArrayCacheFactory::class;
$config['doctrine']['cache'] = ['array' => []];
$config['fastroute']['cache'] = null;
$config['monolog']['level'] = Logger::DEBUG;
$config['monolog']['level'] = Level::Notice;

return $config;
6 changes: 3 additions & 3 deletions config/prod.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@
use Chubbyphp\Validation\ServiceFactory\ValidationMappingProviderRegistryFactory;
use Chubbyphp\Validation\ServiceFactory\ValidatorFactory;
use Chubbyphp\Validation\ValidatorInterface;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\DBAL\Tools\Console\ConnectionProvider;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Tools\Console\EntityManagerProvider;
use Monolog\Logger;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Monolog\Level;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Server\MiddlewareInterface;
Expand Down Expand Up @@ -206,6 +206,6 @@
'monolog' => [
'name' => 'petstore',
'path' => $logDir . '/' . $env . '.log',
'level' => Logger::NOTICE,
'level' => Level::Notice,
],
];
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ services:
- postgres
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- '9003:9003'
postgres:
container_name: petstore-postgres
hostname: petstore-postgres
Expand Down
36 changes: 18 additions & 18 deletions docker/development/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
FROM rockylinux:9.1
FROM rockylinux:9.3

SHELL ["/bin/bash", "-c"]

RUN dnf upgrade -y --refresh

RUN dnf install -y epel-release https://rpms.remirepo.net/enterprise/remi-release-9.1.rpm
RUN dnf install -y epel-release https://rpms.remirepo.net/enterprise/remi-release-9.rpm

RUN dnf install -y --nobest \
compat-openssl11 \
git \
glibc-langpack-de \
langpacks-de \
nmap-ncat \
php82-php-ast \
php82-php-cli \
php82-php-devel \
php82-php-fpm \
php82-php-intl \
php82-php-mbstring \
php82-php-opcache \
php82-php-pecl-apcu \
php82-php-pecl-pcov \
php82-php-pecl-xdebug3 \
php82-php-pecl-zip \
php82-php-pgsql \
php82-php-xml \
php83-php-ast \
php83-php-cli \
php83-php-devel \
php83-php-fpm \
php83-php-intl \
php83-php-mbstring \
php83-php-opcache \
php83-php-pecl-apcu \
php83-php-pecl-pcov \
php83-php-pecl-xdebug3 \
php83-php-pecl-zip \
php83-php-pgsql \
php83-php-xml \
procps-ng \
sudo \
supervisor \
unzip \
vim \
zsh

RUN ln -sf /usr/bin/php82 /usr/bin/php \
&& rm /etc/opt/remi/php82/php.d/15-xdebug.ini \
&& rm /etc/opt/remi/php82/php.d/40-pcov.ini
RUN ln -sf /usr/bin/php83 /usr/bin/php \
&& rm /etc/opt/remi/php83/php.d/15-xdebug.ini \
&& rm /etc/opt/remi/php83/php.d/40-pcov.ini

ENV TZ=Europe/Zurich

Expand Down
2 changes: 1 addition & 1 deletion docker/development/php/files/etc/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
serverurl=unix:///tmp/supervisor.sock

[program:php-fpm]
command=/opt/remi/php82/root/usr/sbin/php-fpm -c /etc/opt/remi/php82/php-fpm.conf -F
command=/opt/remi/php83/root/usr/sbin/php-fpm -c /etc/opt/remi/php83/php-fpm.conf -F
stdout_logfile=/tmp/supervisord.log
stdout_syslog=true
stderr_logfile=/tmp/supervisord.log
Expand Down
8 changes: 4 additions & 4 deletions docker/development/php/files/home/php/.sharedrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ alias rm='rm -i'

alias php-fpm-restart='/usr/bin/supervisorctl -c /etc/supervisord.conf restart php-fpm'

alias xdebug-on='echo "zend_extension=xdebug.so" | sudo tee /etc/opt/remi/php82/php.d/15-xdebug.ini && php-fpm-restart'
alias xdebug-off='sudo rm /etc/opt/remi/php82/php.d/15-xdebug.ini && php-fpm-restart'
alias pcov-on='echo "extension=pcov.so" | sudo tee /etc/opt/remi/php82/php.d/40-pcov.ini && php-fpm-restart'
alias pcov-off='sudo rm /etc/opt/remi/php82/php.d/40-pcov.ini && php-fpm-restart'
alias xdebug-on='echo "zend_extension=xdebug.so" | sudo tee /etc/opt/remi/php83/php.d/15-xdebug.ini && php-fpm-restart'
alias xdebug-off='sudo rm /etc/opt/remi/php83/php.d/15-xdebug.ini && php-fpm-restart'
alias pcov-on='echo "extension=pcov.so" | sudo tee /etc/opt/remi/php83/php.d/40-pcov.ini && php-fpm-restart'
alias pcov-off='sudo rm /etc/opt/remi/php83/php.d/40-pcov.ini && php-fpm-restart'
Loading

0 comments on commit eefe67a

Please sign in to comment.