{"id":287599,"date":"2018-08-16T14:12:53","date_gmt":"2018-08-16T10:12:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=287599"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=287599","title":{"rendered":"\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0430\u043d\u0434\u043b\u0430 \u0434\u043b\u044f Symfony 4"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/419451\/\" class=\"post__text post__text-html js-mediator-article\">\n<p>\u041e\u043a\u043e\u043b\u043e \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434 \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u0432\u0437\u044f\u043b\u0430 \u043a\u0443\u0440\u0441 \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u0430 \u043d\u0430 Magento 1 \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u041a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u0443 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0448\u0435\u0434\u0448\u0443\u044e \u0432 \u0440\u0435\u043b\u0438\u0437 Symfony 4. \u0417\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u044d\u0442\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435, \u043d\u043e \u043e\u0441\u043e\u0431\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0431\u0430\u043d\u0434\u043b\u043e\u0432, \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f Symfony. \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 HealthCheck \u0431\u0430\u043d\u0434\u043b\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0443\u0441\u0430\/\u0437\u0434\u043e\u0440\u043e\u0432\u044c\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e\u0434 Syfmony 4.1, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 (\u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043a\u043e\u0433\u0434\u0430-\u0442\u043e) \u043c\u043e\u043c\u0435\u043d\u0442\u044b. <\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0442 \u0431\u0430\u043d\u0434\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0440\u0435\u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0432 ElasticSearch \u2014 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 Elastic \u0441 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<h1 id=\"sozdanie-skeleta-bandla\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043a\u0435\u043b\u0435\u0442\u0430 \u0431\u0430\u043d\u0434\u043b\u0430<\/h1>\n<p>  <\/p>\n<p>\u0412 Symfony 3 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043a\u0435\u043b\u0435\u0442\u043e\u0432 \u0431\u0430\u043d\u0434\u043b\u043e\u0432 \u0431\u044b\u043b \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0431\u0430\u043d\u0434\u043b, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 Symfony 4 \u043e\u043d \u0431\u043e\u043b\u0435\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u043e\u0442\u043e\u043c\u0443 \u0441\u043a\u0435\u043b\u0435\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<p>  <\/p>\n<pre><code>composer create-project symfony\/skeleton health-check<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e Symfony 4 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 PHP 7.1+, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0438\u0436\u0435, \u0442\u043e \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0441\u043a\u0435\u043b\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 Symfony 3.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 Symfony 4.1 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_c\/hl\/yb\/_chlybmekt9jh4dmo-exscc_kfi.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430\u043c \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u043c\u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0451 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e\u0435, \u043d\u0435\u0436\u0435\u043b\u0438 \u0440\u0443\u043a\u0430\u043c\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e\u0435.<\/p>\n<p>  <\/p>\n<h1 id=\"composerjson\">composer.json<\/h1>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 <code>composer.json<\/code> \u043f\u043e\u0434 \u043d\u0430\u0448\u0438 \u043d\u0443\u0436\u0434\u044b. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0438\u043f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>type<\/code> \u043d\u0430 <code>symfony-bundle<\/code> \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 <a href=\"https:\/\/symfony.com\/doc\/current\/setup\/flex.html\">Symfony Flex<\/a> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0431\u0430\u043d\u0434\u043b\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442, \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u0430\u043d\u0434\u043b Symfony, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0440\u0435\u0446\u0435\u043f\u0442 (\u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0436\u0435). \u0414\u0430\u043b\u0435\u0435, \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044f <code>name<\/code> \u0438 <code>description<\/code>. <code>name<\/code> \u0432\u0430\u0436\u043d\u043e \u0435\u0449\u0451 \u0438 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432 \u043a\u0430\u043a\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 <code>vendor<\/code> \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043c\u0435\u0449\u0451\u043d \u0431\u0430\u043d\u0434\u043b. <\/p>\n<p>  <\/p>\n<pre><code>&quot;name&quot;: &quot;niklesh\/health-check&quot;, &quot;description&quot;: &quot;Health check bundle&quot;,<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u0448\u0430\u0433 \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b <code>autoload<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0431\u0430\u043d\u0434\u043b\u0430. <code>autoload<\/code> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, <code>autoload-dev<\/code> \u2014 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<pre><code>&quot;autoload&quot;: {     &quot;psr-4&quot;: {         &quot;niklesh\\\\HealthCheckBundle\\\\&quot;: &quot;src&quot;     } }, &quot;autoload-dev&quot;: {     &quot;psr-4&quot;: {         &quot;niklesh\\\\HealthCheckBundle\\\\Tests\\\\&quot;: &quot;tests&quot;     } },<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0434\u0435\u043b <code>scripts<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c. \u0422\u0430\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0430\u0441\u0441\u0435\u0442\u043e\u0432 \u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043a\u044d\u0448\u0430 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434 <code>composer install<\/code> \u0438 <code>composer update<\/code>, \u043e\u0434\u043d\u0430\u043a\u043e \u0443 \u043d\u0430\u0441 \u0431\u0430\u043d\u0434\u043b \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0438 \u0430\u0441\u0441\u0435\u0442\u044b, \u043d\u0438 \u043a\u044d\u0448, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u044d\u0442\u0438 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u044b <code>require<\/code> \u0438 <code>require-dev<\/code>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<pre><code>&quot;require&quot;: {     &quot;php&quot;: &quot;^7.1.3&quot;,     &quot;ext-ctype&quot;: &quot;*&quot;,     &quot;ext-iconv&quot;: &quot;*&quot;,     &quot;symfony\/flex&quot;: &quot;^1.0&quot;,     &quot;symfony\/framework-bundle&quot;: &quot;^4.1&quot;,     &quot;sensio\/framework-extra-bundle&quot;: &quot;^5.2&quot;,     &quot;symfony\/lts&quot;: &quot;^4@dev&quot;,     &quot;symfony\/yaml&quot;: &quot;^4.1&quot; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0437 <code>require<\/code> \u0431\u0443\u0434\u0443\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0431\u0430\u043d\u0434\u043b\u0430 \u043a \u0440\u0430\u0431\u043e\u0447\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c <code>composer update<\/code> \u2014 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b.<\/p>\n<p>  <\/p>\n<h1 id=\"chistka-ne-nuzhnogo\">\u0427\u0438\u0441\u0442\u043a\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e\u0433\u043e<\/h1>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0438\u0437 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u043f\u043a\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>bin \u2014 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0444\u0430\u0439\u043b <code>console<\/code>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 Symfony<\/li>\n<li>config \u2014 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0431\u0430\u043d\u0434\u043b\u043e\u0432,<br \/>  \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u0442.\u0434.<\/li>\n<li>public \u2014 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <code>index.php<\/code> \u2014 \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/li>\n<li>var \u2014 \u0442\u0443\u0442 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043b\u043e\u0433\u0438 \u0438 <code>cache<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b\u044b <code>src\/Kernel.php<\/code>, <code>.env<\/code>, <code>.env.dist<\/code><br \/>  \u0412\u0441\u0451 \u044d\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0431\u0430\u043d\u0434\u043b, \u0430 \u043d\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<h1 id=\"sozdanie-struktury-bandla\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0431\u0430\u043d\u0434\u043b\u0430<\/h1>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0432\u044b\u0447\u0438\u0441\u0442\u0438\u043b\u0438 \u0432\u0441\u0451 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e\u0435 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u0430\u043d\u0434\u043b\u0430. \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u0430\u043f\u043a\u0438 \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u043d\u0434\u043b\u0430 \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 <code>src<\/code> \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b <code>HealthCheckBundle.php<\/code> \u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle;  use Symfony\\Component\\HttpKernel\\Bundle\\Bundle;  class HealthCheckBundle extends Bundle { }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0431\u0430\u043d\u0434\u043b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <code>config\/bundles.php<\/code> \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 &quot;\u0431\u0438\u043b\u0434&quot; \u0431\u0430\u043d\u0434\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0430\u043d\u0434\u043b\u0430 \u2014 \u044d\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b <code>DependencyInjection<\/code>. \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0434\u043d\u043e\u0438\u043c\u0451\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0441 2 \u0444\u0430\u0439\u043b\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>src\/DependencyInjection\/Configuration.php<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\DependencyInjection;  use Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder; use Symfony\\Component\\Config\\Definition\\ConfigurationInterface;  class Configuration implements ConfigurationInterface {     public function getConfigTreeBuilder()     {         $treeBuilder = new TreeBuilder();         $treeBuilder-&gt;root('health_check');         return $treeBuilder;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0431\u0430\u043d\u0434\u043b\u0430 \u0438\u0437 Yaml \u0438\u043b\u0438 xml \u0444\u0430\u0439\u043b\u043e\u0432. \u0415\u0433\u043e \u043c\u044b \u0435\u0449\u0451 \u043c\u043e\u0434\u0438\u0446\u0438\u0444\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>  <\/p>\n<ul>\n<li><code>src\/DependencyInjection\/HealthCheckExtension.php<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\DependencyInjection;  use Symfony\\Component\\Config\\FileLocator; use Symfony\\Component\\DependencyInjection\\ContainerBuilder; use Symfony\\Component\\HttpKernel\\DependencyInjection\\Extension; use Symfony\\Component\\DependencyInjection\\Loader;  class HealthCheckExtension extends Extension {     \/**      * {@inheritdoc}      *\/     public function load(array $configs, ContainerBuilder $container)     {         $configuration = new Configuration();         $this-&gt;processConfiguration($configuration, $configs);          $loader = new Loader\\YamlFileLoader($container, new FileLocator(__DIR__ . '\/..\/Resources\/config'));         $loader-&gt;load('services.yaml');     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0431\u0430\u043d\u0434\u043b\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e &quot;definition&quot; \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438 \u0442.\u0434.<\/p>\n<p>  <\/p>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0448\u0430\u0433 \u2014 \u044d\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 <code>src\/Resources\/services.yaml<\/code> \u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u0430\u043d\u0434\u043b\u0430. \u041f\u043e\u043a\u0430 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u043f\u0443\u0441\u0442\u044b\u043c.<\/p>\n<p>  <\/p>\n<h1 id=\"healthinterface\">HealthInterface<\/h1>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u0430\u043d\u0434\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u0410 \u0432\u043e\u0442 \u0441\u0431\u043e\u0440 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u2014 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043d\u0430\u0448 \u0431\u0430\u043d\u0434\u043b \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u043c\u0443 \u0441\u0435\u0440\u0432\u0438\u0441, \u0438 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c. \u0412 \u043c\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b (\u0430 \u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>HealthInterface<\/code> \u0441 2 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438: <code>getName<\/code> \u0438 <code>getHealthInfo<\/code>. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>HealthDataInterface<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 (entity) \u0434\u0430\u043d\u043d\u044b\u0445 <code>src\/Entity\/HealthDataInterface.php<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\Entity;  interface HealthDataInterface {     public const STATUS_OK = 1;     public const STATUS_WARNING = 2;     public const STATUS_DANGER = 3;     public const STATUS_CRITICAL = 4;      public function getStatus(): int;     public function getAdditionalInfo(): array; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e (\u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u043a \u0441\u043b\u043e\u0432\u0443, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u043f\u0443\u0441\u0442\u043e\u0439).<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0442\u0438\u043f\u0438\u0447\u043d\u0430 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u0432, \u044f \u0440\u0435\u0448\u0438\u043b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0451 \u0432 \u0431\u0430\u043d\u0434\u043b <code>src\/Entity\/CommonHealthData.php<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\Entity;  class CommonHealthData implements HealthDataInterface {     private $status;     private $additionalInfo = [];      public function __construct(int $status)     {         $this-&gt;status = $status;     }      public function setStatus(int $status)     {         $this-&gt;status = $status;     }      public function setAdditionalInfo(array $additionalInfo)     {         $this-&gt;additionalInfo = $additionalInfo;     }      public function getStatus(): int     {         return $this-&gt;status;     }      public function getAdditionalInfo(): array     {         return $this-&gt;additionalInfo;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 <code>src\/Service\/HealthInterface.php<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\Service;  use niklesh\\HealthCheckBundle\\Entity\\HealthDataInterface;  interface HealthInterface {     public function getName(): string;     public function getHealthInfo(): HealthDataInterface; }<\/code><\/pre>\n<p>  <\/p>\n<h1 id=\"controller\">Controller<\/h1>\n<p>  <\/p>\n<p>\u041e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u0438\u043c \u0440\u043e\u0443\u0442\u043e\u043c. \u0417\u0430\u0442\u043e \u044d\u0442\u043e\u0442 \u0440\u043e\u0443\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0439 \u0431\u0430\u043d\u0434\u043b: <code>\/health<\/code><\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0438\u0445 \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0445 <code>HealthInterface<\/code>, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u0417\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>addHealthService<\/code><\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 <code>src\/Controller\/HealthController.php<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\Controller;  use niklesh\\HealthCheckBundle\\Service\\HealthInterface; use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController; use Symfony\\Component\\HttpFoundation\\JsonResponse; use Symfony\\Component\\Routing\\Annotation\\Route;  class HealthController extends AbstractController {     \/** @var HealthInterface[] *\/     private $healthServices = [];      public function addHealthService(HealthInterface $healthService)     {         $this-&gt;healthServices[] = $healthService;     }      \/**      * @Route(&quot;\/health&quot;)      * @return JsonResponse      *\/     public function getHealth(): JsonResponse     {         return $this-&gt;json(array_map(function (HealthInterface $healthService) {             $info = $healthService-&gt;getHealthInfo();             return [                 'name' =&gt; $healthService-&gt;getName(),                 'info' =&gt; [                     'status' =&gt; $info-&gt;getStatus(),                     'additional_info' =&gt; $info-&gt;getAdditionalInfo()                 ]             ];         }, $this-&gt;healthServices));     } }<\/code><\/pre>\n<p>  <\/p>\n<h1 id=\"kompilyaciya\">\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f<\/h1>\n<p>  <\/p>\n<p>Symfony \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u043c\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u044d\u0433, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u0437\u044f\u0442\u044c \u0438 \u043f\u0440\u043e\u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u0442\u0430\u043a\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 (\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440). \u0422\u0430\u043a\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0432 4 \u044d\u0442\u0430\u043f\u0430:<\/p>\n<p>  <\/p>\n<p><em>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043d\u0430\u0448\u0435\u043c\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0443, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u043c\u0443 <code>HealthInterface<\/code> \u0442\u044d\u0433.<\/em><\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 <code>TAG<\/code> \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">interface HealthInterface {     public const TAG = 'health.service'; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0442\u044d\u0433 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0443. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e<br \/>  \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0444\u0430\u0439\u043b\u0435 <code>config\/services.yaml<\/code> \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <code>_instanceof<\/code>. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u0430<br \/>  \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u0431\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code>serivces:   _instanceof:     niklesh\\HealthCheckBundle\\Service\\HealthInterface:       tags:          - !php\/const niklesh\\HealthCheckBundle\\Service\\HealthInterface::TAG<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418, \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u0437\u0430\u0431\u043e\u0442\u0443 \u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0431\u0430\u043d\u0434\u043b\u0430 \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u044d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0431\u0430\u043d\u0434\u043b \u0441\u0430\u043c \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0438 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041a\u0442\u043e-\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 <code>services.yaml<\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u0430\u043d\u0434\u043b\u0430, \u043d\u043e \u043d\u0435\u0442, \u043e\u043d \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442. \u042d\u0442\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0430 \u043d\u0435 \u0431\u0430\u043d\u0434\u043b\u0430.<br \/>  \u041d\u0435 \u0437\u043d\u0430\u044e, \u0431\u0430\u0433 \u044d\u0442\u043e \u0438\u043b\u0438 \u0444\u0438\u0447\u0430, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0438\u043c\u0435\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043d\u0430\u043c \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0431\u0430\u043d\u0434\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0444\u0430\u0439\u043b <code>src\/HealthCheckBundle.php<\/code> \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <code>build<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle;  use niklesh\\HealthCheckBundle\\Service\\HealthInterface; use Symfony\\Component\\DependencyInjection\\ContainerBuilder; use Symfony\\Component\\HttpKernel\\Bundle\\Bundle;  class HealthCheckBundle extends Bundle {     public function build(ContainerBuilder $container)     {         parent::build($container);         $container-&gt;registerForAutoconfiguration(HealthInterface::class)-&gt;addTag(HealthInterface::TAG);     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 <code>HealthInterface<\/code> \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043c\u0435\u0447\u0435\u043d \u0442\u044d\u0433\u043e\u043c.<\/p>\n<p>  <\/p>\n<p><em>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/em><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443, \u043a\u0430\u043a \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443, \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0431\u0430\u043d\u0434\u043b\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u0442\u0430\u043c \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u043d\u0434\u043b\u043e\u043c \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u044f\u0432\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438, \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u0431\u0443\u0434\u0443\u0442 \u043b\u0438 \u043e\u043d\u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>src\/Resources\/config\/services.yaml<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435<\/p>\n<p>  <\/p>\n<pre><code>services:   niklesh\\HealthCheckBundle\\Controller\\HealthController:     autoconfigure: true<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u044b \u044f\u0432\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0438\u0441, \u0442\u0435\u043f\u0435\u0440\u044c \u043a \u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p><em>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.<\/em><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0438 \u0431\u0430\u043d\u0434\u043b\u043e\u0432, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e definition&#8217;\u0430\u043c\u0438 (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438) \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0437\u044f\u0442\u044c definition <code>HealthController<\/code> \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432 \u043d\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u044b \u043d\u0430\u0448\u0438\u043c \u0442\u044d\u0433\u043e\u043c. \u0417\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0431\u0430\u043d\u0434\u043b\u0430\u0445 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u043a\u043b\u0430\u0441\u0441\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<br \/>  <code>Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface<\/code><\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 <code>src\/DependencyInjection\/Compiler\/HealthServicePath.php<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\DependencyInjection\\Compiler;  use niklesh\\HealthCheckBundle\\Controller\\HealthController; use niklesh\\HealthCheckBundle\\Service\\HealthInterface; use Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface; use Symfony\\Component\\DependencyInjection\\ContainerBuilder; use Symfony\\Component\\DependencyInjection\\Reference;  class HealthServicesPath implements CompilerPassInterface {     public function process(ContainerBuilder $container)     {         if (!$container-&gt;has(HealthController::class)) {             return;         }          $controller = $container-&gt;findDefinition(HealthController::class);         foreach (array_keys($container-&gt;findTaggedServiceIds(HealthInterface::TAG)) as $serviceId) {             $controller-&gt;addMethodCall('addHealthService', [new Reference($serviceId)]);         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>findDefinition<\/code> \u0431\u0435\u0440\u0451\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0434\u0430\u043b\u0435\u0435 \u2014 \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043f\u043e \u0442\u0435\u0433\u0443 \u0438 \u043f\u043e\u0441\u043b\u0435, \u0432 \u0446\u0438\u043a\u043b\u0435, \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 <code>addHealthService<\/code>, \u043a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441.<\/p>\n<p>  <\/p>\n<p><em>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>CompilerPath<\/code><\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e <code>HealthServicePath<\/code> \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0431\u0430\u043d\u0434\u043b\u0430. \u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441 <code>HealthCheckBundle<\/code> \u0438 \u0435\u0449\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043c\u0435\u0442\u043e\u0434 <code>build<\/code>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle;  use niklesh\\HealthCheckBundle\\DependencyInjection\\Compiler\\HealthServicesPath; use niklesh\\HealthCheckBundle\\Service\\HealthInterface; use Symfony\\Component\\DependencyInjection\\ContainerBuilder; use Symfony\\Component\\HttpKernel\\Bundle\\Bundle;  class HealthCheckBundle extends Bundle {     public function build(ContainerBuilder $container)     {         parent::build($container);         $container-&gt;addCompilerPass(new HealthServicesPath());         $container-&gt;registerForAutoconfiguration(HealthInterface::class)-&gt;addTag(HealthInterface::TAG);     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u0448 \u0431\u0430\u043d\u0434\u043b \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0441\u0431\u043e\u0440\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438 \u0438 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043d\u0430 <code>\/health<\/code> (\u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430 \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438), \u043e\u0434\u043d\u0430\u043a\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u0437\u0430\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443, \u043d\u043e \u0438 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u044d\u0442\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043a\u0443\u0434\u0430-\u043b\u0438\u0431\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e POST-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439.<\/p>\n<p>  <\/p>\n<h1 id=\"healthsenderinterface\">HealthSenderInterface<\/h1>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0437\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0443\u0434\u0430-\u043b\u0438\u0431\u043e. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0433\u043e \u0432 <code>src\/Service\/HealthSenderInterface<\/code><\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\Service;  use niklesh\\HealthCheckBundle\\Entity\\HealthDataInterface;  interface HealthSenderInterface {     \/**      * @param HealthDataInterface[] $data      *\/     public function send(array $data): void;     public function getDescription(): string;     public function getName(): string; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043c\u0435\u0442\u043e\u0434 <code>send<\/code> \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0432\u0441\u0435\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0445 <code>HealthInterface<\/code> \u0438 \u0434\u0430\u043b\u0435\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0443\u0434\u0430, \u043a\u0443\u0434\u0430 \u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u043e.<br \/>  \u041c\u0435\u0442\u043e\u0434\u044b <code>getDescription<\/code> \u0438 <code>getName<\/code> \u043d\u0443\u0436\u043d\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<p>  <\/p>\n<h1 id=\"senddatacommand\">SendDataCommand<\/h1>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>SendDataCommand<\/code>. \u0415\u0451 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438, \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>send<\/code> \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u044d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043d\u043e \u043d\u0435 \u0432\u043e \u0432\u0441\u0451\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\Command;  use niklesh\\HealthCheckBundle\\Entity\\HealthDataInterface; use niklesh\\HealthCheckBundle\\Service\\HealthInterface; use niklesh\\HealthCheckBundle\\Service\\HealthSenderInterface; use Symfony\\Component\\Console\\Command\\Command; use Symfony\\Component\\Console\\Input\\InputInterface; use Symfony\\Component\\Console\\Output\\OutputInterface; use Symfony\\Component\\Console\\Style\\SymfonyStyle; use Throwable;  class SendDataCommand extends Command {     public const COMMAND_NAME = 'health:send-info';      private $senders;     \/** @var HealthInterface[] *\/     private $healthServices;     \/** @var SymfonyStyle *\/     private $io;      public function __construct(HealthSenderInterface... $senders)     {         parent::__construct(self::COMMAND_NAME);          $this-&gt;senders = $senders;     }      public function addHealthService(HealthInterface $healthService)     {         $this-&gt;healthServices[] = $healthService;     }      protected function configure()     {         parent::configure();         $this-&gt;setDescription('Send health data by senders');     }      protected function initialize(InputInterface $input, OutputInterface $output)     {         parent::initialize($input, $output);         $this-&gt;io = new SymfonyStyle($input, $output);     }      protected function execute(InputInterface $input, OutputInterface $output)     {         $this-&gt;io-&gt;title('Sending health info');          try {             $data = array_map(function (HealthInterface $service): HealthDataInterface {                 return $service-&gt;getHealthInfo();             }, $this-&gt;healthServices);              foreach ($this-&gt;senders as $sender) {                 $this-&gt;outputInfo($sender);                 $sender-&gt;send($data);             }             $this-&gt;io-&gt;success('Data is sent by all senders');         } catch (Throwable $exception) {             $this-&gt;io-&gt;error('Exception occurred: ' . $exception-&gt;getMessage());             $this-&gt;io-&gt;text($exception-&gt;getTraceAsString());         }     }      private function outputInfo(HealthSenderInterface $sender)     {         if ($name = $sender-&gt;getName()) {             $this-&gt;io-&gt;writeln($name);         }         if ($description = $sender-&gt;getDescription()) {             $this-&gt;io-&gt;writeln($description);         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c <code>HealthServicesPath<\/code>, \u043f\u0438\u0448\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\DependencyInjection\\Compiler;  use niklesh\\HealthCheckBundle\\Command\\SendDataCommand; use niklesh\\HealthCheckBundle\\Controller\\HealthController; use niklesh\\HealthCheckBundle\\Service\\HealthInterface; use Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface; use Symfony\\Component\\DependencyInjection\\ContainerBuilder; use Symfony\\Component\\DependencyInjection\\Reference;  class HealthServicesPath implements CompilerPassInterface {     public function process(ContainerBuilder $container)     {         if (!$container-&gt;has(HealthController::class)) {             return;         }          $controller = $container-&gt;findDefinition(HealthController::class);         $commandDefinition = $container-&gt;findDefinition(SendDataCommand::class);         foreach (array_keys($container-&gt;findTaggedServiceIds(HealthInterface::TAG)) as $serviceId) {             $controller-&gt;addMethodCall('addHealthService', [new Reference($serviceId)]);             $commandDefinition-&gt;addMethodCall('addHealthService', [new Reference($serviceId)]);         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0438\u0448\u043a\u043e\u0439 \u0430\u0432\u0442\u043e\u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0430\u043c\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u0422\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u043f\u0440\u043e\u0441 \u0435\u0449\u0451 \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u0411\u0443\u0434\u0435\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0445 id \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0431\u0430\u043d\u0434\u043b\u0430 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code>health_check:   senders:     - '@sender.service1'     - '@sender.service2'<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0448 \u0431\u0430\u043d\u0434\u043b \u0435\u0449\u0451 \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043d\u0430\u0443\u0447\u0438\u043c \u0435\u0433\u043e. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 <code>Configuration.php<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0435\u0440\u0435\u0432\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\DependencyInjection;  use Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder; use Symfony\\Component\\Config\\Definition\\ConfigurationInterface;  class Configuration implements ConfigurationInterface {     public function getConfigTreeBuilder()     {         $treeBuilder = new TreeBuilder();         $rootNode = $treeBuilder-&gt;root('health_check');         $rootNode             -&gt;children()                 -&gt;arrayNode('senders')                     -&gt;scalarPrototype()-&gt;end()                 -&gt;end()             -&gt;end()         ;         return $treeBuilder;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u0440\u043d\u0435\u0432\u044b\u043c \u0443\u0437\u043b\u043e\u043c \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0443\u0437\u0435\u043b <code>health_check<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u043e\u0434\u0443-\u043c\u0430\u0441\u0441\u0438\u0432 <code>senders<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a. \u0412\u0441\u0451, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u0431\u0430\u043d\u0434\u043b \u0437\u043d\u0430\u0435\u0442, \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u0447\u0442\u043e \u043c\u044b \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b\u0438 \u0432\u044b\u0448\u0435. \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u0432 <code>HealthCheckExtension<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace niklesh\\HealthCheckBundle\\DependencyInjection;  use niklesh\\HealthCheckBundle\\Command\\SendDataCommand; use Symfony\\Component\\Config\\FileLocator; use Symfony\\Component\\DependencyInjection\\ContainerBuilder; use Symfony\\Component\\DependencyInjection\\Definition; use Symfony\\Component\\HttpKernel\\DependencyInjection\\Extension; use Symfony\\Component\\DependencyInjection\\Loader; use Symfony\\Component\\DependencyInjection\\Reference;  class HealthCheckExtension extends Extension {     \/**      * {@inheritdoc}      *\/     public function load(array $configs, ContainerBuilder $container)     {         $configuration = new Configuration();         $config = $this-&gt;processConfiguration($configuration, $configs);          $loader = new Loader\\YamlFileLoader($container, new FileLocator(__DIR__ . '\/..\/Resources\/config'));         $loader-&gt;load('services.yaml');          \/\/ \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b         $commandDefinition = new Definition(SendDataCommand::class);         \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u044b         foreach ($config['senders'] as $serviceId) {             $commandDefinition-&gt;addArgument(new Reference($serviceId));         }         \/\/ \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u0430\u043a \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b         $commandDefinition-&gt;addTag('console.command', ['command' =&gt; SendDataCommand::COMMAND_NAME]);         \/\/ \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440         $container-&gt;setDefinition(SendDataCommand::class, $commandDefinition);     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0451, \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430. \u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u043d\u0434\u043b\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442, \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435<br \/>  <code>bin\/console<\/code> \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043c\u0430\u043d\u0434, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043d\u0430\u0448\u0443: <code>health:send-info<\/code>, \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0436\u0435: <code>bin\/console health:send-info<\/code><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0448 \u0431\u0430\u043d\u0434\u043b \u0433\u043e\u0442\u043e\u0432. \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442:<\/p>\n<p>  <\/p>\n<pre><code>composer create-project symfony\/skeleton health-test-project<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u043d\u0430\u0448 \u0441\u0432\u0435\u0436\u0435\u0438\u0441\u043f\u0435\u0447\u0451\u043d\u043d\u044b\u0439 \u0431\u0430\u043d\u0434\u043b, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <code>composer.json<\/code> \u0440\u0430\u0437\u0434\u0435\u043b <code>repositories<\/code>:<\/p>\n<p>  <\/p>\n<pre><code>&quot;repositories&quot;: [     {         &quot;type&quot;: &quot;vcs&quot;,         &quot;url&quot;: &quot;https:\/\/github.com\/HEKET313\/health-check&quot;     } ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p>  <\/p>\n<pre><code>composer require niklesh\/health-check<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0435\u0449\u0451, \u0434\u043b\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441\u0438\u043c\u0444\u043e\u043d\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code>composer req --dev server<\/code><\/pre>\n<p>  <\/p>\n<p>\u0411\u0430\u043d\u0434\u043b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d, Symfony Flex \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442 \u0435\u0433\u043e \u0432 <code>config\/bundles.php<\/code>, \u0430 \u0432\u043e\u0442 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0435\u0446\u0435\u043f\u0442. \u041f\u0440\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/habr.com\/post\/345382\/\">https:\/\/habr.com\/post\/345382\/<\/a> \u2014 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0435\u0446\u0435\u043f\u0442\u044b \u0438 \u0442.\u0434. \u044f \u0442\u0443\u0442 \u043d\u0435 \u0431\u0443\u0434\u0443, \u0434\u0430 \u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0430\u043d\u0434\u043b\u0430 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u043d\u0443\u0436\u043d\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u0445 \u0440\u0443\u0447\u043a\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>config\/routes\/niklesh_health.yaml<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code>health_check:   resource: &quot;@HealthCheckBundle\/Controller\/HealthController.php&quot;   prefix: \/   type: annotation<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><code>config\/packages\/hiklesh_health.yaml<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code>health_check:   senders:     - 'App\\Service\\Sender'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u043a\u043b\u0430\u0441\u0441 \u0441\u0431\u043e\u0440\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438<\/p>\n<p>  <\/p>\n<ul>\n<li><code>src\/Service\/DataCollector.php<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0451 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Service;  use niklesh\\HealthCheckBundle\\Entity\\CommonHealthData; use niklesh\\HealthCheckBundle\\Entity\\HealthDataInterface; use niklesh\\HealthCheckBundle\\Service\\HealthInterface;  class DataCollector implements HealthInterface {      public function getName(): string     {         return 'Data collector';     }      public function getHealthInfo(): HealthDataInterface     {         $data = new CommonHealthData(HealthDataInterface::STATUS_OK);         $data-&gt;setAdditionalInfo(['some_data' =&gt; 'some_value']);         return $data;     } }<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><code>src\/Service\/Sender.php<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0410 \u0442\u0443\u0442 \u0435\u0449\u0451 \u043f\u0440\u043e\u0449\u0435<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Service;  use niklesh\\HealthCheckBundle\\Entity\\HealthDataInterface; use niklesh\\HealthCheckBundle\\Service\\HealthSenderInterface;  class Sender implements HealthSenderInterface {     \/**      * @param HealthDataInterface[] $data      *\/     public function send(array $data): void     {         print &quot;Data sent\\n&quot;;     }      public function getDescription(): string     {         return 'Sender description';     }      public function getName(): string     {         return 'Sender name';     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u041f\u043e\u0447\u0438\u0441\u0442\u0438\u043c \u043a\u044d\u0448 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440 <\/p>\n<p>  <\/p>\n<pre><code>bin\/console cache:clear bin\/console server:start<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u044b\u0442\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p>  <\/p>\n<pre><code>bin\/console health:send-info<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0442 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0432\u044b\u0432\u043e\u0434:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ch\/ar\/gl\/charglyrhdjzuiye04ks1jgu4jm.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u0441\u0442\u0443\u043a\u043d\u0435\u043c\u0441\u044f \u043d\u0430 \u043d\u0430\u0448 \u0440\u043e\u0443\u0442 <code>http:\/\/127.0.0.1:8000\/health<\/code> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043c\u0435\u043d\u0435\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439, \u043d\u043e \u0442\u043e\u0436\u0435 \u0432\u044b\u0432\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code>[{&quot;name&quot;:&quot;Data collector&quot;,&quot;info&quot;:{&quot;status&quot;:1,&quot;additional_info&quot;:{&quot;some_data&quot;:&quot;some_value&quot;}}}]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451! \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u043e\u0442 \u043d\u0435\u0437\u0430\u043c\u044b\u0441\u043b\u043e\u0432\u0430\u0442\u044b\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0431\u0430\u043d\u0434\u043b\u043e\u0432 \u0434\u043b\u044f Symfony 4. <\/p>\n<p>  <\/p>\n<p>P.S. <a href=\"https:\/\/github.com\/HEKET313\/health-check\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/419451\/\"> https:\/\/habr.com\/post\/419451\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/419451\/\" class=\"post__text post__text-html js-mediator-article\">\n<p>\u041e\u043a\u043e\u043b\u043e \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434 \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u0432\u0437\u044f\u043b\u0430 \u043a\u0443\u0440\u0441 \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u0430 \u043d\u0430 Magento 1 \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u041a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u0443 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0448\u0435\u0434\u0448\u0443\u044e \u0432 \u0440\u0435\u043b\u0438\u0437 Symfony 4. \u0417\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u044d\u0442\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435, \u043d\u043e \u043e\u0441\u043e\u0431\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0431\u0430\u043d\u0434\u043b\u043e\u0432, \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f Symfony. \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 HealthCheck \u0431\u0430\u043d\u0434\u043b\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0443\u0441\u0430\/\u0437\u0434\u043e\u0440\u043e\u0432\u044c\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e\u0434 Syfmony 4.1, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 (\u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043a\u043e\u0433\u0434\u0430-\u0442\u043e) \u043c\u043e\u043c\u0435\u043d\u0442\u044b. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-287599","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=287599"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287599\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=287599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=287599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=287599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}