Skip to content
Open

WIP #23

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
19 changes: 19 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
pull_request: null
push:
branches:
- master
- '*.*'

name: phpunit

jobs:
phpunit:
uses: spiral/gh-actions/.github/workflows/phpunit.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.2']
stability: >-
['prefer-lowest', 'prefer-stable']
17 changes: 17 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
pull_request: null
push:
branches:
- master
- '*.*'

name: static analysis

jobs:
psalm:
uses: spiral/gh-actions/.github/workflows/psalm.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.2']
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ victoria-metrics-data
vendor
runtime
rr*
protoc-gen-php-grpc*
centrifugo*
influxd*
spiral*
.env
.phpunit.result.cache
composer.lock
.phpunit.cache
.deptrac.cache
.phpunit.cache/

10 changes: 8 additions & 2 deletions .rr.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.7'
version: '3'

rpc:
listen: tcp://127.0.0.1:6001
Expand Down Expand Up @@ -38,6 +38,7 @@ service:
restart_sec: 1
command: "npm run dev"
env:
NODE_OPTIONS: --openssl-legacy-provider
API_URL: http://127.0.0.1:8080
WS_URL: ws://127.0.0.1:8080/connection/websocket
centrifuge:
Expand All @@ -56,6 +57,11 @@ service:
restart_sec: 1
command: "php app.php take:snapshots --period=15"

kv:
settings:
driver: memory
config: { }

metrics:
address: 127.0.0.1:2112

Expand All @@ -64,4 +70,4 @@ centrifuge:
grpc_api_address: "tcp://127.0.0.1:10000"
pool:
reset_timeout: 10
num_workers: 2
num_workers: 4
4 changes: 2 additions & 2 deletions app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use App\Application\App;
use App\Application\Kernel;

// If you forgot to configure some of this in your php.ini file,
// then don't worry, we will set the standard environment
Expand All @@ -17,7 +17,7 @@


// Initialize shared container, bindings, directories and etc.
$app = App::create(
$app = Kernel::create(
directories: ['root' => __DIR__]
)->run();

Expand Down
3 changes: 3 additions & 0 deletions app/config/broadcasting.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
'connections' => [
'centrifugo' => [
'driver' => 'centrifugo',
],
'null' => [
'driver' => 'null',
]
],
];
7 changes: 5 additions & 2 deletions app/config/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* The default cache connection that gets used while using this caching library.
*/
'default' => env('CACHE_STORAGE', 'local'),
'default' => env('CACHE_STORAGE', 'roadrunner'),

/**
* Aliases, if you want to use domain specific storages.
Expand All @@ -24,9 +24,12 @@
* Here you may define all of the cache "storages" for your application as well as their types.
*/
'storages' => [
'local' => [
'roadrunner' => [
'type' => 'roadrunner',
'driver' => 'settings',
],
'local' => [
'type' => ArrayStorage::class,
],
],
];
77 changes: 0 additions & 77 deletions app/src/Application/App.php

This file was deleted.

24 changes: 15 additions & 9 deletions app/src/Application/Bootloader/AppBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@

namespace App\Application\Bootloader;

use App\Application\HTTP\Response\JsonResourceInterceptor;
use App\Application\Persistance\CacheSettingsRepository;
use App\Application\HTTP\Interceptor\JsonResourceInterceptor;
use App\Infrastructure\RoadRunner\CacheSettingsRepository;
use App\Module\Settings\SettingsRepositoryInterface;
use Spiral\Bootloader\DomainBootloader;
use Spiral\Core\CoreInterface;

final class AppBootloader extends DomainBootloader
{
protected const INTERCEPTORS = [
JsonResourceInterceptor::class,
];
protected static function defineInterceptors(): array
{
return [
JsonResourceInterceptor::class,
];
}

protected const SINGLETONS = [
SettingsRepositoryInterface::class => CacheSettingsRepository::class,
CoreInterface::class => [self::class, 'domainCore'],
];
public function defineSingletons(): array
{
return [
SettingsRepositoryInterface::class => CacheSettingsRepository::class,
CoreInterface::class => [self::class, 'domainCore'],
];
}
}
15 changes: 9 additions & 6 deletions app/src/Application/Bootloader/ExceptionHandlerBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace App\Application\Bootloader;

use Spiral\Boot\Bootloader\Bootloader;
use Spiral\Exceptions\ExceptionHandlerInterface;
use Spiral\Exceptions\ExceptionHandler;
use Spiral\Exceptions\Reporter\FileReporter;
use Spiral\Exceptions\Reporter\LoggerReporter;
use Spiral\Http\ErrorHandler\PlainRenderer;
Expand All @@ -15,13 +15,16 @@

final class ExceptionHandlerBootloader extends Bootloader
{
protected const BINDINGS = [
SuppressErrorsInterface::class => EnvSuppressErrors::class,
RendererInterface::class => PlainRenderer::class,
];
public function defineBindings(): array
{
return [
SuppressErrorsInterface::class => EnvSuppressErrors::class,
RendererInterface::class => PlainRenderer::class,
];
}

public function boot(
ExceptionHandlerInterface $handler,
ExceptionHandler $handler,
LoggerReporter $logger,
FileReporter $files
): void {
Expand Down
9 changes: 6 additions & 3 deletions app/src/Application/Bootloader/HttpClientBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

final class HttpClientBootloader extends Bootloader
{
protected const SINGLETONS = [
HttpClientInterface::class => NativeHttpClient::class,
];
public function defineSingletons(): array
{
return [
HttpClientInterface::class => NativeHttpClient::class,
];
}
}
45 changes: 0 additions & 45 deletions app/src/Application/Bootloader/LoggingBootloader.php

This file was deleted.

9 changes: 6 additions & 3 deletions app/src/Application/Bootloader/PrometheusParserBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@

final class PrometheusParserBootloader extends Bootloader
{
protected const SINGLETONS = [
Parser::class => [self::class, 'initParser'],
];
public function defineSingletons(): array
{
return [
Parser::class => [self::class, 'initParser'],
];
}

private function initParser(): Parser
{
Expand Down
Loading