<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Selcuk Mart on Medium]]></title>
        <description><![CDATA[Stories by Selcuk Mart on Medium]]></description>
        <link>https://medium.com/@martselcuk?source=rss-2210e2dc372e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wYXJZBdVtkKGXmfGGEhUdg.png</url>
            <title>Stories by Selcuk Mart on Medium</title>
            <link>https://medium.com/@martselcuk?source=rss-2210e2dc372e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 21:17:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@martselcuk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[NP-Hard in a Web Request: Timetabling Inside a Multi-Tenant SaaS]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@martselcuk/a-216-digit-problem-a-one-second-budget-and-two-commented-out-lines-fd6c35e327de?source=rss-2210e2dc372e------2"><img src="https://cdn-images-1.medium.com/max/2400/1*Y63v51xZi9Umeh_CaGFA-Q.png" width="2400"></a></p><p class="medium-feed-snippet">How I shipped an NP-hard scheduler inside a multi-tenant SaaS, and why the complete search is still switched off</p><p class="medium-feed-link"><a href="https://medium.com/@martselcuk/a-216-digit-problem-a-one-second-budget-and-two-commented-out-lines-fd6c35e327de?source=rss-2210e2dc372e------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@martselcuk/a-216-digit-problem-a-one-second-budget-and-two-commented-out-lines-fd6c35e327de?source=rss-2210e2dc372e------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd6c35e327de</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[saas]]></category>
            <dc:creator><![CDATA[Selcuk Mart]]></dc:creator>
            <pubDate>Sat, 25 Jul 2026 18:45:29 GMT</pubDate>
            <atom:updated>2026-08-06T07:51:25.536Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[From $_GET to #[ApiResource]: The Final Phase of a PHP Modernization]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@martselcuk/from-get-to-apiresource-the-final-phase-of-a-php-modernization-d4d528bc3e8c?source=rss-2210e2dc372e------2"><img src="https://cdn-images-1.medium.com/max/2231/1*SlGk0mDu23IZ6WaNPj4ekQ.png" width="2231"></a></p><p class="medium-feed-snippet">Part 4 of 4: Killing the last legacy container, planning with markdown instead of mindmaps, and why the project files took longer than the&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@martselcuk/from-get-to-apiresource-the-final-phase-of-a-php-modernization-d4d528bc3e8c?source=rss-2210e2dc372e------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@martselcuk/from-get-to-apiresource-the-final-phase-of-a-php-modernization-d4d528bc3e8c?source=rss-2210e2dc372e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4d528bc3e8c</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[api-platform]]></category>
            <category><![CDATA[restful-api]]></category>
            <category><![CDATA[legacy-code]]></category>
            <category><![CDATA[symfony]]></category>
            <dc:creator><![CDATA[Selcuk Mart]]></dc:creator>
            <pubDate>Sun, 31 May 2026 07:28:04 GMT</pubDate>
            <atom:updated>2026-05-31T07:28:04.898Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[From Hand-Built CSS to Metronic 8: Reskinning a PHP Monolith Without Downtime]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@martselcuk/from-hand-built-css-to-metronic-8-reskinning-a-php-monolith-without-downtime-d7b626520e1a?source=rss-2210e2dc372e------2"><img src="https://cdn-images-1.medium.com/max/1410/1*hTT8rQDPEjx994T_zdRnCA.png" width="1410"></a></p><p class="medium-feed-snippet">Part 3 of 4: Bootstrap vs Tailwind, a custom translation engine, and how AI went from copy-paste assistant to full development partner</p><p class="medium-feed-link"><a href="https://medium.com/@martselcuk/from-hand-built-css-to-metronic-8-reskinning-a-php-monolith-without-downtime-d7b626520e1a?source=rss-2210e2dc372e------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@martselcuk/from-hand-built-css-to-metronic-8-reskinning-a-php-monolith-without-downtime-d7b626520e1a?source=rss-2210e2dc372e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7b626520e1a</guid>
            <category><![CDATA[metronic]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[ai-coding-assistant]]></category>
            <category><![CDATA[iso-27001]]></category>
            <category><![CDATA[internationalization]]></category>
            <dc:creator><![CDATA[Selcuk Mart]]></dc:creator>
            <pubDate>Sun, 31 May 2026 07:24:18 GMT</pubDate>
            <atom:updated>2026-05-31T07:24:18.714Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[184 Tables Renamed, 98 Routes Migrated: Bringing Symfony to a Legacy PHP Monolith]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@martselcuk/184-tables-renamed-98-routes-migrated-bringing-symfony-to-a-legacy-php-monolith-54e50e82ce7e?source=rss-2210e2dc372e------2"><img src="https://cdn-images-1.medium.com/max/2230/1*dGw5SModnJw-4veN17O7HA.png" width="2230"></a></p><p class="medium-feed-snippet">Part 2 of 4: How we made a decade-old codebase run through Symfony controllers without rewriting business logic</p><p class="medium-feed-link"><a href="https://medium.com/@martselcuk/184-tables-renamed-98-routes-migrated-bringing-symfony-to-a-legacy-php-monolith-54e50e82ce7e?source=rss-2210e2dc372e------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@martselcuk/184-tables-renamed-98-routes-migrated-bringing-symfony-to-a-legacy-php-monolith-54e50e82ce7e?source=rss-2210e2dc372e------2</link>
            <guid isPermaLink="false">https://medium.com/p/54e50e82ce7e</guid>
            <category><![CDATA[symfony]]></category>
            <category><![CDATA[database-migration]]></category>
            <category><![CDATA[legacy-code]]></category>
            <category><![CDATA[doctrine-orm]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Selcuk Mart]]></dc:creator>
            <pubDate>Fri, 29 May 2026 22:46:32 GMT</pubDate>
            <atom:updated>2026-05-30T10:46:01.740Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[1.6 Million Lines, Zero Namespaces: A PHP Modernization War Story]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@martselcuk/1-6-million-lines-zero-namespaces-a-php-modernization-war-story-99923d0a161f?source=rss-2210e2dc372e------2"><img src="https://cdn-images-1.medium.com/max/2233/1*TXoWPud8gPr45vfAZwleUA.png" width="2233"></a></p><p class="medium-feed-snippet">Part 1 of 4: Building an AutoloadConverter to migrate 10,000 include/require statements to PSR-4</p><p class="medium-feed-link"><a href="https://medium.com/@martselcuk/1-6-million-lines-zero-namespaces-a-php-modernization-war-story-99923d0a161f?source=rss-2210e2dc372e------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@martselcuk/1-6-million-lines-zero-namespaces-a-php-modernization-war-story-99923d0a161f?source=rss-2210e2dc372e------2</link>
            <guid isPermaLink="false">https://medium.com/p/99923d0a161f</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[code-migration]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[legacy-code]]></category>
            <dc:creator><![CDATA[Selcuk Mart]]></dc:creator>
            <pubDate>Fri, 29 May 2026 21:25:57 GMT</pubDate>
            <atom:updated>2026-10-15T16:02:04.695Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[ULTRA SECURE PANEL]]></title>
            <link>https://medium.com/@martselcuk/ultra-secure-panel-cf2f6637c4c1?source=rss-2210e2dc372e------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf2f6637c4c1</guid>
            <dc:creator><![CDATA[Selcuk Mart]]></dc:creator>
            <pubDate>Wed, 22 May 2024 19:28:00 GMT</pubDate>
            <atom:updated>2024-07-27T12:09:37.613Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EB5YnuVRuq_O8qeCSYraLQ.png" /></figure><p>This is a first draft of the world’s most secure management panel, incorporating concepts from current software and hardware technologies. The title can be further refined by developers specializing in security. This document is closed to discussion on why this level of security is necessary and open to discussion on how to make it more secure.</p><p><strong>Key Principles:</strong></p><p><strong>- Panel Security Over Speed:</strong> The security of the panel is prioritized over system speed.</p><p><strong>- User Security:</strong> The security of users is the utmost priority.</p><p><strong>Mandatory Security Features:</strong></p><p><strong>1. Personal Data Restrictions:</strong></p><p>- Usage of any national IDs, emails, phone numbers, fingerprints, face IDs, iris scans, names, surnames, professions, locations, or similar data within the system is strictly forbidden.</p><p>- Usernames must be nicknames with at least three numeric postfixes.</p><p><strong>2. Encryption Standards:</strong></p><p>- Each panel must use multiple layers of encryption, including a custom encryption method.</p><p>- All data, including every single database entry, must be encrypted.</p><p>- Numeric auto-increment IDs for databases are forbidden.</p><p>- The hard disk installed on the panel must be encrypted.</p><p><strong>3. Hashing and Data Security:</strong></p><p>- The panel must support using IP addresses and hostnames to hash and encrypt data by default.</p><p>- The system must support automatic data destruction if hacked, stolen, or installed on a new server.</p><p><strong>4. Compilation and Code Security:</strong></p><p>- The panel software must be compiled regardless of the coding language used.</p><p>- It must support a configurable degree-based hierarchical role system, a role-based user system, and a role-based/profiled menu system with assigned degrees.</p><p><strong>5. Data Handling:</strong></p><p>- Data can be sealed by multiple users and require all seals for access.</p><p>- Data must have an auto-vanish mechanism defined by users or the owner.</p><p><strong>6. Integration and Communication:</strong></p><p>- The panel must support third-party API integrations.</p><p>- Optional peer-to-peer chat with auto-vanish functionality.</p><p><strong>7. Open Source Requirement:</strong></p><p>- The panel must be open source. Panels that are not open source are excluded from this category.</p><p><strong>8. Logging and Anonymity:</strong></p><p>- The system must not log user movements, IP addresses, or locations.</p><p>- Data removal must result in data vanishing.</p><p>- The software must be able to appear as a different program on desktop or mobile devices, such as a calculator application.</p><p><strong>9. Access and Authentication:</strong></p><p>- VPN or proxy usage is mandatory; direct access is forbidden.</p><p>- Integration of modules as microservices must include blocking configurations.</p><p>- Two-factor authentication is forbidden, replaced by at least two-step password login.</p><p>- Quick-access buttons for blurring or clearing portions of the screen.</p><p><strong>10. Operational Security:</strong></p><p>- Configurable print, copy-paste, and export functions.</p><p>- Automatic logout and redirection to login after a few minutes of inactivity.</p><p>- User training on best security practices.</p><p>- At least three senior developers must oversee the panel.</p><p>- Developers must not have access to real data; real database access requires at least three high-priority user seals.</p><p>- Custom longitude-latitude system support for Earth maps.</p><p>- Full backup/import functionality for offline use with at least three high-priority user seals.</p><p>This concept aims to establish a robust foundation for creating an ultra-secure management panel. Developers and security experts can further refine and enhance these guidelines to meet evolving security challenges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf2f6637c4c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Singleton is a MUST]]></title>
            <link>https://medium.com/@martselcuk/singleton-is-a-must-5d4563772178?source=rss-2210e2dc372e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d4563772178</guid>
            <category><![CDATA[singleton]]></category>
            <category><![CDATA[singleton-pattern]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[object-oriented]]></category>
            <dc:creator><![CDATA[Selcuk Mart]]></dc:creator>
            <pubDate>Thu, 12 May 2022 15:13:00 GMT</pubDate>
            <atom:updated>2022-05-12T18:03:16.682Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y-EtdthPDu6Zru_FNpP0AQ.jpeg" /><figcaption>Singleton Park — hothouse, cactus</figcaption></figure><p>The topic is not about scotch :).</p><p>As developers our work is managing the complexity, coupling etc… Most of the time we handle same type data or same data multiple times in a runtime. For example, while we are preparing a profile area for a student, we may need same student data in lots of different classes. As the first we need to make a query but second or third or … What is the solution? Is setting into session or caching or making global a variable?</p><pre>$student = new Student(123);<br>$data = $student-&gt;getData();</pre><h3>Solution</h3><p><em>Note: The code is refactored to PHP 8.1</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6af78315478ce11435d2817083935a51/href">https://medium.com/media/6af78315478ce11435d2817083935a51/href</a></iframe><p>We are setting student instance to a static parameter. And from now on whenever we need the object we are accessing the necessary object without re-query.</p><pre><em>/**<br> * @param int $student_id<br> * @return Student<br> */<br></em>public <strong>static</strong> function getInstance(int $student_id): Student<br>{<br>    if (!isset(self::<em>$instance</em>[$student_id])) {<br>       <strong> self::<em>$instance</em>[$student_id] = new self($student_id);</strong><br>    }<br>    return <strong>self::<em>$instance</em>[$student_id]</strong>;<br>}</pre><p>These examples can be increased.</p><p><em>Note: If you need to use in an </em><strong><em>abstract class</em></strong><em> and extend this concrete class to this abstract, you must use “</em><strong><em>static</em></strong><em>” instead of </em><strong><em>self</em></strong><em> (new static($student_id))!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d4563772178" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Traits:Robotic Assembly Lines of PHP]]></title>
            <link>https://medium.com/@martselcuk/traits-robotic-assembly-lines-of-php-f400f5e69340?source=rss-2210e2dc372e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f400f5e69340</guid>
            <category><![CDATA[traits]]></category>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[php-oop]]></category>
            <category><![CDATA[object-oriented]]></category>
            <dc:creator><![CDATA[Selcuk Mart]]></dc:creator>
            <pubDate>Mon, 09 May 2022 09:40:57 GMT</pubDate>
            <atom:updated>2022-05-16T06:59:18.561Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fMDIpSPiinYUG4zTIsq9UQ.jpeg" /><figcaption>Robotic Assembly Lines of PHP</figcaption></figure><blockquote><strong>NOTE: As a first,Trait can be read from PHP.NET: </strong><a href="https://www.php.net/manual/en/language.oop5.traits.php"><strong>https://www.php.net/manual/en/language.oop5.traits.php</strong></a></blockquote><p>PHP’s assembly line <strong>TRAIT</strong> is helper of PHP developers.</p><p>Trait’s Goals;</p><ul><li>Single Responsible Worker,</li><li>Methods’s Grouping,</li><li>Assembly Line</li></ul><p>There is common sentence in our country for a new very useful tool; “When this tool were absent, how we were making this job!”</p><p>Trait is this very useful tool. If we remove the Trait from PHP, how can we code! I think this is an awful idea. Therefore Trait is very very useful tool. But how?</p><h3>Single Responsible Worker</h3><p>Trait can be used as a global single responsible class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/648cd2abf8a3680d7e58a4641f0206c2/href">https://medium.com/media/648cd2abf8a3680d7e58a4641f0206c2/href</a></iframe><p>This ErrorMessagesTrait can be used in every class. It’s a global trait can be used everywhere easily.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5f89e5a49d4329aea9cb0dc3f297adc/href">https://medium.com/media/e5f89e5a49d4329aea9cb0dc3f297adc/href</a></iframe><p>CC Trait is a private Trait. It can be used only in same bundle.</p><h3>Methods’s Grouping</h3><p>Sometimes we can not run away from long classes. It can be obligatory. Especially if we have lots of methods and subclasses which need these our super class’s methods. Right here <strong>TRAIT</strong> helps us.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/45ce0974464dac6a58127ebeefd5da59/href">https://medium.com/media/45ce0974464dac6a58127ebeefd5da59/href</a></iframe><h3>Assembly Line</h3><p>I think, <strong>TRAIT’s</strong> power can be seen with this example. This example is only pseudo example.</p><p>Imagine that you are creating a car. All cars don’t have same properties.</p><p>Our Car Brand may be “XYZ” and sub model may be “Mega”.</p><p>We have three types of Mega</p><ul><li>Mega Exclusive</li><li>Mega Avantgard</li><li>Mega Style</li></ul><p><strong>Exclusive Properties: </strong>steel rim, automatic transmission,21 inch wheels, standard props<br><strong>Avantgard Properties: </strong>automatic transmission,21 inch wheels, standard props<br><strong>Style Properties: </strong>21 inch wheels, standard props</p><p>Our Mega <strong>Exclusive</strong>;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/59c10c0860cff19d4137a32677b0d859/href">https://medium.com/media/59c10c0860cff19d4137a32677b0d859/href</a></iframe><p>Our Mega <strong>Avantgard</strong>;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1abba9d6b73ffb06a3a06757e0c9b49c/href">https://medium.com/media/1abba9d6b73ffb06a3a06757e0c9b49c/href</a></iframe><p>Our Mega <strong>Style</strong>;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b15c2ef1a0354ad9a03e9c393baf88ec/href">https://medium.com/media/b15c2ef1a0354ad9a03e9c393baf88ec/href</a></iframe><p>PHP has powerful tools for OOP. <strong>TRAIT</strong> is one of the most important tools.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f400f5e69340" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Power of Late Static Binding!]]></title>
            <link>https://medium.com/@martselcuk/power-of-late-static-binding-a435a4477514?source=rss-2210e2dc372e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a435a4477514</guid>
            <category><![CDATA[late-static-binding]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[object-oriented]]></category>
            <dc:creator><![CDATA[Selcuk Mart]]></dc:creator>
            <pubDate>Fri, 06 May 2022 09:56:20 GMT</pubDate>
            <atom:updated>2022-05-16T07:01:35.291Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1NQRjUKyo0PQ94YGf8OLCw.jpeg" /></figure><h3>If you have super classes, sometimes you will need this property</h3><p>Most of the time we do things that are repeatable. For example we are accessing a user 5 times in a runtime, taking data same student 10 times in a runtime,…</p><p>We are using singleton for this repeatable situations. But sometimes we need to use these singletons in a super class. Ok but how?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d7c8fa6d902e08837884bcadf69381a0/href">https://medium.com/media/d7c8fa6d902e08837884bcadf69381a0/href</a></iframe><p>We are using it getInstance in the class. And we executed the class using “self”.</p><p>But if we take it into abstract class and extend this class into abstract class?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9eaf892f05c2f0e1e13fe256815e7922/href">https://medium.com/media/9eaf892f05c2f0e1e13fe256815e7922/href</a></iframe><p>We can see power of “static”. And now all subclasses can use easily this method.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a435a4477514" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open Closed Principle From SOLID: Implementing Rules, Technics and Real PHP Examples]]></title>
            <link>https://medium.com/@martselcuk/open-closed-principle-from-solid-implementing-rules-technics-and-real-php-examples-4ff0c5f6bace?source=rss-2210e2dc372e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ff0c5f6bace</guid>
            <category><![CDATA[open-closed-principle]]></category>
            <category><![CDATA[open-closed-technics]]></category>
            <category><![CDATA[open-closed-php]]></category>
            <category><![CDATA[solid]]></category>
            <dc:creator><![CDATA[Selcuk Mart]]></dc:creator>
            <pubDate>Wed, 04 May 2022 07:15:26 GMT</pubDate>
            <atom:updated>2022-05-16T17:59:00.729Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ej5HfI_xuzVCaqh-Rv6XGg.jpeg" /></figure><p>I think, every coder familiar with SOLID knows this classic sentence about OPEN CLOSED:</p><blockquote>Classes should be open for extension but closed for modification.</blockquote><p>We read this sentence everywhere but <strong><em>how to do it?</em></strong></p><p><strong><em>NOTE:</em></strong> Every class is refactored to 8.0 or 8.1, if you are using previous PHP version, please refactor it.</p><h3>Implementing Rules for Open Closed Principle</h3><p>Every modern teams have coding rules. However, i think it gets better mentioning about rules.</p><p>If we want to use this principle, we should be aware of these rules;<br> — Using PSR standards, (<em>Nowadays all systems(frameworks, cores etc) have a standard)<br></em> — Using Coding Rules: Class method names, class names, constant names must have a rule (camelCase, UpperCamelCase, kebab case, …case),</p><p><em>Why do we need these rules?</em></p><p><strong><em>Note: </em></strong><em>Our examples is according to PSR4 and</em><strong><em> </em></strong><em>UpperCamelCase for classes</em>, <em>camelCase for methods</em></p><h3>Implementing Technics?</h3><p>We often do the same things when we write code. We solve similar problems. And in a bundle, we execute similar commands etc…</p><p>Therefore our codes are extending in a similar way. Our codes come into leaf. Right here we can use our technics;<br>1. Prepare a Class or Method Name from slugs and call the class’s method,<br>2. Get Class Lists under a folder,<br>2.1. if required, it can be ordered,<br>2.2. Run a loop (foreach, for, iterable ….)</p><p>I will explain all techs with examples.</p><h3>First we need a class for converting slugs to class name and methods</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/12d33a9378126285ef44606ae78a4a9a/href">https://medium.com/media/12d33a9378126285ef44606ae78a4a9a/href</a></iframe><h3>1. Prepare a Class or Method Name from slugs and call the class’s method Example</h3><p>URL format: /example-path/{library}/{command}</p><p><strong><em>Library Format: </em></strong>it is written as hyphen-separated. API converts it to UpperCamelCase format. And this format defines your proxy classname and library folder name. Example: <a href="http://localhost/example-path">http://localhost/example-path</a>/registered-students/prepare-lists to RegisteredStudents as Library name:RegisteredStudents</p><p><strong><em>Command Format: </em></strong>it is written as hyphen-separated. API converts it to camelCase format. And this format defines your command will be executed. Example: <a href="http://localhost/example-path">http://localhost/example-path</a>/registered-students/prepare-lists... to prepareLists</p><p>Code Examples;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b66e8040bd518534f37354f111bfe66/href">https://medium.com/media/2b66e8040bd518534f37354f111bfe66/href</a></iframe><h3><strong>2. Get Class Lists under a folder Example</strong></h3><p>We need again a class;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0c3b14fccb9b6d83b961b9aff6968ab/href">https://medium.com/media/c0c3b14fccb9b6d83b961b9aff6968ab/href</a></iframe><h3><strong>Scenario</strong></h3><p>We have a student search input in our course automation panel. Every panel user can reach this input everywhere in panel. They are searching sometimes name surname, sometimes a phone number, a mail, an id, an identity number etc.</p><p>As developers we have to prepare an sql for this search. But the question is “where do we look for these data?”. Because user can search a variety of search. Therefore we have to detect the type of data and prepare an sql according to data type.</p><p>And the other problem, these searching types can increase! How to handle to add easily new search type to the search system.</p><p>—</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*F6Vw6kpKCvCcZF9vFhLJHA.png" /><figcaption>We don’t know the search term’s type</figcaption></figure><p>The client makes a search and we don’t know the type of it.</p><p>Is it an ID, phone, mail or only a string ...?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/523ab43ba0f697b7cc6dce0f7c59b8ba/href">https://medium.com/media/523ab43ba0f697b7cc6dce0f7c59b8ba/href</a></iframe><p>Search Interface;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c19aaa2c8d7fcd329824608b0365b4d1/href">https://medium.com/media/c19aaa2c8d7fcd329824608b0365b4d1/href</a></iframe><p>We have to make validation in an order the search term. Because while validating ID, we are using is_numeric, but also phone is numeric. Therefore we need a PRIORITY to validate type. First we need validate phone, if it is not we have to validate ID.</p><p>ID Example;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8f1219f1dab4114dbd2bdff8047d147c/href">https://medium.com/media/8f1219f1dab4114dbd2bdff8047d147c/href</a></iframe><p>Phone Example</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1edf44a22037e367ed5df9bce80f58da/href">https://medium.com/media/1edf44a22037e367ed5df9bce80f58da/href</a></iframe><p>We can add unlimited search types under <strong><em>SearchTypes </em></strong>folder and we don’t need to change anything <strong><em>StudentSearch</em></strong> class. And we did it;</p><blockquote>Classes should be open for extension but closed for modification.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ff0c5f6bace" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>