{"id":160509,"date":"2012-11-29T16:15:04","date_gmt":"2012-11-29T12:15:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=160509"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=160509","title":{"rendered":"<span class=\"post_title\">\u041a\u0430\u043a \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c Silex \u0432 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 PHP \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage\/habraeffect\/bb\/fe\/bbfe0eaa317e00ae4912dbf9b5c4105a.png\" alt=\"Silex\" align=\"right\"\/>\u0414\u0430\u0432\u043d\u044b\u043c \u0434\u0430\u0432\u043d\u043e, \u0432 \u0434\u0430\u043b\u0435\u043a\u043e\u0439-\u0434\u0430\u043b\u0435\u043a\u043e\u0439 \u0433\u0430\u043b\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 PHP \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u2014 Symfony \u0438 ZF, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b\u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0441\u0440\u0435\u043d\u0434\u0435\u0433\u043e \u2014 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u043d\u0438\u0445, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430, \u0441\u0430\u0439\u0442\u044b \u0436\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e, \u0438, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u043d\u0430 \u043d\u0438\u0445 \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u043e \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0410 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0432\u043e \u0444\u0440\u0438\u043b\u0430\u043d\u0441, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0438\u0445 \u0437\u0430\u043a\u0430\u0437\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043a \u0441\u0440\u0435\u043d\u0434\u0435\u043c\u0443 \u0443\u0440\u043e\u0432\u043d\u044e. \u041d\u0430 \u0444\u043e\u043d\u0435 \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043c\u0438\u043a\u0440\u043e-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438, \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 <a href=\"http:\/\/silex.sensiolabs.org\/\">Silex<\/a>, \u043e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Symfony. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e\u043d \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u0430\u0439\u0442\u044b, \u043d\u043e \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0430\u0439\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u043e\u0436\u043d\u0435\u0435. <a name=\"habracut\"><\/a>\u0418\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 Silex \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u0435\u0440\u0432\u0430\u0439\u0441 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440. \u042d\u0442\u043e\u0433\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f Silex-\u0430 \u0432\u043e \u0447\u0442\u043e-\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0435. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u0438 \u0444\u0430\u0439\u043b\u044b. \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 MVC \u2014 \u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0438 \u2014 \u044d\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u0438, \u0448\u0430\u0431\u043b\u043e\u043d\u044b (\u0432\u044c\u044e\u0448\u043a\u0438) \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u0438\u0445 \u0442\u0440\u0435\u0445 \u0447\u0430\u0441\u0442\u0435\u0439, \u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0435\u0441\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u0432 \u0442.\u0447. \u0438 \u0441\u0430\u043c Silex), \u043a\u043e\u043d\u0444\u0438\u0433\u0438, \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438, JavaScrip-\u044b, CSS-\u0441\u0442\u0438\u043b\u0438) \u0438 \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 (Bootstrap). \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e \u0442\u0430\u043a\u0438\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/e78\/79e\/b53\/e7879eb53fafd203f32ea3a439ac5928.png\"\/><\/p>\n<p>  \u0424\u0430\u0439\u043b .htaccess, \u0438\u043b\u0438 \u0435\u0433\u043e \u0430\u043d\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u043a\u0438 (\u043f\u0430\u043f\u043a\u0430 web), \u043d\u0430 index.php, \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"bash\">RewriteEngine On RewriteRule ^web\/(.*) web\/$1 [L] RewriteRule ^ index.php [L] <\/code><\/pre>\n<p>* \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d mod_rewrite \u0438 AllowOverride \u0440\u0430\u0432\u0435\u043d All.<\/p>\n<p>  \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0444\u0430\u0439\u043b index.php \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c Silex \u0438\u0437 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 vendor \u0438 \u0432\u0441\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0438\u0437 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 controller.   <\/p>\n<pre><code class=\"php\">\/\/ index.php require_once __DIR__.'\/vendor\/autoload.php';  $app = new Silex\\Application();  foreach ( glob(__DIR__.&quot;\/controller\/*.php&quot;) as $filename ) {   require_once $filename; }  $app-&gt;run(); <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 controller\/index.php, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 action-\u044b.  <\/p>\n<pre><code class=\"php\">\/\/ controller\/index.php $app-&gt;get('\/', function () use ($app) {   return 'Hello Habr'; }); <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 (\u0432\u044c\u044e\u0448\u0435\u043a), Silex \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 Twig, \u043d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0435\u0433\u043e \u044f \u0441\u0447\u0438\u0442\u0430\u044e \u0438\u0437\u043b\u0438\u0448\u043d\u0438\u043c. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u044c\u044e\u0448\u043a\u0438 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c PHP, \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e \u043a\u043e\u0441\u0442\u044b\u043b\u044f \u0434\u043b\u044f Silex-\u0430 \u043d\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u041a \u043d\u0435\u043c\u0443 \u0435\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 \u0440\u0435\u043d\u0434\u0435\u0440\u0430 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0432\u044c\u044e\u0448\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u0438 \u043b\u044d\u0439\u0430\u0443\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044c\u044e\u0448\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0441\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u0430. \u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0438\u0437 \u0432\u044c\u044e\u0448\u043a\u0438, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0430 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0431\u043b\u043e\u043a\u043e\u0432 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435, \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0411\u0414.   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">\/\/ vendor\/Art\/View.php namespace Art;  use \\Symfony\\Component\\HttpKernel\\HttpKernelInterface; use \\Symfony\\Component\\HttpFoundation\\Request;  class View {   private $app = null;   private $blocks = array();    public function __construct($app) {     $this-&gt;app = $app;   }    public function render( $layout, $template, $vars = array() ) {     $path = __DIR__ . '\/..\/..\/view';      foreach ($vars as $key =&gt; $value) { $$key = $value; }     $app = $this-&gt;app;     ob_start();      require $path . '\/' . $template;      $content = ob_get_clean();          if ( null == $layout ) {       return $content;     }          ob_start();     require_once $path . '\/' . $layout;     $html = ob_get_clean();      return $html;   }        function renderController($uri) {     $request = $this-&gt;app['request'];     $sign = strpos($uri, &quot;?&quot;) ? &quot;&&quot; : &quot;?&quot;;     $uri = &quot;{$uri}{$sign}subrequest=1&quot;;      $subRequest = Request::create(       $uri, 'get', array(), $request-&gt;cookies-&gt;all(),        array(), $request-&gt;server-&gt;all()     );          if ( $request-&gt;getSession() ) {       $subRequest-&gt;setSession( $request-&gt;getSession() );     }      $response = $this-&gt;app-&gt;handle(       $subRequest, HttpKernelInterface::SUB_REQUEST, false     );      if ( !$response-&gt;isSuccessful() ) {       throw new \\RuntimeException(sprintf(         'Error when rendering &quot;%s&quot; (Status code is %s).',          $request-&gt;getUri(), $response-&gt;getStatusCode()       ));     }      return $response-&gt;getContent();   }      } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u043b\u044f \u0435\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c index.php  <\/p>\n<pre><code class=\"php\">\/\/ index.php \/\/ ... require_once __DIR__ . '\/vendor\/Art\/View.php'; $app['view'] = $app-&gt;share(function () use ($app) {   return new Art\\View($app); }); \/\/ ... <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u0435\u043d\u0434\u043e\u0440\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0430\u0432\u0442\u043e\u043b\u043e\u0430\u0434.  <\/p>\n<pre><code class=\"php\">\/\/ index.php \/\/ ... spl_autoload_register(function( $className ) {   \/\/ Namespace mapping   $namespaces = array(     &quot;Art&quot; =&gt; __DIR__ . &quot;\/vendor\/Art&quot;,     &quot;Model&quot; =&gt; __DIR__ . &quot;\/model&quot;   );    foreach ( $namespaces as $ns =&gt; $path ) {     if ( 0 === strpos( $className, &quot;{$ns}\\\\&quot; ) ) {       $pathArr = explode( &quot;\\\\&quot;, $className );       $pathArr[0] = $path;        $class = implode(DIRECTORY_SEPARATOR, $pathArr);        require_once &quot;{$class}.php&quot;;     }   } });  \/\/ Services $app['view'] = $app-&gt;share(function () use ($app) {   return new Art\\View($app); }); \/\/ ... <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043b\u044d\u0439\u0430\u0443\u0442 \u0438 \u0432\u044c\u044e\u0448\u043a\u0443 \u0434\u043b\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Art\\View.  <\/p>\n<pre><code class=\"html\">&lt;!-- view\/layout.phtml --&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt;   &lt;meta charset=&quot;utf-8&quot; \/&gt;   &lt;title&gt;Silex \u2014 \u044d\u0442\u043e \u043a\u0440\u0443\u0442\u043e&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt;   &lt;?php echo $this-&gt;renderController('\/test\/') ?&gt;   &lt;?php echo $content ?&gt; &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;!-- view\/index\/hello.phtml --&gt; Hello &lt;?php echo $name ?&gt; <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"php\">\/\/ contorller\/index.php $app-&gt;get('\/', function () use ($app) {   $name = &quot;Habr&quot;;   return $app['view']-&gt;render('layout.phtml', 'index\/hello.phtml', array(     'name' =&gt; $name   )); });  $app-&gt;get('\/test\/', function () use ($app) {   $test = &quot;Test&quot;;   return $app['view']-&gt;render(null, 'index\/test.phtml', array(     'test' =&gt; $test   )); }); <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u044b\u0432\u043e\u0434:  <\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt;   &lt;meta charset=&quot;utf-8&quot; \/&gt;   &lt;title&gt;Silex \u2014 \u044d\u0442\u043e \u043a\u0440\u0443\u0442\u043e&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt;   Test  Hello Habr&lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\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\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a-\u043f\u0430\u0440\u0441\u0435\u0440 ini-\u0444\u0430\u0439\u043b\u043e\u0432.  <\/p>\n<pre><code>; conf\/app.ini [db] dsn = &quot;mysql:\/\/root@localhost\/habr;charset=utf8&quot; <\/code><\/pre>\n<pre><code class=\"php\">\/\/ index.php \/\/ ... \/\/ Config $app['conf'] = $app-&gt;share(function () use ($app) {   $data = parse_ini_file( __DIR__ . '\/conf\/app.ini', true );   return $data; }); \/\/ ... <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 ORM, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439. Silex \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 Doctrine 2, \u043d\u043e, \u043a\u0430\u043a \u0438 \u0441 Twig, \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 Doctrine 2 \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f. \u0412\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 <a href=\"https:\/\/github.com\/kla\/php-activerecord\">PHP ActiveRecord<\/a>.   <\/p>\n<pre><code class=\"php\">\/\/ index.php \/\/ ... \/\/ PHPActiveRecord require_once __DIR__ . '\/vendor\/AR\/ActiveRecord.php'; ActiveRecord\\Config::initialize(function($cfg) use ($app) {   $cfg-&gt;set_model_directory( __DIR__ . '\/model');   $cfg-&gt;set_connections(array(     'production' =&gt; $app['conf']['db']['dsn']   ));    $cfg-&gt;set_default_connection('production'); }); \/\/ ... <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0431\u0430\u0437\u0443 habr \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 test  <\/p>\n<pre><code class=\"sql\">CREATE DATABASE `habr` DEFAULT CHARSET=utf8;  CREATE TABLE `habr`.`author` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `name` varchar(255) NOT NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;  CREATE TABLE `habr`.`book` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `authorId` int(11) NOT NULL,   `name` varchar(255) NOT NULL,   PRIMARY KEY (`id`),   KEY `authorId` (`authorId`),   CONSTRAINT `book_ibfk_1` FOREIGN KEY (`authorId`) REFERENCES `author` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u0438  <\/p>\n<pre><code class=\"php\">\/\/ model\/Author.php namespace Model;  class Author extends \\ActiveRecord\\Model {   static $table_name = 'author';    static $has_many = array(     array('books', 'foreign_key' =&gt; 'authorId', 'class_name' =&gt; 'Model\\Book'),   ); } <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"php\">\/\/ model\/Book.php namespace Model;  class Book extends \\ActiveRecord\\Model {   static $table_name = 'book';    static $belongs_to = array(     array('author', 'class_name' =&gt; 'Model\\Author', 'foreign_key' =&gt; 'authorId'),   ); } <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f \u0432\u044b\u0432\u043e\u0434 \u043e\u0448\u0438\u0431\u043e\u043a \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0438\u0441 \u2014 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0441\u044b\u043b\u043e\u043a.  <\/p>\n<pre><code class=\"php\">\/\/ index.php \/\/ ... if ( '127.0.0.1' == $_SERVER['REMOTE_ADDR'] ) {   $app['debug'] = true; } \/\/ ... \/\/ UrlGenerator $app-&gt;register(new Silex\\Provider\\UrlGeneratorServiceProvider()); <\/code><\/pre>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0443  <\/p>\n<pre><code class=\"php\">\/\/ controller\/index.php \/\/ ... $app-&gt;get('\/authors\/', function () use ($app) {   $authors = Model\\Author::all();    return $app['view']-&gt;render('layout.phtml', 'index\/authors.phtml', array(     'authors' =&gt; $authors   )); });  $app-&gt;get('\/book\/{id}.html', function ($id) use ($app) {   $book = Model\\Book::find_by_id($id);   if ( !$book ) {     $app-&gt;abort(404, &quot;Book {$id} does not exist.&quot;);   }    return $app['view']-&gt;render('layout.phtml', 'index\/book.phtml', array(     'book' =&gt; $book   )); })-&gt;bind('book'); <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;!-- view\/index\/authors.phtml --&gt; &lt;?php foreach ( $authors as $author ): ?&gt; \t&lt;div&gt; \t\t&lt;?php echo $author-&gt;name ?&gt; \t\t&lt;div&gt; \t\t\t&lt;?php foreach ( $author-&gt;books as $book ): ?&gt; \t\t\t\t&lt;div&gt; \t\t\t\t\t&lt;a href=&quot;&lt;?php echo $app['url_generator']-&gt;generate('book', array('id' =&gt; $book-&gt;id)) ?&gt;&quot;&gt;&lt;?php echo $book-&gt;name ?&gt;&lt;\/a&gt; \t\t\t\t&lt;\/div&gt; \t\t\t&lt;?php endforeach ?&gt; \t\t&lt;\/div&gt; \t&lt;\/div&gt; &lt;?php endforeach ?&gt; <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;!-- view\/index\/book.phtml --&gt; &lt;?php echo $book-&gt;name ?&gt; (&lt;?php echo $book-&gt;author-&gt;name ?&gt;) <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u044b\u0432\u043e\u0434:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/55f\/c09\/535\/55fc095352cebd2daa813444e14513c2.png\"\/><br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/44e\/024\/e94\/44e024e94c7d17fdaf53cda9ec78a33a.png\"\/><br \/>  \u0414\u043b\u044f \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0432 Silex-\u0435 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a.<\/p>\n<pre><code class=\"php\">\/\/ index.php $app-&gt;error(function (\\Exception $e, $code) use ($app) {   \/\/ if ( $app['debug'] ) {   \/\/   return;   \/\/ }    return $app['view']-&gt;render('layout.phtml', 'error.phtml', array(     'msg' =&gt; $e-&gt;getMessage(),     'code' =&gt; $code   )); }); <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;!-- view\/error.phtml --&gt; &lt;h1&gt;&lt;?php echo $code ?&gt; &lt;?php echo $msg ?&gt;&lt;\/h1&gt; <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0432\u0435\u0449\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u2014 \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u044b. \u0414\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0444\u043e\u0440\u043c Silex \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 Symfony\\Form, \u043d\u043e \u0441 \u0435\u0433\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 Silex \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 Symfony, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"http:\/\/pear.php.net\/package\/HTML_QuickForm2\/redirected\">HTML_QuickForm2<\/a>.<br \/>  \u041a\u0430\u0447\u0430\u0435\u043c \u0432 vendor \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c:  <\/p>\n<pre><code class=\"php\">\/\/ index.php \/\/ ... \/\/ HTML_QuickForm2 set_include_path(   get_include_path() . PATH_SEPARATOR .   __DIR__ . &quot;\/vendor\/QuickForm2&quot; ); require_once __DIR__ . '\/vendor\/QuickForm2\/HTML\/QuickForm2.php'; require_once __DIR__ . '\/vendor\/QuickForm2\/HTML\/QuickForm2\/Renderer.php'; \/\/ ... <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440  <\/p>\n<pre><code class=\"php\">\/\/ controllers\/index.php \/\/ ... $app-&gt;match('\/form\/', function () use ($app) {   $form = new HTML_QuickForm2('author', 'post', array('action' =&gt; &quot;&quot;));   $form-&gt;addElement('text', 'name')     -&gt;setlabel('\u0418\u043c\u044f \u0430\u0432\u0442\u043e\u0440\u0430')     -&gt;addRule('required', '\u041f\u043e\u043b\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f');    $form-&gt;addElement('button', null, array('type' =&gt; 'submit'))     -&gt;setContent('\u041e\u041a');    if ( $form-&gt;isSubmitted() && $form-&gt;validate() ) {       $values = $form-&gt;getValue();        $author = new Model\\Author;       $author-&gt;name = $values['name'];          $author-&gt;save();        \/\/ post POST redirect       return new \\Symfony\\Component\\HttpFoundation\\RedirectResponse(         $app['url_generator']-&gt;generate('authors')       );   }    return $app['view']-&gt;render('layout.phtml', 'index\/form.phtml', array(     'form' =&gt; $form   )); }); <\/code><\/pre>\n<p>  \u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0430\u0436\u043d\u0430\u044f \u0432\u0435\u0449\u044c \u2014 \u044d\u0442\u043e \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u0430\u044f \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f. \u0414\u043b\u044f \u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <a href=\"https:\/\/github.com\/whiteoctober\/Pagerfanta\">Pagerfanta<\/a>. \u041a\u0430\u0447\u0430\u0435\u043c \u0432 vendors, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c.<br \/>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441 Pagerfanta \u0432 \u0430\u0432\u0442\u043e\u043b\u043e\u0430\u0434\u0438\u043d\u0433:  <\/p>\n<pre><code class=\"php\">\/\/ index.php \/\/ ... \/\/ Namespace mapping $namespaces = array(   &quot;Art&quot; =&gt; __DIR__ . &quot;\/vendor\/Art&quot;,   &quot;Model&quot; =&gt; __DIR__ . &quot;\/model&quot;,    &quot;Pagerfanta&quot; =&gt; __DIR__ . &quot;\/vendor\/Pagerfanta&quot; ); <\/code><\/pre>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 PHP ActiveRecord:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">\/\/ vendor\/Art\/PfAdapter.php namespace Art;  class PfAdapter implements \\Pagerfanta\\Adapter\\AdapterInterface {   private $classname = null;   private $params = null;    public function __construct( $classname, $params = array() ) {     $this-&gt;classname = $classname;     $this-&gt;params = $params;   }    public function getNbResults() {     $params = array(       'select' =&gt; 'COUNT(*) as cnt',     );      if ( $this-&gt;params ) {     \t$params = array_merge($this-&gt;params, $params);     }          $cnt = call_user_func_array(       array($this-&gt;classname, &quot;all&quot;),        array($params)     );      if ( !$cnt ) {       return 0;     }      return $cnt[0]-&gt;cnt;   }    public function getSlice($offset, $length) {     $params = array(       'limit' =&gt; $length,       'offset' =&gt; $offset     );      if ( $this-&gt;params ) {       $params = array_merge($params, $this-&gt;params);     }      return call_user_func_array(       array($this-&gt;classname, &quot;all&quot;),        array($params)     );   } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0430\u0433\u0430\u043d\u0438\u0446\u0438\u044e \u043a \u0432\u044b\u0431\u043e\u0440\u043a\u0435:  <\/p>\n<pre><code class=\"php\">\/\/ controller\/index.php \/\/ ... $app-&gt;get('\/authors\/', function () use ($app) {   $ipp = 3;   $p = $app['request']-&gt;get('p', 1);      $adapter = new Art\\PfAdapter('Model\\Author', array(     'conditions' =&gt; 'id &lt; 1000',     'order' =&gt; 'id DESC'   ));    $pagerfanta = new Pagerfanta\\Pagerfanta($adapter);   $pagerfanta-&gt;setMaxPerPage($ipp);   $pagerfanta-&gt;setCurrentPage($p);    $view = new Pagerfanta\\View\\DefaultView;   $html = $view-&gt;render($pagerfanta, function($p) use ($app) {     return $app['url_generator']-&gt;generate('authors', array('p' =&gt; $p));   }, array(     'proximity'         =&gt; 3,     'previous_message'  =&gt; '\u00ab \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f',     'next_message'      =&gt; '\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u00bb'   ));    return $app['view']-&gt;render('layout.phtml', 'index\/authors.phtml', array(     'pagerfanta' =&gt; $pagerfanta,     'html' =&gt; $html   )); })-&gt;bind('authors'); \/\/ ... <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;!-- view\/index\/authors.phtml --&gt; &lt;?php $results = $pagerfanta-&gt;getCurrentPageResults() ?&gt;  &lt;?php if ( $results ): ?&gt; \t&lt;?php foreach ( $results as $author ): ?&gt; \t\t&lt;div&gt; \t\t\t&lt;?php echo $author-&gt;name ?&gt; \t\t\t&lt;div&gt; \t\t\t\t&lt;?php foreach ( $author-&gt;books as $book ): ?&gt; \t\t\t\t\t&lt;div&gt; \t\t\t\t\t\t&lt;a href=&quot;&lt;?php echo $app['url_generator']-&gt;generate('book', array('id' =&gt; $book-&gt;id)) ?&gt;&quot;&gt;&lt;?php echo $book-&gt;name ?&gt;&lt;\/a&gt; \t\t\t\t\t&lt;\/div&gt; \t\t\t\t&lt;?php endforeach ?&gt; \t\t\t&lt;\/div&gt; \t\t&lt;\/div&gt; \t&lt;?php endforeach ?&gt;  \t&lt;?php if ( $pagerfanta-&gt;haveToPaginate() ): ?&gt; \t\t&lt;div class=&quot;pagerfanta&quot;&gt; \t\t\t&lt;?php echo $html ?&gt; \t\t&lt;\/div&gt; \t&lt;?php endif ?&gt; &lt;?php else: ?&gt; \t\u041d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e &lt;?php endif ?&gt; <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/57c\/ff4\/205\/57cff4205c7b05e1bd44829a2df45050.png\"\/><br \/>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043b\u0435\u0433\u043a\u0438\u0439 \u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043f\u0440\u0438\u0433\u043e\u0434\u043d\u044b\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0442 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u0434\u043e \u043a\u0440\u0443\u043f\u043d\u044b\u0445.<br \/>  \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u2014 <a href=\"http:\/\/ge.tt\/8V7spTS\/v\/0\">habr.zip<\/a>.<br \/>  \u041d\u0430 \u0442\u0430\u043a\u043e\u043c \u0434\u0432\u0438\u0436\u043a\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d Open Source \u0430\u0443\u0434\u0438\u043e\u043f\u043b\u0435\u0435\u0440 \u2014 <a href=\"http:\/\/oplayer.org\">oplayer.org<\/a> (<a href=\"https:\/\/github.com\/uavn\/oplayer\">https:\/\/github.com\/uavn\/oplayer<\/a>).<\/p>\n<p>  P.S. \u0415\u0441\u0442\u044c \u0438 Yii, \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447 \u043b\u044e\u0431\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Symfony2, \u0430 Silex \u043d\u0430 \u043d\u0435\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0445\u043e\u0436, \u0447\u0435\u043c Yii.    \t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/160509\/\"> http:\/\/habrahabr.ru\/post\/160509\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage\/habraeffect\/bb\/fe\/bbfe0eaa317e00ae4912dbf9b5c4105a.png\" alt=\"Silex\" align=\"right\"\/>\u0414\u0430\u0432\u043d\u044b\u043c \u0434\u0430\u0432\u043d\u043e, \u0432 \u0434\u0430\u043b\u0435\u043a\u043e\u0439-\u0434\u0430\u043b\u0435\u043a\u043e\u0439 \u0433\u0430\u043b\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 PHP \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u2014 Symfony \u0438 ZF, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b\u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0441\u0440\u0435\u043d\u0434\u0435\u0433\u043e \u2014 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u043d\u0438\u0445, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430, \u0441\u0430\u0439\u0442\u044b \u0436\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e, \u0438, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u043d\u0430 \u043d\u0438\u0445 \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u043e \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0410 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0432\u043e \u0444\u0440\u0438\u043b\u0430\u043d\u0441, \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0438\u0445 \u0437\u0430\u043a\u0430\u0437\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043a \u0441\u0440\u0435\u043d\u0434\u0435\u043c\u0443 \u0443\u0440\u043e\u0432\u043d\u044e. \u041d\u0430 \u0444\u043e\u043d\u0435 \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043c\u0438\u043a\u0440\u043e-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438, \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 <a href=\"http:\/\/silex.sensiolabs.org\/\">Silex<\/a>, \u043e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Symfony. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e\u043d \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u0430\u0439\u0442\u044b, \u043d\u043e \u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0430\u0439\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u043e\u0436\u043d\u0435\u0435. <\/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-160509","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/160509","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=160509"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/160509\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=160509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=160509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=160509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}