Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ef09123
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
beb53cf
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
727d2b7
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
2fb2b1e
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
bc0c312
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
6b0cf13
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
4f3991b
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
ccdcecc
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
83dfacc
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
64e2338
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
a4724ae
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
9f94685
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
98bef7f
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
e2c0b4c
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
5c39366
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
ea607cd
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
d6abbc9
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 2, 2026
c036128
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 3, 2026
d502b82
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 3, 2026
e3b62ae
Issue #67: Implement MariaDB/PostgreSQL connection
alexmerlin Mar 3, 2026
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
4 changes: 2 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -36,7 +36,7 @@ jobs:
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
checks: write
strategy:
matrix:
php-versions: [ '8.2', '8.3', '8.4']
php-versions: [ '8.2', '8.3', '8.4' ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
fetch-depth: 0 # a full history is required for pull request analysis
Expand All @@ -33,7 +33,7 @@ jobs:
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -35,7 +35,7 @@ jobs:
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/.phpunit.cache
/clover.xml
/coveralls-upload.json
/phpunit.xml
/vendor/
.idea
composer.lock
.phpunit.result.cache
69 changes: 69 additions & 0 deletions bin/composer-post-install-script.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

declare(strict_types=1);

require_once 'vendor/autoload.php';

const ENVIRONMENT_DEVELOPMENT = 'development';
const ENVIRONMENT_PRODUCTION = 'production';

// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols

/**
* @param array{source: string, destination: string, environment: array<string>} $file
*/
function copyFile(array $file): void
{
if (! in_array(getEnvironment(), $file['environment'])) {
echo "Skipping the copy of {$file['source']} due to environment settings." . PHP_EOL;
return;
}

if (is_readable($file['destination'])) {
echo "File {$file['destination']} already exists. Skipping..." . PHP_EOL;
return;
}

if (! copy($file['source'], $file['destination'])) {
echo "Cannot copy {$file['source']} file to {$file['destination']}" . PHP_EOL;
} else {
echo "File {$file['source']} copied successfully to {$file['destination']}." . PHP_EOL;
}
}

function getEnvironment(): string
{
return getenv('COMPOSER_DEV_MODE') === '1' ? ENVIRONMENT_DEVELOPMENT : ENVIRONMENT_PRODUCTION;
}

/**
* When adding files to the below array:
* - `source` and `destination` paths must be relative to the project root folder
* - `environment` key will indicate on what environments the file will be copied
*/
$files = [
[
'source' => 'config/autoload/local.php.dist',
'destination' => 'config/autoload/local.php',
'environment' => [ENVIRONMENT_DEVELOPMENT, ENVIRONMENT_PRODUCTION],
],
[
'source' => 'config/autoload/log.local.php.dist',
'destination' => 'config/autoload/log.local.php',
'environment' => [ENVIRONMENT_DEVELOPMENT, ENVIRONMENT_PRODUCTION],
],
[
'source' => 'config/autoload/messenger.local.php.dist',
'destination' => 'config/autoload/messenger.local.php',
'environment' => [ENVIRONMENT_DEVELOPMENT, ENVIRONMENT_PRODUCTION],
],
[
'source' => 'config/autoload/swoole.local.php.dist',
'destination' => 'config/autoload/swoole.local.php',
'environment' => [ENVIRONMENT_DEVELOPMENT, ENVIRONMENT_PRODUCTION],
],
];

echo "Using environment setting: " . getEnvironment() . PHP_EOL;

array_walk($files, 'copyFile');
27 changes: 27 additions & 0 deletions bin/doctrine
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

use Core\App\Event\TablePrefixEventListener;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Events;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Doctrine\ORM\Tools\Console\EntityManagerProvider\SingleManagerProvider;
use Dot\DataFixtures\Command\ExecuteFixturesCommand;
use Dot\DataFixtures\Command\ListFixturesCommand;

require_once 'vendor/autoload.php';

$container = require 'config/container.php';

$entityManager = $container->get(EntityManager::class);
$entityManager->getEventManager()
->addEventListener(Events::loadClassMetadata, $container->get(TablePrefixEventListener::class));

$commands = [
$container->get(ExecuteFixturesCommand::class),
$container->get(ListFixturesCommand::class),
];

ConsoleRunner::run(new SingleManagerProvider($entityManager), $commands);
51 changes: 33 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,37 @@
},
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"dotkernel/dot-cli": "^3.9",
"dotkernel/dot-dependency-injection": "^1.2",
"dotkernel/dot-errorhandler": "4.2.1",
"laminas/laminas-component-installer": "^3.5",
"laminas/laminas-config-aggregator": "^1.18",
"mezzio/mezzio": "^3.20",
"netglue/laminas-messenger": "^2.3.0",
"symfony/redis-messenger": "^v7.2.3"
"ext-redis": "*",
"dotkernel/dot-cache": "^4.4",
"dotkernel/dot-cli": "^3.10",
"dotkernel/dot-data-fixtures": "^1.5",
"dotkernel/dot-dependency-injection": "^1.3",
"dotkernel/dot-errorhandler": "4.4.0",
"laminas/laminas-component-installer": "^3.7",
"laminas/laminas-config-aggregator": "^1.19",
"mezzio/mezzio": "^3.27.0",
"netglue/laminas-messenger": "^2.5.0",
"ramsey/uuid": "^4.9.2",
"ramsey/uuid-doctrine": "^2.1",
"roave/psr-container-doctrine": "^5.2.2 || ^6.1.0",
"symfony/polyfill-php83": "^1.33",
"symfony/redis-messenger": "^7.4.6"
},
"require-dev": {
"laminas/laminas-coding-standard": "^3.0",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^10.5.45",
"laminas/laminas-coding-standard": "^3.1",
"laminas/laminas-development-mode": "^3.15",
"phpstan/phpstan": "^2.1.40",
"phpstan/phpstan-doctrine": "^2.0.18",
"phpstan/phpstan-phpunit": "^2.0.16",
"phpunit/phpunit": "^10.5.63",
"roave/security-advisories": "dev-master",
"swoole/ide-helper": "~5.0.0"
"swoole/ide-helper": "~5.0.3"
},
"autoload": {
"psr-4": {
"Queue\\": "src/"
"Core\\App\\": "src/Core/src/App/src/",
"Queue\\App\\": "src/App/src/",
"Queue\\Swoole\\": "src/Swoole/src/"
}
},
"autoload-dev": {
Expand All @@ -81,8 +91,13 @@
],
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
"static-analysis": "phpstan analyse --memory-limit 1G"
"development-disable": "laminas-development-mode disable",
"development-enable": "laminas-development-mode enable",
"development-status": "laminas-development-mode status",
"post-update-cmd": [
"php ./bin/composer-post-install-script.php"
],
"static-analysis": "phpstan analyse --memory-limit 1G",
"test": "phpunit --colors=always"
}
}
14 changes: 7 additions & 7 deletions config/autoload/cli.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
'version' => '1.0.0',
'name' => 'DotKernel CLI',
'commands' => [
"swoole:start" => StartCommand::class,
"swoole:stop" => StopCommand::class,
"messenger:start" => ConsumeMessagesCommand::class,
"messenger:debug" => DebugCommand::class,
"processed" => GetProcessedMessagesCommand::class,
"failed" => GetFailedMessagesCommand::class,
"inventory" => GetQueuedMessagesCommand::class,
'swoole:start' => StartCommand::class,
'swoole:stop' => StopCommand::class,
'messenger:start' => ConsumeMessagesCommand::class,
'messenger:debug' => DebugCommand::class,
'processed' => GetProcessedMessagesCommand::class,
'failed' => GetFailedMessagesCommand::class,
'inventory' => GetQueuedMessagesCommand::class,
],
],
FileLockerInterface::class => [
Expand Down
17 changes: 9 additions & 8 deletions config/autoload/dependencies.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@

declare(strict_types=1);

use Doctrine\Migrations\Tools\Console\Command\ExecuteCommand;
use Roave\PsrContainerDoctrine\Migrations\CommandFactory;

return [
// Provides application-wide services.
// We recommend using fully-qualified class names whenever possible as
// service names.
// We recommend using fully qualified class names whenever possible as service names.
'dependencies' => [
// Use 'aliases' to alias a service name to another service. The
// key is the alias name, the value is the service to which it points.
// Use 'aliases' to alias a service name to another service.
// The key is the alias name, the value is the service to which it points.
'aliases' => [
// Fully\Qualified\ClassOrInterfaceName::class => Fully\Qualified\ClassName::class,
],
// Use 'invokables' for constructor-less services, or services that do
// not require arguments to the constructor. Map a service name to the
// class name.
// Use 'invokables' for constructorless services, or services that do not require arguments to the constructor.
// Map a service name to the class name.
'invokables' => [
// Fully\Qualified\InterfaceName::class => Fully\Qualified\ClassName::class,
],
// Use 'factories' for services provided by callbacks/factory classes.
'factories' => [
// Fully\Qualified\ClassName::class => Fully\Qualified\FactoryName::class,
ExecuteCommand::class => CommandFactory::class,
],
],
];
40 changes: 28 additions & 12 deletions config/autoload/local.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,45 @@ declare(strict_types=1);
$baseUrl = 'https://queue.dotkernel.net';

$databases = [
'default' => [
'host' => '',
'dbname' => '',
'user' => '',
'password' => '',
'port' => 3306,
'driver' => 'pdo_mysql',
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_general_ci',
/**
* You can add more database connections to this array.
* Only one active connection is allowed at a time.
* By default, the application uses the 'mariadb' connection.
* You can switch to another connection by activating it under doctrine->connection->orm_default-->params.
*/
'mariadb' => [
'host' => 'localhost',
'dbname' => 'dotkernel',
'user' => '',
'password' => '',
'port' => 3306,
'driver' => 'pdo_mysql',
'collation' => 'utf8mb4_general_ci',
'table_prefix' => '',
],
'postgresql' => [
'host' => 'localhost',
'dbname' => 'dotkernel',
'user' => '',
'password' => '',
'port' => 5432,
'driver' => 'pdo_pgsql',
'collation' => 'utf8mb4_general_ci',
'table_prefix' => '',
],
// you can add more database connections into this array
];

return [
'application' => [
'name' => $app['name'] ?? '',
'name' => 'Dotkernel Queue',
'url' => $baseUrl,
],
'databases' => $databases,
'doctrine' => [
'connection' => [
'orm_default' => [
'params' => $databases['default'],
'params' => $databases['mariadb'],
// 'params' => $databases['postgresql'],
],
],
],
Expand Down
12 changes: 6 additions & 6 deletions config/autoload/messenger.local.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use Symfony\Component\Messenger\Transport\Serialization\PhpSerializer;
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface as SymfonySerializer;

return [
"symfony" => [
"messenger" => [
'symfony' => [
'messenger' => [
'transports' => [
'redis_transport' => [
'dsn' => 'redis://127.0.0.1:6379/messages',
Expand All @@ -31,10 +31,10 @@ return [
'failure_transport' => 'failed',
],
],
"dependencies" => [
"factories" => [
"redis_transport" => [TransportFactory::class, 'redis_transport'],
"failed" => [TransportFactory::class, 'failed'],
'dependencies' => [
'factories' => [
'redis_transport' => [TransportFactory::class, 'redis_transport'],
'failed' => [TransportFactory::class, 'failed'],
SymfonySerializer::class => fn(ContainerInterface $container) => new PhpSerializer(),
],
],
Expand Down
Loading