Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
21 changes: 19 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,23 @@
},
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4",
"ext-sockets": "*",
"clue/socket-raw": "^v1.6.0",
"dotkernel/dot-cache": "^4.3",
"dotkernel/dot-cli": "^3.9",
"dotkernel/dot-errorhandler": "^4.2.1",
"dotkernel/dot-data-fixtures": "^1.4.0",
"dotkernel/dot-dependency-injection": "^1.2",
"dotkernel/dot-errorhandler": "^4.0.0",
Comment thread
alexmerlin marked this conversation as resolved.
Outdated
"dotkernel/dot-mail": "^5.3.0",
"dotkernel/dot-twigrenderer": "3.6.0",
"laminas/laminas-component-installer": "^3.5",
"laminas/laminas-config-aggregator": "^1.18",
"mezzio/mezzio": "^3.20",
"mezzio/mezzio-authentication-oauth2": "^2.11",
"netglue/laminas-messenger": "^2.3.0",
"ramsey/uuid": "^4.5.0",
"ramsey/uuid-doctrine": "^2.1.0",
"roave/psr-container-doctrine": "^5.2.2",
"symfony/redis-messenger": "^v7.2.3"
},
"require-dev": {
Expand All @@ -63,7 +74,13 @@
},
"autoload": {
"psr-4": {
"Queue\\": "src/"
"Queue\\": "src/",
"Core\\Admin\\": "src/Core/src/Admin/src",
"Core\\App\\": "src/Core/src/App/src",
"Core\\Security\\": "src/Core/src/Security/src",
"Core\\Setting\\": "src/Core/src/Setting/src",
"Core\\User\\": "src/Core/src/User/src",
"Core\\NotificationSystem\\": "src/Core/src/NotificationSystem/src"
}
},
"autoload-dev": {
Expand Down
1 change: 1 addition & 0 deletions config/autoload/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
local.php
*.local.php
mail.global.php
Comment thread
alexmerlin marked this conversation as resolved.
Outdated
38 changes: 37 additions & 1 deletion config/autoload/local.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,41 @@

declare(strict_types=1);

return [
$baseUrl = 'http://localhost:8080';

$databases = [
'default' => [
Comment thread
alexmerlin marked this conversation as resolved.
'host' => '',
'dbname' => '',
'user' => '',
'password' => '',
'port' => ,
'driver' => 'pdo_mysql',
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_general_ci',
],
// you can add more database connections into this array
];

return [
'application' => [
'name' => $app['name'] ?? '',
'url' => $baseUrl,
],
'databases' => $databases,
'doctrine' => [
'connection' => [
'orm_default' => [
'params' => $databases['default'],
],
],
],
'notification' => [
'server' => [
'protocol' => '',
'host' => '',
'port' => '',
'eof' => "\n",
],
],
];
Comment thread
alexmerlin marked this conversation as resolved.
Outdated
2 changes: 1 addition & 1 deletion config/autoload/log.local.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ return [
]
],
],
];
];
Comment thread
alexmerlin marked this conversation as resolved.
80 changes: 80 additions & 0 deletions config/autoload/mail.global.php.dist
Comment thread
alexmerlin marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

declare(strict_types=1);

return [
/**
* Dotkernel mail module configuration
* Note that many of these options can be set programmatically too, when sending mail messages actually that is
* what you'll usually do, these configs provide just defaults and options that remain the same for all mails
*/
'dot_mail' => [
//the key is the mail service name, this is the default one, which does not extend any configuration
'default' => [
//message configuration
'message_options' => [
//from email address of the email
'from' => '',
//from name to be displayed instead of from address
'from_name' => '',
//reply-to email address of the email
'reply_to' => '',
//replyTo name to be displayed instead of the address
'reply_to_name' => '',
//destination email address as string or a list of email addresses
'to' => [],
//copy destination addresses
'cc' => [],
//hidden copy destination addresses
'bcc' => [],
//email subject
'subject' => '',
//body options - content can be plain text, HTML
'body' => [
'content' => '',
'charset' => 'utf-8',
],
//attachments config
'attachments' => [
'files' => [],
'dir' => [
'iterate' => false,
'path' => 'data/mail/attachments',
'recursive' => false,
],
],
],
/**
* the mail transport to use can be any class implementing
* Symfony\Component\Mailer\Transport\TransportInterface
*
* for standard mail transports, you can use these aliases:
* - sendmail => Symfony\Component\Mailer\Transport\SendmailTransport
* - esmtp => Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport
*
* defaults to sendmail
**/
'transport' => 'esmtp',
//options that will be used only if esmtp adapter is used
'smtp_options' => [
//hostname or IP address of the mail server
'host' => '',
//port of the mail server - 587 or 465 for secure connections
'port' => 587,
'connection_config' => [
//the smtp authentication identity
'username' => '',
//the smtp authentication credential
'password' => '',
//to disable auto_tls set tls key to false
//it's not recommended to disable TLS while connecting to an SMTP server
'tls' => null,
],
],
],
// option to log the SENT emails
'log' => [
'sent' => getcwd() . '/log/mail/sent.log',
],
],
];
43 changes: 43 additions & 0 deletions config/autoload/templates.global.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

declare(strict_types=1);

use Dot\Twig\Extension\DateExtension;
use Dot\Twig\Extension\TranslationExtension;
use Laminas\ServiceManager\Factory\InvokableFactory;
use Mezzio\Template\TemplateRendererInterface;
use Mezzio\Twig\TwigEnvironmentFactory;
use Mezzio\Twig\TwigRendererFactory;
use Twig\Environment;

return [
'dependencies' => [
'factories' => [
DateExtension::class => InvokableFactory::class,
Environment::class => TwigEnvironmentFactory::class,
TemplateRendererInterface::class => TwigRendererFactory::class,
TranslationExtension::class => InvokableFactory::class,
],
],
'debug' => false,
'templates' => [
'extension' => 'html.twig',
],
'twig' => [
'assets_url' => '/',
'assets_version' => null,
'auto_reload' => true,
'autoescape' => 'html',
'cache_dir' => 'data/cache/twig',
'extensions' => [
DateExtension::class,
TranslationExtension::class,
],
'globals' => [
'appName' => $app['name'] ?? '',
],
'optimizations' => -1,
'runtime_loaders' => [],
// 'timezone' => '',
],
];
30 changes: 23 additions & 7 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,31 @@
$aggregator = new ConfigAggregator([
// Include cache configuration
new ArrayProvider($cacheConfig),
\Mezzio\ConfigProvider::class,
\Dot\ErrorHandler\ConfigProvider::class,
\Dot\Log\ConfigProvider::class,
\Dot\Cli\ConfigProvider::class,
\Netglue\PsrContainer\Messenger\ConfigProvider::class,
Mezzio\ConfigProvider::class,
Mezzio\Twig\ConfigProvider::class,
Netglue\PsrContainer\Messenger\ConfigProvider::class,

// Default App module config
\Queue\App\ConfigProvider::class,
\Queue\Swoole\ConfigProvider::class,
Queue\App\ConfigProvider::class,
Queue\Swoole\ConfigProvider::class,

// Dotkernel packages
Dot\Log\ConfigProvider::class,
Dot\Cli\ConfigProvider::class,
Dot\ErrorHandler\ConfigProvider::class,
Dot\DataFixtures\ConfigProvider::class,
Dot\DependencyInjection\ConfigProvider::class,
Dot\Mail\ConfigProvider::class,
Dot\Twig\ConfigProvider::class,
Dot\Cache\ConfigProvider::class,

// Core modules
Core\Admin\ConfigProvider::class,
Core\App\ConfigProvider::class,
Core\Security\ConfigProvider::class,
Core\Setting\ConfigProvider::class,
Core\User\ConfigProvider::class,
Core\NotificationSystem\ConfigProvider::class,

// Load application config in a pre-defined order in such a way that local settings
// overwrite global settings. (Loaded as first to last):
Expand Down
12 changes: 4 additions & 8 deletions phpcs.xml.dist → phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@
<exclude-pattern>config/routes.php</exclude-pattern>

<!-- Include all rules from the Laminas Coding Standard -->
<rule ref="LaminasCodingStandard"/>

<rule ref="Squiz.Classes.ClassFileName.NoMatch">
<exclude-pattern>src/ConfigProvider.*.php</exclude-pattern>
</rule>

<rule ref="PSR12.Files.FileHeader.IncorrectOrder">
<rule ref="LaminasCodingStandard">
<!-- Exclude rule -->
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName" />
<exclude-pattern>src/Core/src/App/src/Migration/*</exclude-pattern>
<exclude-pattern>config/pipeline.php</exclude-pattern>
<exclude-pattern>src/MezzioInstaller/Resources/config/routes-*.php</exclude-pattern>
</rule>
</ruleset>
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ parameters:
- src
- test
treatPhpDocTypesAsCertain: false
ignoreErrors:
- '#Constant Queue\\Swoole\\Command\\StartCommand::PROGRAMMATIC_CONFIG_FILES is unused#'
14 changes: 12 additions & 2 deletions src/App/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

namespace Queue\App;

use Dot\DependencyInjection\Factory\AttributedServiceFactory;
use Netglue\PsrContainer\Messenger\Container\MessageBusStaticFactory;
use Netglue\PsrContainer\Messenger\Container\Middleware\BusNameStampMiddlewareStaticFactory;
use Netglue\PsrContainer\Messenger\Container\Middleware\MessageHandlerMiddlewareStaticFactory;
use Netglue\PsrContainer\Messenger\Container\Middleware\MessageSenderMiddlewareStaticFactory;
use Netglue\PsrContainer\Messenger\HandlerLocator\OneToManyFqcnContainerHandlerLocator;
use Queue\App\Message\ExampleMessage;
use Queue\App\Message\ExampleMessageHandler;
use Queue\App\Message\ExampleMessageHandlerFactory;
use Symfony\Component\Messenger\MessageBusInterface;

class ConfigProvider
Expand All @@ -25,6 +25,7 @@ public function __invoke(): array
'buses' => $this->busConfig(),
],
],
'templates' => $this->getTemplates(),
];
}

Expand All @@ -36,14 +37,23 @@ private function getDependencies(): array
"message_bus_stamp_middleware" => [BusNameStampMiddlewareStaticFactory::class, "message_bus"],
"message_bus_sender_middleware" => [MessageSenderMiddlewareStaticFactory::class, "message_bus"],
"message_bus_handler_middleware" => [MessageHandlerMiddlewareStaticFactory::class, "message_bus"],
ExampleMessageHandler::class => ExampleMessageHandlerFactory::class,
ExampleMessageHandler::class => AttributedServiceFactory::class,
],
"aliases" => [
MessageBusInterface::class => "message_bus",
],
];
}

public function getTemplates(): array
{
return [
'paths' => [
'notification-email' => [__DIR__ . '/../../templates'],
],
];
}

private function busConfig(): array
{
return [
Expand Down
Loading
Loading