{"id":3996,"date":"2020-05-18T09:00:00","date_gmt":"2020-05-18T07:00:00","guid":{"rendered":"https:\/\/wata.es\/?p=3996"},"modified":"2025-04-14T16:54:13","modified_gmt":"2025-04-14T14:54:13","slug":"modernization-of-php-legacy-projects-with-symfony","status":"publish","type":"post","link":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/","title":{"rendered":"Modernization of PHP legacy projects with Symfony"},"content":{"rendered":"\n<p>At WATA Factory, we have been confronted on several occasions with the modernisation of projects with <em>Legacy<\/em> code. In this article we will talk about how we have approached and <strong>how we have handled the situation<\/strong>.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>To get into the subject, we have <strong>to ask ourselves the following questions<\/strong>: (1) What do we understand by a <em>Legacy<\/em> project? (2) If it works, why should we change it? (3) How do we do it? Let us see!<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">What do we understand by a <em>Legacy<\/em> project?<\/h4>\n\n\n\n<p>For us, a <em>Legacy<\/em> code (or <a href=\"https:\/\/es.wikipedia.org\/wiki\/C%C3%B3digo_espagueti\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">spaghetti code<\/a>) is a code where, what we consider to be good development practices (clean code), is neither applied nor follows SOLID principles and furthermore has no good (or absolutely no) test coverage.<\/p>\n\n\n\n<p>Usually this code is an <strong>old code<\/strong> that has been in use for several years (and is more or less reliable), developed <strong>without framework<\/strong> or, in its lack, using an old version of one (e.g. Symfony 2).<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">If it works, why should we change it?<\/h4>\n\n\n\n<p>This is a very good question, especially because in our branch you often (sometimes too often) hear: <em>if it works, don&#8217;t change it<\/em>.<\/p>\n\n\n\n<p>The answer to this question is not easy. We should consider modernisation (or not) from the point of view of sustainability and coherence with the practices that are carried out daily in the company.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><em>Sustainability<\/em>, because when we talk about an ongoing project, every time a new development is made, all we achieve is to keep feeding the <em>monster<\/em>. <strong>The time will come when the modernisation we have been talking about will be practically impossible<\/strong> without investing a lot of time and therefore money.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><em>Coherence<\/em>, because if the new projects follow a series of quality standards, unity or integration tests, etc., <strong>why will we have ongoing projects where these practices are not applied<\/strong> simply because it is a long-term project?<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">How do we do it?<\/h4>\n\n\n\n<p>If we have reached this point, it is because we are convinced that we want to renew our code.<\/p>\n\n\n\n<p>At WATA Factory we work with Symfony, so in our case <strong>we will create a project for this framework and integrate the <em>Legacy<\/em> code in it<\/strong>.<\/p>\n\n\n\n<p>When we develop new features, we will develop them as part of the Symfony project. <strong>The old features will be included in what we will call <em>LegacyBundle<\/em><\/strong>. We implement this process by following the steps listed in <a href=\"https:\/\/stovepipe.systems\/post\/migrating-your-project-to-symfony\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">this guide<\/a> (published by Yannick de Lange).<\/p>\n\n\n\n<p>This <em>bundle<\/em> will contain the entire <em>Legacy<\/em> project, and by routing we will redirect our new <em>endpoints<\/em> to the old code so that everything still works.<\/p>\n\n\n\n<p>This structure allows us to avoid having to migrate the entire project at once, with the time and risk that this entails. When we modify existing functionality, we must remember to remove it from the <em>Legacy<\/em> area and add it to the new area. This will lead to <strong>the Legacy part becoming smaller and smaller over time<\/strong>.<\/p>\n\n\n\n<p>If for some reason Symfony is not used and the <em>Legacy<\/em> code and the new code cannot coexist, we recommend following the guide included in the book <em>Modernizing Legacy Applications in PHP<\/em> by Paul M. Jones.<\/p>\n\n\n\n<p>Paul M. provides us with guidelines for modernizing the project, including <em>autoload<\/em>, code refactoring, etc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At WATA Factory, we have been confronted on several occasions with the modernisation of projects with Legacy code. In this article we will talk about how we have approached and how we have handled the situation.<\/p>\n","protected":false},"author":18,"featured_media":3975,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2,180],"tags":[],"class_list":["post-3996","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","category-technology"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Modernization of PHP legacy projects with Symfony - WATA Factory<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Modernization of PHP legacy projects with Symfony - WATA Factory\" \/>\n<meta property=\"og:description\" content=\"At WATA Factory, we have been confronted on several occasions with the modernisation of projects with Legacy code. In this article we will talk about how we have approached and how we have handled the situation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/\" \/>\n<meta property=\"og:site_name\" content=\"WATA Factory\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/watafactory\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-18T07:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-14T14:54:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wata.es\/wp-content\/uploads\/2020\/05\/modernizing-legacy-apps-in-php.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1440\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Alberto Montes de Oca\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@watafactory\" \/>\n<meta name=\"twitter:site\" content=\"@watafactory\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alberto Montes de Oca\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/\"},\"author\":{\"name\":\"Alberto Montes de Oca\",\"@id\":\"https:\/\/wata.es\/#\/schema\/person\/7d4145f02ca775947231990ea4e793c9\"},\"headline\":\"Modernization of PHP legacy projects with Symfony\",\"datePublished\":\"2020-05-18T07:00:00+00:00\",\"dateModified\":\"2025-04-14T14:54:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/\"},\"wordCount\":544,\"publisher\":{\"@id\":\"https:\/\/wata.es\/#organization\"},\"image\":{\"@id\":\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/wata.es\/wp-content\/uploads\/2020\/05\/modernizing-legacy-apps-in-php.jpg\",\"articleSection\":[\"News\",\"Technology\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/\",\"url\":\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/\",\"name\":\"Modernization of PHP legacy projects with Symfony - WATA Factory\",\"isPartOf\":{\"@id\":\"https:\/\/wata.es\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/wata.es\/wp-content\/uploads\/2020\/05\/modernizing-legacy-apps-in-php.jpg\",\"datePublished\":\"2020-05-18T07:00:00+00:00\",\"dateModified\":\"2025-04-14T14:54:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#primaryimage\",\"url\":\"https:\/\/wata.es\/wp-content\/uploads\/2020\/05\/modernizing-legacy-apps-in-php.jpg\",\"contentUrl\":\"https:\/\/wata.es\/wp-content\/uploads\/2020\/05\/modernizing-legacy-apps-in-php.jpg\",\"width\":2560,\"height\":1440},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wata.es\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Modernization of PHP legacy projects with Symfony\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wata.es\/#website\",\"url\":\"https:\/\/wata.es\/\",\"name\":\"WATA Factory\",\"description\":\"IT Consulting &amp; Outsourcing for your company\",\"publisher\":{\"@id\":\"https:\/\/wata.es\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wata.es\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/wata.es\/#organization\",\"name\":\"WATA Factory\",\"url\":\"https:\/\/wata.es\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wata.es\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/wata.es\/wp-content\/uploads\/2019\/12\/logowata.png\",\"contentUrl\":\"https:\/\/wata.es\/wp-content\/uploads\/2019\/12\/logowata.png\",\"width\":688,\"height\":176,\"caption\":\"WATA Factory\"},\"image\":{\"@id\":\"https:\/\/wata.es\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/watafactory\/\",\"https:\/\/x.com\/watafactory\",\"https:\/\/www.linkedin.com\/company\/wata\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/wata.es\/#\/schema\/person\/7d4145f02ca775947231990ea4e793c9\",\"name\":\"Alberto Montes de Oca\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wata.es\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/39e860f956ed5a2158e968100c577f5761d6a846ca021ca3ab9a5dc2e0438c34?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/39e860f956ed5a2158e968100c577f5761d6a846ca021ca3ab9a5dc2e0438c34?s=96&d=mm&r=g\",\"caption\":\"Alberto Montes de Oca\"},\"url\":\"https:\/\/wata.es\/author\/a-montesdeoca\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Modernization of PHP legacy projects with Symfony - WATA Factory","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/","og_locale":"en_US","og_type":"article","og_title":"Modernization of PHP legacy projects with Symfony - WATA Factory","og_description":"At WATA Factory, we have been confronted on several occasions with the modernisation of projects with Legacy code. In this article we will talk about how we have approached and how we have handled the situation.","og_url":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/","og_site_name":"WATA Factory","article_publisher":"https:\/\/www.facebook.com\/watafactory\/","article_published_time":"2020-05-18T07:00:00+00:00","article_modified_time":"2025-04-14T14:54:13+00:00","og_image":[{"width":2560,"height":1440,"url":"https:\/\/wata.es\/wp-content\/uploads\/2020\/05\/modernizing-legacy-apps-in-php.jpg","type":"image\/jpeg"}],"author":"Alberto Montes de Oca","twitter_card":"summary_large_image","twitter_creator":"@watafactory","twitter_site":"@watafactory","twitter_misc":{"Written by":"Alberto Montes de Oca","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#article","isPartOf":{"@id":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/"},"author":{"name":"Alberto Montes de Oca","@id":"https:\/\/wata.es\/#\/schema\/person\/7d4145f02ca775947231990ea4e793c9"},"headline":"Modernization of PHP legacy projects with Symfony","datePublished":"2020-05-18T07:00:00+00:00","dateModified":"2025-04-14T14:54:13+00:00","mainEntityOfPage":{"@id":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/"},"wordCount":544,"publisher":{"@id":"https:\/\/wata.es\/#organization"},"image":{"@id":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#primaryimage"},"thumbnailUrl":"https:\/\/wata.es\/wp-content\/uploads\/2020\/05\/modernizing-legacy-apps-in-php.jpg","articleSection":["News","Technology"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/","url":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/","name":"Modernization of PHP legacy projects with Symfony - WATA Factory","isPartOf":{"@id":"https:\/\/wata.es\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#primaryimage"},"image":{"@id":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#primaryimage"},"thumbnailUrl":"https:\/\/wata.es\/wp-content\/uploads\/2020\/05\/modernizing-legacy-apps-in-php.jpg","datePublished":"2020-05-18T07:00:00+00:00","dateModified":"2025-04-14T14:54:13+00:00","breadcrumb":{"@id":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#primaryimage","url":"https:\/\/wata.es\/wp-content\/uploads\/2020\/05\/modernizing-legacy-apps-in-php.jpg","contentUrl":"https:\/\/wata.es\/wp-content\/uploads\/2020\/05\/modernizing-legacy-apps-in-php.jpg","width":2560,"height":1440},{"@type":"BreadcrumbList","@id":"https:\/\/wata.es\/modernization-of-php-legacy-projects-with-symfony\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wata.es\/"},{"@type":"ListItem","position":2,"name":"Modernization of PHP legacy projects with Symfony"}]},{"@type":"WebSite","@id":"https:\/\/wata.es\/#website","url":"https:\/\/wata.es\/","name":"WATA Factory","description":"IT Consulting &amp; Outsourcing for your company","publisher":{"@id":"https:\/\/wata.es\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wata.es\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/wata.es\/#organization","name":"WATA Factory","url":"https:\/\/wata.es\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wata.es\/#\/schema\/logo\/image\/","url":"https:\/\/wata.es\/wp-content\/uploads\/2019\/12\/logowata.png","contentUrl":"https:\/\/wata.es\/wp-content\/uploads\/2019\/12\/logowata.png","width":688,"height":176,"caption":"WATA Factory"},"image":{"@id":"https:\/\/wata.es\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/watafactory\/","https:\/\/x.com\/watafactory","https:\/\/www.linkedin.com\/company\/wata\/"]},{"@type":"Person","@id":"https:\/\/wata.es\/#\/schema\/person\/7d4145f02ca775947231990ea4e793c9","name":"Alberto Montes de Oca","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wata.es\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/39e860f956ed5a2158e968100c577f5761d6a846ca021ca3ab9a5dc2e0438c34?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/39e860f956ed5a2158e968100c577f5761d6a846ca021ca3ab9a5dc2e0438c34?s=96&d=mm&r=g","caption":"Alberto Montes de Oca"},"url":"https:\/\/wata.es\/author\/a-montesdeoca\/"}]}},"_links":{"self":[{"href":"https:\/\/wata.es\/wp-json\/wp\/v2\/posts\/3996","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wata.es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wata.es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wata.es\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/wata.es\/wp-json\/wp\/v2\/comments?post=3996"}],"version-history":[{"count":2,"href":"https:\/\/wata.es\/wp-json\/wp\/v2\/posts\/3996\/revisions"}],"predecessor-version":[{"id":11950,"href":"https:\/\/wata.es\/wp-json\/wp\/v2\/posts\/3996\/revisions\/11950"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wata.es\/wp-json\/wp\/v2\/media\/3975"}],"wp:attachment":[{"href":"https:\/\/wata.es\/wp-json\/wp\/v2\/media?parent=3996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wata.es\/wp-json\/wp\/v2\/categories?post=3996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wata.es\/wp-json\/wp\/v2\/tags?post=3996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}