Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'psalm.xml'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand Down Expand Up @@ -39,9 +40,9 @@ jobs:
- ubuntu-latest
- windows-latest
php:
- "8.1"
- "8.2"
- "8.3"
- "8.4"

steps:
- name: Checkout.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3']
['8.2', '8.3', '8.4']
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.3']
['8.4']
3 changes: 2 additions & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- 'phpunit.xml.dist'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -30,5 +31,5 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3']
['8.2', '8.3', '8.4']

2 changes: 1 addition & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
preset: psr12
risky: true

version: 8.1
version: 8.2

finder:
exclude:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ codecept: run-test
psalm: CMD="./vendor/bin/psalm" ## Run Psalm.
psalm: run

rector: CMD="./vendor/bin/rector" ## Run Rector.
rector: run

build-prod: ## Build an image.
docker build --file docker/Dockerfile --target prod --pull -t ${IMAGE}:${IMAGE_TAG} .

Expand Down
93 changes: 43 additions & 50 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "yiisoft/app",
"type": "project",
"description": "Yii 3 application template",
"description": "Yii3 application template",
"keywords": [
"yii3",
"app"
Expand All @@ -25,8 +25,6 @@
"url": "https://github.com/sponsors/yiisoft"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"serve": [
"Composer\\Config::disableProcessTimeout",
Expand All @@ -42,59 +40,56 @@
]
},
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-filter": "*",
"ext-intl": "*",
"httpsoft/http-message": "^1.1",
"psr/container": "^2.0",
"psr/http-message": "^1.1|^2.0",
"psr/http-server-handler": "^1.0",
"symfony/console": "^6.0",
"httpsoft/http-message": "^1.1.6",
"psr/container": "^2.0.2",
"psr/http-message": "^2.0",
"psr/http-server-handler": "^1.0.2",
"symfony/console": "^7.3.1",
"yiisoft/aliases": "^3.0",
"yiisoft/assets": "^4.0",
"yiisoft/cache": "^3.0",
"yiisoft/cache-file": "^3.0",
"yiisoft/config": "^1.1",
"yiisoft/csrf": "^2.0",
"yiisoft/data-response": "^2.0",
"yiisoft/definitions": "^3.0",
"yiisoft/di": "^1.2",
"yiisoft/error-handler": "^4.0",
"yiisoft/factory": "^1.0",
"yiisoft/assets": "^5.1",
"yiisoft/cache": "^3.1",
"yiisoft/cache-file": "^3.2",
"yiisoft/config": "^1.6",
"yiisoft/csrf": "^2.2.2",
"yiisoft/data-response": "^2.1",
"yiisoft/definitions": "^3.4",
"yiisoft/di": "^1.4",
"yiisoft/error-handler": "^4.1",
"yiisoft/factory": "^1.3",
"yiisoft/files": "^2.0",
"yiisoft/html": "^3.0",
"yiisoft/html": "^3.11",
"yiisoft/http": "^1.2",
"yiisoft/i18n": "^1.1",
"yiisoft/log": "^2.1",
"yiisoft/i18n": "^1.2.1",
"yiisoft/log": "^2.1.1",
"yiisoft/log-target-file": "^3.0",
"yiisoft/router": "^3.0",
"yiisoft/router-fastroute": "^3.0",
"yiisoft/translator": "^3.0",
"yiisoft/translator-message-php": "^1.1",
"yiisoft/view": "^12.0",
"yiisoft/yii-console": "^2.0",
"yiisoft/yii-debug": "dev-master",
"yiisoft/yii-event": "^2.0",
"yiisoft/yii-http": "^1.0",
"yiisoft/yii-middleware": "^1.0",
"yiisoft/yii-runner-console": "^2.0",
"yiisoft/router": "^4",
"yiisoft/router-fastroute": "^4.0.1",
"yiisoft/translator": "^3.1",
"yiisoft/translator-message-php": "^1.1.1",
"yiisoft/view": "^12.2",
"yiisoft/yii-console": "^2.3",
"yiisoft/yii-event": "^2.1",
"yiisoft/yii-http": "^1.0.4",
"yiisoft/yii-middleware": "^1.1.0",
"yiisoft/yii-runner-console": "^2.2",
"yiisoft/yii-runner-http": "^3.2",
"yiisoft/yii-view-renderer": "^7.1"
"yiisoft/yii-view-renderer": "^7.3"
},
"require-dev": {
"codeception/c3": "^2.7",
"codeception/codeception": "^5.0",
"codeception/module-asserts": "^3.0",
"codeception/module-cli": "^2.0",
"codeception/module-phpbrowser": "^3.0",
"maglnet/composer-require-checker": "^4.5",
"rector/rector": "^2.0.3",
"roave/infection-static-analysis-plugin": "^1.34",
"roave/security-advisories": "dev-master",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^5.20",
"yiisoft/yii-debug-api": "3.0.x-dev",
"yiisoft/yii-debug-viewer": "^3.0@dev"
"codeception/c3": "^2.9",
"codeception/codeception": "^5.3.2",
"codeception/module-asserts": "^3.2",
"codeception/module-cli": "^2.0.1",
"codeception/module-phpbrowser": "^3.0.1",
"maglnet/composer-require-checker": "^4.16.1",
"rector/rector": "^2.1.0",
"roave/infection-static-analysis-plugin": "^1.38",
"roave/security-advisories": "dev-latest",
"spatie/phpunit-watcher": "^1.24",
"vimeo/psalm": "^6.12.1"
},
"autoload": {
"psr-4": {
Expand All @@ -107,13 +102,11 @@
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
},
"config-plugin-file": "configuration.php"
},
"config": {
"sort-packages": true,
"bump-after-update": true,
"allow-plugins": {
"yiisoft/config": true,
"infection/extension-installer": true,
Expand Down
10 changes: 3 additions & 7 deletions config/common/di/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
declare(strict_types=1);

use Yiisoft\Config\Config;
use Yiisoft\Csrf\CsrfMiddleware;
use Yiisoft\Csrf\CsrfTokenMiddleware;
use Yiisoft\DataResponse\Middleware\FormatDataResponse;
use Yiisoft\Router\Group;
use Yiisoft\Router\RouteCollection;
use Yiisoft\Router\RouteCollectionInterface;
use Yiisoft\Router\RouteCollectorInterface;
Expand All @@ -15,12 +14,9 @@
return [
RouteCollectionInterface::class => static function (RouteCollectorInterface $collector) use ($config) {
$collector
->middleware(CsrfMiddleware::class)
->middleware(CsrfTokenMiddleware::class)
->middleware(FormatDataResponse::class)
->addGroup(
Group::create()
->routes(...$config->get('routes'))
);
->addRoute(...$config->get('routes'));

return new RouteCollection($collector);
},
Expand Down
6 changes: 1 addition & 5 deletions config/environments/dev/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@

declare(strict_types=1);

return [
'yiisoft/yii-debug' => [
'enabled' => true,
],
];
return [];
6 changes: 1 addition & 5 deletions config/environments/prod/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@

declare(strict_types=1);

return [
'yiisoft/yii-debug' => [
'enabled' => false,
],
];
return [];
6 changes: 1 addition & 5 deletions config/environments/test/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@

declare(strict_types=1);

return [
'yiisoft/yii-debug' => [
'enabled' => false,
],
];
return [];
28 changes: 14 additions & 14 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM composer/composer:latest-bin AS composer

FROM ghcr.io/shyim/wolfi-php/frankenphp:8.3 AS base
FROM ghcr.io/shyim/wolfi-php/frankenphp:8.2 AS base
ARG UID=10001
ARG GID=10001
RUN <<SH
Expand All @@ -17,18 +17,18 @@ RUN <<SH

# Install extra packages.
apk add --no-cache \
php-frankenphp-8.3-opcache \
php-frankenphp-8.3-mbstring \
php-frankenphp-8.3-intl \
php-frankenphp-8.3-dom \
php-frankenphp-8.3-ctype \
php-frankenphp-8.3-curl \
php-frankenphp-8.3-phar \
php-frankenphp-8.3-openssl \
php-frankenphp-8.3-xml \
php-frankenphp-8.3-xmlwriter \
php-frankenphp-8.3-simplexml \
php-frankenphp-8.3-pdo
php-frankenphp-8.2-opcache \
php-frankenphp-8.2-mbstring \
php-frankenphp-8.2-intl \
php-frankenphp-8.2-dom \
php-frankenphp-8.2-ctype \
php-frankenphp-8.2-curl \
php-frankenphp-8.2-phar \
php-frankenphp-8.2-openssl \
php-frankenphp-8.2-xml \
php-frankenphp-8.2-xmlwriter \
php-frankenphp-8.2-simplexml \
php-frankenphp-8.2-pdo
SH

FROM base AS prod-builder
Expand Down Expand Up @@ -58,7 +58,7 @@ RUN <<SH

# Install extra packages for dev only.
apk add --no-cache \
php-frankenphp-8.3-xdebug
php-frankenphp-8.2-xdebug
SH

COPY --from=composer /composer /usr/bin/composer
Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="false"
ensureOverrideAttribute="false"
strictBinaryOperands="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// PHP built-in server routing.
if (PHP_SAPI === 'cli-server') {
// Serve static files as is.
/** @psalm-suppress MixedArgument */
/** @var string */
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if (is_file(__DIR__ . $path)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_81,
LevelSetList::UP_TO_PHP_82,
]);

$rectorConfig->skip([
Expand Down
7 changes: 7 additions & 0 deletions src/Asset/AppAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
namespace App\Asset;

use Yiisoft\Assets\AssetBundle;
use Yiisoft\Assets\AssetManager;

/**
* @psalm-import-type CssFile from AssetManager
*/
final class AppAsset extends AssetBundle
{
public ?string $basePath = '@assets';
public ?string $baseUrl = '@assetsUrl';
public ?string $sourcePath = '@resources/assets/css';

/**
* @psalm-var array<array-key, CssFile|string>
*/
public array $css = [
'site.css',
];
Expand Down
20 changes: 5 additions & 15 deletions src/Command/Hello.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,18 @@

namespace App\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Yiisoft\Yii\Console\ExitCode;

#[AsCommand(
name: 'hello',
description: 'An example command',
)]
final class Hello extends Command
{
public function __construct()
{
parent::__construct();
}

public static function getDefaultName(): string
{
return 'hello';
}

public static function getDefaultDescription(): string
{
return 'An example command';
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln('Hello!');
Expand Down
4 changes: 2 additions & 2 deletions src/Handler/NotFoundHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
final class NotFoundHandler implements RequestHandlerInterface
{
public function __construct(
private UrlGeneratorInterface $urlGenerator,
private CurrentRoute $currentRoute,
private readonly UrlGeneratorInterface $urlGenerator,
private readonly CurrentRoute $currentRoute,
private ViewRenderer $viewRenderer
) {
$this->viewRenderer = $viewRenderer->withControllerName('site');
Expand Down
Loading