diff --git a/docs/book/v1/how-to/communication-with-queue.md b/docs/book/v1/how-to/communication-with-queue.md index 9659617..6b3df7e 100644 --- a/docs/book/v1/how-to/communication-with-queue.md +++ b/docs/book/v1/how-to/communication-with-queue.md @@ -6,7 +6,7 @@ Communication with the [`Dotkernel Queue`](https://github.com/dotkernel/queue) The main advantage of the procedural code is its simplicity, it directly connects to the queue server, sends the prepared data, and then closes the connection. In this example, the code opens a TCP connection to `localhost:8556`, checks if the connection is successful, sends data in JSON format, and closes the socket. This makes the logic easy to follow and quick to implement. The disadvantage of this approach is the difficulty of reusing and extending the code. As the complexity of the project increases by repeatedly using this approach, the code becomes more difficult to maintain and not as flexible compared to the object-oriented approach. -```shell +```php // collect the PAYLOAD that will be sent to Dotkernel Queue $data = $anyTypeOfData; @@ -44,7 +44,7 @@ Inside it, create a new `ConfigProvider.php`, a new `NotificationService.php` an ConfigProvider code: -```shell +```php **_NOTE:_** if you only have the local.php.dist file, duplicate it, and delete .dist from the copy's name. -```shell +```php 'notification' => [ 'server' => [ 'protocol' => 'tcp', @@ -192,7 +196,7 @@ After you have added the new config provider, navigate to `config/autoload/local Navigate to your handler, inject the new service and use your custom method where needed. -```shell +```php #[Inject( NotificationService::class )] diff --git a/docs/book/v1/how-to/send-emails.md b/docs/book/v1/how-to/send-emails.md index 7a92812..5605b1d 100644 --- a/docs/book/v1/how-to/send-emails.md +++ b/docs/book/v1/how-to/send-emails.md @@ -19,31 +19,35 @@ Importing the Core is essential for the queue to communicate with the main appli After adding the Core, you need to make sure all external dependencies are included in composer.json. Without them, Core functionalities (cache, mail, authentication, etc.) won’t work in the queue. -```shell -"dotkernel/dot-cache": "^4.3", -"dotkernel/dot-data-fixtures": "^1.4.0", -"dotkernel/dot-errorhandler": "4.2.1", -"dotkernel/dot-mail": "^5.3.0", -"laminas/laminas-authentication": "2.18.0", -"mezzio/mezzio-authentication-oauth2": "^2.11", -"mezzio/mezzio-twigrenderer": "^2.17.0", -"ramsey/uuid": "^4.5.0", -"ramsey/uuid-doctrine": "^2.1.0", -"roave/psr-container-doctrine": "^5.2.2", +```json +{ + "dotkernel/dot-cache": "^4.3", + "dotkernel/dot-data-fixtures": "^1.4.0", + "dotkernel/dot-errorhandler": "4.2.1", + "dotkernel/dot-mail": "^5.3.0", + "laminas/laminas-authentication": "2.18.0", + "mezzio/mezzio-authentication-oauth2": "^2.11", + "mezzio/mezzio-twigrenderer": "^2.17.0", + "ramsey/uuid": "^4.5.0", + "ramsey/uuid-doctrine": "^2.1.0", + "roave/psr-container-doctrine": "^5.2.2" +} ``` Adding Core modules under `autoload` → `psr-4` enables automatic class loading, so you don’t have to manually require each class. -```shell -"autoload": { +```json +{ + "autoload": { "psr-4": { - "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", + "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", } + } } ``` @@ -61,7 +65,7 @@ Running `composer install` ensures that all packages required for Core and the q Navigate to `config/config.php` and add `ConfigProvider::class` file from all packages you installed. -```shell +```php Mezzio\Twig\ConfigProvider::class, Dot\Cache\ConfigProvider::class, Dot\DataFixtures\ConfigProvider::class, @@ -80,7 +84,7 @@ Core\User\ConfigProvider::class, Navigate to `config/autoload/local.php` and fill in the database connection details. > **_NOTE:_** if you only have the local.php.dist file, duplicate it, and delete .dist from the copy's name. -```shell +```php $databases = [ 'default' => [ 'host' => '',