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 324095b commit 8269a34
Show file tree
Hide file tree
Showing 48 changed files with 358 additions and 313 deletions.
28 changes: 14 additions & 14 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@v2
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 @@ -63,12 +63,12 @@ jobs:
- 5432:5432
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: wait for databases
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/
38 changes: 19 additions & 19 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=mezzio)](https://github.com/chubbyphp/petstore/actions?query=workflow%3ACI)
[![Coverage Status](https://coveralls.io/repos/github/chubbyphp/petstore/badge.svg?branch=mezzio)](https://coveralls.io/github/chubbyphp/petstore?branch=mezzio)
[![Infection MSI](https://badge.stryker-mutator.io/github.com/chubbyphp/petstore/mezzio)](https://dashboard.stryker-mutator.io/reports/github.com/chubbyphp/petstore/mezzio)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fchubbyphp%2Fpetstore%mezzio)](https://dashboard.stryker-mutator.io/reports/github.com/chubbyphp/petstore/mezzio)

## Description

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

## 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-http-exception][7]: ^1.0.1
* [chubbyphp/chubbyphp-laminas-config][8]: ^1.3
* [chubbyphp/chubbyphp-laminas-config-doctrine][9]: ^2.0.3
* [chubbyphp/chubbyphp-laminas-config-factory][10]: ^1.2
* [chubbyphp/chubbyphp-negotiation][11]: ^1.9
* [chubbyphp/chubbyphp-serialization][12]: ^3.3.1
* [chubbyphp/chubbyphp-validation][13]: ^3.12.4
* [doctrine/orm][14]: ^2.14
* 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-http-exception][7]: ^1.1
* [chubbyphp/chubbyphp-laminas-config][8]: ^1.4
* [chubbyphp/chubbyphp-laminas-config-doctrine][9]: ^2.2
* [chubbyphp/chubbyphp-laminas-config-factory][10]: ^1.3
* [chubbyphp/chubbyphp-negotiation][11]: ^2.0
* [chubbyphp/chubbyphp-serialization][12]: ^4.0
* [chubbyphp/chubbyphp-validation][13]: ^4.0
* [doctrine/orm][14]: ^2.17.2
* [mezzio/mezzio-fastroute][15]: ^3.7
* [mezzio/mezzio][16]: ^3.14
* [monolog/monolog][17]: ^2.8
* [ramsey/uuid][18]: ^4.7
* [slim/psr7][19]: ^1.6
* [symfony/console][20]: ^6.0.17
* [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 @@ -15,36 +15,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-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",
"mezzio/mezzio-fastroute": "^3.7",
"mezzio/mezzio": "^3.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-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",
"mezzio/mezzio-fastroute": "^3.11",
"mezzio/mezzio": "^3.18",
"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 @@ -90,15 +89,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=95 --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;
23 changes: 11 additions & 12 deletions config/prod.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
use App\RequestHandler\Api\Crud\ListRequestHandler;
use App\RequestHandler\Api\Crud\ReadRequestHandler;
use App\RequestHandler\Api\Crud\UpdateRequestHandler;
use App\RequestHandler\PingRequestHandler;
use Doctrine\DBAL\Connection;
use App\RequestHandler\OpenapiRequestHandler;
use App\RequestHandler\PingRequestHandler;
use App\ServiceFactory\Command\CommandsFactory;
use App\ServiceFactory\Deserialization\DenormalizationObjectMappingsFactory;
use App\ServiceFactory\Deserialization\TypeDecodersFactory;
Expand All @@ -39,8 +38,8 @@
use App\ServiceFactory\RequestHandler\Api\Crud\PetListRequestHandlerFactory;
use App\ServiceFactory\RequestHandler\Api\Crud\PetReadRequestHandlerFactory;
use App\ServiceFactory\RequestHandler\Api\Crud\PetUpdateRequestHandlerFactory;
use App\ServiceFactory\RequestHandler\PingRequestHandlerFactory;
use App\ServiceFactory\RequestHandler\OpenapiRequestHandlerFactory;
use App\ServiceFactory\RequestHandler\PingRequestHandlerFactory;
use App\ServiceFactory\Serialization\NormalizationObjectMappingsFactory;
use App\ServiceFactory\Serialization\TypeEncodersFactory;
use App\ServiceFactory\Validation\ValidationMappingProviderFactory;
Expand Down Expand Up @@ -77,19 +76,20 @@
use Chubbyphp\Validation\ServiceFactory\ValidationMappingProviderRegistryFactory;
use Chubbyphp\Validation\ServiceFactory\ValidatorFactory;
use Chubbyphp\Validation\ValidatorInterface;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Tools\Console\ConnectionProvider;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Tools\Console\EntityManagerProvider;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Laminas\HttpHandlerRunner\Emitter\EmitterInterface;
use Laminas\HttpHandlerRunner\RequestHandlerRunner;
use Laminas\Stratigility\Middleware\ErrorHandler;
use Mezzio\ApplicationPipeline;
use Mezzio\Container\ApplicationPipelineFactory;
use Laminas\Stratigility\MiddlewarePipe;
use Mezzio\Container\EmitterFactory;
use Mezzio\Container\MiddlewareContainerFactory;
use Mezzio\Container\MiddlewareFactoryFactory;
use Mezzio\Container\MiddlewarePipeFactory;
use Mezzio\Container\RequestHandlerRunnerFactory;
use Mezzio\Handler\NotFoundHandler;
use Mezzio\MiddlewareContainer;
Expand All @@ -104,14 +104,14 @@
use Mezzio\Router\RouteCollector;
use Mezzio\Router\RouteCollectorFactory;
use Mezzio\Router\RouterInterface;
use Monolog\Logger;
use Monolog\Level;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Psr\Cache\CacheItemPoolInterface;

$rootDir = \realpath(__DIR__ . '/..');
$cacheDir = $rootDir . '/var/cache/' . $env;
Expand All @@ -131,14 +131,14 @@
'debug' => false,
'dependencies' => [
'aliases' => [
'Mezzio\ApplicationPipeline' => MiddlewarePipe::class,
EntityManager::class => EntityManagerInterface::class,
],
'factories' => [
AcceptAndContentTypeMiddleware::class => AcceptAndContentTypeMiddlewareFactory::class,
AcceptNegotiatorInterface::class . 'supportedMediaTypes[]' => AcceptNegotiatorSupportedMediaTypesFactory::class,
AcceptNegotiatorInterface::class => AcceptNegotiatorFactory::class,
ApiExceptionMiddleware::class => ApiExceptionMiddlewareFactory::class,
ApplicationPipeline::class => ApplicationPipelineFactory::class,
CacheItemPoolInterface::class => ApcuAdapterFactory::class,
Command::class . '[]' => CommandsFactory::class,
Connection::class => ConnectionFactory::class,
Expand All @@ -158,7 +158,7 @@
MethodNotAllowedMiddleware::class => MethodNotAllowedMiddlewareFactory::class,
MiddlewareContainer::class => MiddlewareContainerFactory::class,
MiddlewareFactory::class => MiddlewareFactoryFactory::class,
MiddlewareFactory::class => MiddlewareFactoryFactory::class,
MiddlewarePipe::class => MiddlewarePipeFactory::class,
NormalizationObjectMappingInterface::class . '[]' => NormalizationObjectMappingsFactory::class,
NotFoundHandler::class => NotFoundHandlerFactory::class,
OpenapiRequestHandler::class => OpenapiRequestHandlerFactory::class,
Expand All @@ -185,7 +185,6 @@
StreamFactoryInterface::class => StreamFactoryFactory::class,
TypeDecoderInterface::class . '[]' => TypeDecodersFactory::class,
TypeEncoderInterface::class . '[]' => TypeEncodersFactory::class,
UrlGeneratorInterface::class => UrlGeneratorFactory::class,
ValidationMappingProviderInterface::class . '[]' => ValidationMappingProviderFactory::class,
ValidationMappingProviderRegistryInterface::class => ValidationMappingProviderRegistryFactory::class,
ValidatorInterface::class => ValidatorFactory::class,
Expand Down Expand Up @@ -235,6 +234,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
Loading

0 comments on commit 8269a34

Please sign in to comment.