-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: создал yii2 приложение с rabbit-mq для работы с очередью
- Loading branch information
Showing
83 changed files
with
8,061 additions
and
459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
NGINX_CONTAINER=nginx-hw12 | ||
NGINX_CONTAINER=nginx-hw19 | ||
NGINX_PORTS=80:80 | ||
|
||
PHP_CONTAINER=php-hw12 | ||
PHP_CONTAINER=php-hw19 | ||
|
||
REDIS_CONTAINER=redis-hw12 | ||
REDIS_PORTS=6379:6379 | ||
RABBITMQ_CONTAINER=rabbitmq-19 | ||
RABBITMQ_HOST=rabbitmq | ||
RABBITMQ_USER=user | ||
RABBITMQ_PASS=password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,15 @@ | ||
# Homework 12 | ||
# Homework 19 | ||
|
||
1. `cd app` | ||
2. `cp .env.example .env` | ||
3. `docker-compose up --build -d` | ||
4. `docker-compose exec -it php bash` | ||
5. `cd application.local` | ||
4. `docker-compose exec -it consumer bash` | ||
5. `cd /var/www/application.local` | ||
6. `composer install` | ||
## Команды для работы | ||
7. `php yii consumer` | ||
8. `Перейти в браузере по адресу` [http://application.local/](http://application.local/) | ||
|
||
### Добавление событий | ||
### Пример работы | ||
|
||
`php public/index.php add --priority=1000 --event="event:1" --param1=1 --param2=1` | ||
|
||
`php public/index.php add --priority=2000 --event="event:2" --param1=2 --param2=2` | ||
|
||
`php public/index.php add --priority=3000 --event="event:3" --param1=1 --param2=2` | ||
|
||
### Поиск по параметрам | ||
|
||
`php public/index.php get --param1=1 --param2=2` | ||
|
||
`php public/index.php get --param1=2` | ||
|
||
### Вывести все | ||
|
||
`php public/index.php all` | ||
|
||
### Очистить базу | ||
|
||
`php public/index.php clear` | ||
![](view.png) | ||
![](console.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[global] | ||
daemonize=no | ||
|
||
[www] | ||
user = www-data | ||
group = www-data | ||
listen = /var/run/php-fpm.sock | ||
|
||
listen.owner = www-data | ||
listen.group = www-data | ||
listen.mode = 0666 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory" : "vendor/bower-asset" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,33 @@ | ||
.idea/ | ||
# phpstorm project files | ||
.idea | ||
|
||
# netbeans project files | ||
nbproject | ||
|
||
# zend studio for eclipse project files | ||
.buildpath | ||
.project | ||
.settings | ||
|
||
# windows thumbnail cache | ||
Thumbs.db | ||
|
||
# composer vendor dir | ||
/vendor | ||
/vendor | ||
|
||
# composer itself is not needed | ||
composer.phar | ||
|
||
# Mac DS_Store Files | ||
.DS_Store | ||
|
||
# phpunit itself is not needed | ||
phpunit.phar | ||
# local phpunit config | ||
/phpunit.xml | ||
|
||
tests/_output/* | ||
tests/_support/_generated | ||
|
||
#vagrant folder | ||
/.vagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* @link https://www.yiiframework.com/ | ||
* @copyright Copyright (c) 2008 Yii Software LLC | ||
* @license https://www.yiiframework.com/license/ | ||
*/ | ||
|
||
namespace app\assets; | ||
|
||
use yii\web\AssetBundle; | ||
|
||
/** | ||
* Main application asset bundle. | ||
* | ||
* @author Qiang Xue <[email protected]> | ||
* @since 2.0 | ||
*/ | ||
class AppAsset extends AssetBundle | ||
{ | ||
public $basePath = '@webroot'; | ||
public $baseUrl = '@web'; | ||
public $css = [ | ||
'css/site.css', | ||
]; | ||
public $js = [ | ||
]; | ||
public $depends = [ | ||
'yii\web\YiiAsset', | ||
'yii\bootstrap5\BootstrapAsset' | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace app\commands; | ||
|
||
use app\models\RabbitMq; | ||
use app\models\RabbitMqConsumer; | ||
use Exception; | ||
use yii\console\Controller; | ||
|
||
class ConsumerController extends Controller | ||
{ | ||
/** | ||
* @throws Exception | ||
*/ | ||
public function actionIndex(): void | ||
{ | ||
$rabbit = new RabbitMq('bank_statement'); | ||
(new RabbitMqConsumer($rabbit))(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,76 @@ | ||
{ | ||
"name": "artyr/application.local", | ||
"autoload": { | ||
"psr-4": { | ||
"AYamaliev\\hw12\\": "src/" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Artyrcha", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"ext-redis": "*" | ||
} | ||
"name": "yiisoft/yii2-app-basic", | ||
"description": "Yii 2 Basic Project Template", | ||
"keywords": ["yii2", "framework", "basic", "project template"], | ||
"homepage": "https://www.yiiframework.com/", | ||
"type": "project", | ||
"license": "BSD-3-Clause", | ||
"support": { | ||
"issues": "https://github.com/yiisoft/yii2/issues?state=open", | ||
"forum": "https://www.yiiframework.com/forum/", | ||
"wiki": "https://www.yiiframework.com/wiki/", | ||
"irc": "ircs://irc.libera.chat:6697/yii", | ||
"source": "https://github.com/yiisoft/yii2" | ||
}, | ||
"minimum-stability": "stable", | ||
"require": { | ||
"php": ">=8.0", | ||
"yiisoft/yii2": "~2.0.45", | ||
"yiisoft/yii2-bootstrap5": "~2.0.2", | ||
"yiisoft/yii2-symfonymailer": "~2.0.3", | ||
"php-amqplib/php-amqplib": "^3.6" | ||
}, | ||
"require-dev": { | ||
"yiisoft/yii2-debug": "~2.1.0", | ||
"yiisoft/yii2-gii": "~2.2.0", | ||
"yiisoft/yii2-faker": "~2.0.0", | ||
"phpunit/phpunit": "~9.5.0", | ||
"codeception/codeception": "^5.0.0 || ^4.0", | ||
"codeception/lib-innerbrowser": "^4.0 || ^3.0 || ^1.1", | ||
"codeception/module-asserts": "^3.0 || ^1.1", | ||
"codeception/module-yii2": "^1.1", | ||
"codeception/module-filesystem": "^3.0 || ^2.0 || ^1.1", | ||
"codeception/verify": "^3.0 || ^2.2", | ||
"symfony/browser-kit": "^6.0 || >=2.7 <=4.2.4" | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"yiisoft/yii2-composer" : true | ||
}, | ||
"process-timeout": 1800, | ||
"fxp-asset": { | ||
"enabled": false | ||
} | ||
}, | ||
"scripts": { | ||
"post-install-cmd": [ | ||
"yii\\composer\\Installer::postInstall" | ||
], | ||
"post-create-project-cmd": [ | ||
"yii\\composer\\Installer::postCreateProject", | ||
"yii\\composer\\Installer::postInstall" | ||
] | ||
}, | ||
"extra": { | ||
"yii\\composer\\Installer::postCreateProject": { | ||
"setPermission": [ | ||
{ | ||
"runtime": "0777", | ||
"web/assets": "0777", | ||
"yii": "0755" | ||
} | ||
] | ||
}, | ||
"yii\\composer\\Installer::postInstall": { | ||
"generateCookieValidationKey": [ | ||
"config/web.php" | ||
] | ||
} | ||
}, | ||
"repositories": [ | ||
{ | ||
"type": "composer", | ||
"url": "https://asset-packagist.org" | ||
} | ||
] | ||
} |
Oops, something went wrong.