<?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 Kristina Odziomkova on Medium]]></title>
        <description><![CDATA[Stories by Kristina Odziomkova on Medium]]></description>
        <link>https://medium.com/@kristina.odziomkova?source=rss-a8e0ae529712------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eIEh1_s0OjwH9cRwUsrrQg.jpeg</url>
            <title>Stories by Kristina Odziomkova on Medium</title>
            <link>https://medium.com/@kristina.odziomkova?source=rss-a8e0ae529712------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 01:08:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kristina.odziomkova/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[Web Accessibility in 2025 (/)]]></title>
            <link>https://blog.meetbrackets.com/web-accessibility-in-2025-679551dbffac?source=rss-a8e0ae529712------2</link>
            <guid isPermaLink="false">https://medium.com/p/679551dbffac</guid>
            <category><![CDATA[wcag]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Kristina Odziomkova]]></dc:creator>
            <pubDate>Mon, 21 Jul 2025 10:50:37 GMT</pubDate>
            <atom:updated>2025-07-29T06:34:20.062Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Web Accessibility in 2025 EU/Slovakia" src="https://cdn-images-1.medium.com/max/1024/1*KwTHLKCGR1X14Iw7u23piQ.jpeg" /></figure><p><strong>Why Accessibility Matters — And How to Get It Right</strong></p><h3>Content</h3><ol><li>What is Accessibility / A11Y?</li><li>Types of Disabilities</li><li>A11y for Everyone</li><li>🇪🇺/🇸🇰 Legislation</li><li>🇪🇺/🇸🇰 Requirements</li><li>Accessibility Overlays — to use or not to use?</li><li>Four Principles of A11Y — POUR</li><li>WCAG Compliance Levels</li><li>2025 Statistics</li><li>Tools for Testing A11Y</li><li>Examples of a11y errors from our testing of real websites</li><li>How to fix the most common problems</li><li>Sources &amp; Links</li></ol><h3>1. What is accessibility / a11y?</h3><p><strong>Accessibility</strong> means designing products, services, and environments so that people with disabilities can use them easily and independently.</p><figure><img alt="a11y = accessibility. There are 11 letters between first and last letter of the word “accessibility”." src="https://cdn-images-1.medium.com/max/1024/0*IXIcu7OFob3kFnot.png" /><figcaption><strong>a11y</strong> as abbreviation for the word “accessibility”</figcaption></figure><blockquote><strong>More than a quarter (26.8%) </strong>of people aged 16 years and over in the <strong>EU</strong> had a disability in 2023. — <a href="https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Population_with_disability">Eurostat</a></blockquote><h3>2. Types of disabilities</h3><p><strong>Visual disabilities: </strong>blindness, low vision, color blindness<br><em>Accessibility</em>: Screen readers, high-contrast text, text resizing, color-blind friendly design</p><p><strong>Hearing disabilities: </strong>deafness, hard of hearing<br><em>Accessibility</em>: Captions/subtitles on videos, visual alerts instead of sound only, sign language interpretation</p><p><strong>Motor disabilities: </strong>limited hand movement, paralysis, tremors<br><em>Accessibility</em>: Keyboard navigation, voice control, alternative input devices like switches or eye trackers</p><p><strong>Cognitive disabilities: </strong>dyslexia, memory issues, ADHD<br><em>Accessibility</em>: Clear, simple language, consistent navigation, easy-to-understand instructions</p><p><strong>Speech disabilities: </strong>stuttering, inability to speak<br><em>Accessibility</em>: Alternative communication tools, text chat options instead of voice-only interaction</p><p><strong>Neurological disabilities: </strong>epilepsy, autism spectrum disorder<br><em>Accessibility</em>: Avoiding flashing content, predictable layouts, customizable user interfaces</p><p><strong>Temporary disabilities:</strong></p><ul><li>A broken arm or hand that limits use of one limb</li><li>A concussion causing short-term cognitive difficulties</li><li>Temporary hearing loss from an ear infection</li><li>Recovery from surgery causing mobility limitations</li></ul><h3><strong>3. A11Y for everyone</strong></h3><p>By making websites more accessible to people with disabilities, you improve usability for everyone:</p><ul><li>Captions help people in noisy or quiet environments, not just those who are deaf or hard of hearing.</li><li>Keyboard navigation benefits power users and people with temporary injuries.</li><li>Clear structure and headings make it easier for everyone to scan and find information faster.</li><li>Good color contrast and readable fonts help in bright sunlight or on low-quality screens.</li><li>Simple language and clear labels improve understanding for non-native speakers or people in a hurry.</li></ul><h3>4. Legislation</h3><p>🇪🇺 <a href="https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32019L0882">The European Accessibility Act (EAA)</a> is an EU directive that sets common accessibility requirements for products and services. (Unlike regulations, directives allow each member state some flexibility in how they implement those rules into their own national laws within a given deadline.)</p><p>🇸🇰 <a href="https://www.slov-lex.sk/ezbierky/pravne-predpisy/SK/ZZ/2022/351/20250628.html">Zákon č. 351/2022 Z. z. o prístupnosti výrobkov a služieb pre osoby so zdravotným postihnutím</a> is a Slovak law that implements the EAA requirements at the national level.</p><h4><strong>Who does the law apply to?</strong></h4><ul><li>Organizations that offer digital products and services, including:</li><li>Online stores (<strong>e-shops</strong>) and digital payment services</li><li>Online services provided in exchange for non-monetary compensation, such as collecting customer data</li><li>Banking and <strong>financial services</strong></li><li>Electronic books and digital publications</li><li><strong>Audiovisual media services</strong> (e.g., streaming platforms)</li><li>Services provided in air, bus, rail, and water passenger transport</li></ul><h4><strong>Exceptions</strong></h4><ul><li>Businesses with <strong>fewer than 10 employees</strong></li><li>Annual turnover (🇸🇰 ročný obrat) or balance sheet total (🇸🇰 bilančná suma) not exceeding <strong>2 million euros</strong></li></ul><p>This law does not apply to content that is:</p><ul><li>Not created or funded by the service provider (e.g. comments under a blog article)</li><li>Pre-recorded, time-based media published <strong>before 28 June 2025</strong><br>Office file formats published <strong>before 28 June 2025</strong></li><li>Websites and mobile applications considered archives, if they contain only content that is <strong>not updated or edited after 28 June 2025</strong></li></ul><h3>5. Requirements</h3><ul><li><a href="https://www.w3.org/TR/WCAG21/"><strong>WCAG 2.1 (AA)</strong></a><strong> </strong>— Web Content Accessibility Guidelines. Level <strong>AA</strong> is mandatory, level <strong>AAA</strong> (the strictest requirements) recommended.</li><li>🇸🇰 <a href="https://www.etsi.org/deliver/etsi_en/301500_301599/301549/03.02.01_60/en_301549v030201p.pdf"><strong>Slovenská technická norma STN EN 301 549 Požiadavky na prístupnosť produktov a služieb IKT</strong></a></li><li>for other EU member countries, check their local requirements, however it should all revolve around the same <a href="https://www.w3.org/TR/WCAG21/"><strong>WCAG 2.1 (AA)</strong></a><strong> </strong>guidelines</li></ul><blockquote>Think about a11y from the beginning. Adding a11y later (to existing design and code) can cause project delays and higher costs.</blockquote><h3>6. <strong>Accessibility Overlays — to use or not to use?</strong></h3><p><a href="https://shouldiuseanaccessibilityoverlay.com/">Should I Use An Accessibility Overlay?</a></p><p>🇸🇰/🇨🇿:</p><p><a href="https://www.linkedin.com/posts/radekpavlicek_should-i-use-an-accessibility-overlay-activity-7298751828731543552-JjDS/">🔴 Přístupnostní overlaye: rychlá záplata, která přístupnost nezlepší | Radek Pavlíček</a></p><h3>7. Four principles of a11y — POUR</h3><ul><li><strong>Perceivable: </strong>Information must be presented in ways users can perceive, regardless of their abilities. Provide text alternatives for images, captions for videos, and use sufficient color contrast.</li><li><strong>Operable: </strong>Interface components and navigation must be usable by all users. Ensure all functionality is accessible via keyboard, and provide clear navigation and enough time for tasks.</li><li><strong>Understandable: </strong>Information and the user interface must be easy to understand. Use clear language, predictable navigation, and helpful instructions or error messages.</li><li><strong>Robust: </strong>Content must be compatible with various devices, browsers, and assistive technologies. Use clean HTML/CSS and follow standards so that content works with screen readers and future tech.</li></ul><h3>8. WCAG Compliance Levels</h3><h4>Level A (Minimum)</h4><ul><li><strong>Basic accessibility features</strong> are met.</li><li>Helps users with the most severe disabilities access content.</li><li><strong>Example:</strong> Text alternatives for non-text content.</li></ul><h4>Level AA (Mid-range)</h4><ul><li><strong>Most commonly required standard</strong> for legal compliance.</li><li>Addresses more barriers and improves usability for a wider audience.</li><li><strong>Example:</strong> Sufficient color contrast, keyboard navigation.</li></ul><h4>Level AAA (Highest)</h4><ul><li><strong>Most comprehensive</strong> and <strong>strictest</strong> level.</li><li>Not always possible to meet for all content.</li><li><strong>Example:</strong> Sign language interpretation for audio, no timing on interactions.</li></ul><p>Legally required to meet the A &amp; AA levels, aim for AAA if possible.</p><h3>9. 2025 Statistics</h3><p>The 2025 report on the accessibility of the top 1,000,000 home pages: <a href="https://webaim.org/projects/million/">https://webaim.org/projects/million/</a></p><p><strong>94.8% </strong>had 1+ WCAG 2 failures<br><strong>76.6%</strong> had 5+ WCAG 2 failures<br><strong>66.4%</strong> had 10+ WCAG 2 failures</p><p><strong>On average 50+</strong> a11y errors per page!</p><p>Thankfully, <strong>96%</strong> of all errors detected fall into <strong>these six categories</strong>. These most common errors have been the same for the last 5 years. Addressing just these few types of issues would significantly improve accessibility across the web:</p><p><strong>Low contrast text</strong> — 79.1% <br><strong>Missing alternative text for images </strong>— 55.5% <br><strong>Missing form input labels </strong>— 48.2% <br><strong>Empty links</strong> — 45.4% <br><strong>Empty buttons </strong>— 29.6% <br><strong>Missing document language</strong> — 15.8%</p><h3>10. Tools for testing A11Y</h3><h4>Automated testing tools</h4><p>🔧<strong> Browser Extensions</strong></p><ul><li><strong>axe DevTools (</strong><a href="https://chromewebstore.google.com/detail/axe-devtools-web-accessib/lhdoppojpmngadmnindnejefpokejbdd"><strong>Chrome</strong></a><strong>, </strong><a href="https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/"><strong>Firefox</strong></a><strong>)</strong>: industry-standard</li><li><a href="https://wave.webaim.org/"><strong>WAVE Web Accessibility Evaluation Tool</strong></a><strong> </strong>(also as a Chrome/Firefox extension)</li><li><strong>Lighthouse</strong> (built into Chrome DevTools → “Accessibility” tab)</li><li><a href="https://chromewebstore.google.com/detail/accessible-web-helper/gdnpkbipbholkoaggmlblpbmgemddbgb"><strong>Accessible Web Helper</strong></a> — extension for Chrome</li></ul><p>💻<strong> Command-line Tools</strong></p><ul><li><a href="https://github.com/pa11y/pa11y"><strong>pa11y</strong></a><strong>: </strong>simple CLI for automated WCAG testing</li><li><a href="https://github.com/dequelabs/axe-core"><strong>axe-core</strong></a><strong>: </strong>for integration in test suites</li><li><a href="https://www.npmjs.com/package/jest-axe"><strong>jest-axe</strong></a><strong>: </strong>unit testing with Jest</li></ul><blockquote><strong>~30–40% of issues are caught by automated tools. Manual review is essential.</strong></blockquote><h4>Manual testing</h4><p>🔍<strong> Keyboard Navigation</strong></p><ul><li>Can you tab through all interactive elements?</li><li>Is there a visible focus indicator?</li><li>Can you navigate modals, dropdowns, forms, and menus?</li></ul><p>🎧<strong> Screen Reader Testing</strong></p><p><strong>Use tools like: </strong>NVDA (Windows, free)/JAWS (Windows, paid)/<strong>VoiceOver (macOS/iOS, built-in)</strong></p><p><em>VoiceOver on Mac</em></p><ul><li><strong>Cmd + F5</strong> — turn on/off VoiceOver on Mac</li><li><strong>Ctrl + Option + U</strong> — turn on rotor (when VoiceOver is on), <strong>Esc</strong> to close it</li><li><a href="https://support.apple.com/guide/voiceover/welcome/mac">Manual for Mac</a></li><li><a href="https://support.apple.com/guide/iphone/turn-on-and-practice-voiceover-iph3e2e415f/ios">Manual for iOS</a></li></ul><p>Focus on:</p><ul><li>Proper use of headings (&lt;h1&gt; to &lt;h6&gt;)</li><li>Descriptive alt text for images</li><li>Clear labeling of buttons and forms</li><li>Logical reading order</li></ul><p>✨<strong> Don’t forget to test also responsive versions of the website! Especially if some elements are hidden on desktop and only shown on small screen. </strong>✨</p><h3>11. Examples of a11y errors from our testing of real websites</h3><p>Tested using WAVE, pa11y-cli, WCAG color contrast checker Firefox extension, VoiceOver and manual testing.</p><p>🤖<strong> — automated tool should find this error<br></strong>👩🏼<strong> — probably only detectable by manual human testing</strong></p><ul><li>VoiceOver speaks in English even though the website content is in Slovak — <strong>html lang attribute is missing </strong>🤖</li><li>Pressing enter on submenu link does not open the submenu, only hover does 👩🏼</li><li><strong>No skip link/bypass block</strong> — you just want to get to the content, but have to tab over whole menu again first 🤖/ 👩🏼</li><li>Link with text &lt;TU&gt; has no better label so VoiceOver reads it as “less than T U greater than” instead of “TU” or some more descriptive text 👩🏼</li><li><strong>All form inputs are missing labels</strong>, you have no idea what data the inputs expect — the contact form is absolutely unusable without sight! 🤖</li><li>Some links have bad labels — there are 3 links named “SK” and each does something different. LinkedIn and Facebook links only read a part of the URL, instead of human friendly label 👩🏼</li><li><strong>Heading levels are wrong</strong> — skipping from H2 directly to H4, instead of H3. Missing H1 headings. 🤖</li><li><strong>Contrast </strong>— low in many cases<strong> </strong>🤖<strong>/ </strong>👩🏼</li></ul><h3>12. How to fix the most common problems (AA Level)</h3><h4>Color contrast</h4><ul><li><strong>Text and images of text</strong> should have a contrast ratio of at least <strong>4.5:1</strong>.</li><li><strong>Large-scale text</strong> (24px/18pt or 19 px/14pt bold and larger) needs a ratio of at least <strong>3:1</strong>.</li><li><em>Exceptions</em>: inactive UI components, pure decoration, invisible text, or text in images with significant other visual content.</li><li>Logos and brand names are exempt from this requirement.</li><li><strong>User interface components and graphical objects</strong> need a contrast ratio of at least <strong>3:1</strong> against adjacent colours. This applies to visual information needed to identify UI components and states, except for inactive components or those controlled by the user agent.</li></ul><p>Tools:</p><ul><li><a href="https://www.figma.com/community/plugin/733159460536249875/a11y-color-contrast-checker">Figma A11Y — Color Contrast Checker</a></li><li><a href="https://coolors.co/contrast-checker/112a46-acc8e5">Color Contrast Checker</a></li><li><a href="https://webaim.org/resources/contrastchecker/">WebAIM Color Contrast Checker</a></li><li><a href="https://wave.webaim.org/">WAVE Web Accessibility Evaluation Tool</a> (also as a Chrome/Firefox extension)</li><li><a href="https://chromewebstore.google.com/detail/accessible-web-helper/gdnpkbipbholkoaggmlblpbmgemddbgb">Accessible Web Helper</a> — extension for Chrome</li></ul><h4>Alt text for images</h4><p><strong>Informative images:</strong> concise, meaningful alt text that describes the <strong>purpose</strong> or <strong>function</strong> of the image in context.</p><pre>&lt;img src=&quot;dog.jpg&quot; alt=&quot;Golden Retriever playing fetch&quot;&gt;</pre><p><strong>Decorative images:</strong> <strong>empty alternative text</strong> (alt=””) or implemented as <strong>CSS backgrounds</strong>.</p><p><strong>Functional images:</strong> if an image functions as a control (like a button), it must be focusable and operable via keyboard and have descriptive alt text.</p><pre>&lt;img src=&quot;linkedin.jpg&quot; role=&quot;button&quot; alt=&quot;LinkedIn Profile&quot;&gt;</pre><p>Avoid redundant text:</p><pre>❌&lt;img src=&quot;dog.png&quot; alt=&quot;Image of Golden Retriever playing fetch&quot;&gt;<br>✅&lt;img src=&quot;dog.png&quot; alt=&quot;Golden Retriever playing fetch&quot;&gt;</pre><p>If the image is a <strong>link or button</strong>, alt text must convey its <strong>action or destination</strong>.</p><pre>&lt;a href=&quot;/cart&quot;&gt;&lt;img src=&quot;cart.png&quot; alt=&quot;View your shopping cart&quot;&gt;&lt;/a&gt;</pre><p><strong>Graphs, charts, complex images</strong>: Provide a text alternative that conveys all essential data, either: on the page itself or link to a longer description with aria-describedby or &lt;details&gt;.</p><figure><img alt="Bar chart showing percentage of pages with error types. Low contrast text = 79.1%, Missing alt text = 55.5%, Missing Labels = 48.2%, Empty Links = 45.4%, Empty Buttons = 29.6%, and Missing Language = 15.8%" src="https://cdn-images-1.medium.com/max/1024/1*mYP2XceVj4asw4sPFiMkLQ.png" /><figcaption>Graph image from WebIAM Million 2025</figcaption></figure><pre>&lt;img src=&quot;...&quot; alt=&quot;Bar chart showing percentage of pages with error types. Low contrast text = 79.1%, Missing alt text = 55.5%, Missing Labels = 48.2%, Empty Links = 45.4%, Empty Buttons = 29.6%, and Missing Language = 15.8%&quot;/&gt;</pre><h4>Form input labels</h4><ul><li>Use &lt;label&gt; elements for every input</li><li>Clearly explain the purpose of the input (e.g., “First name”, “Email”, “Search”, “Card number”).</li><li>Placeholders are not a substitute for labels. They disappear on focus and are often unreadable due to low contrast.</li><li>Use aria-label or aria-labelledby if label can’t be visible</li></ul><pre>✅ &lt;input type=&quot;search&quot; aria-label=&quot;Search the site&quot;&gt;</pre><ul><li>Use aria-describedby to connect an input to its error/help text</li></ul><pre>✅ <br>&lt;label for=&quot;email&quot;&gt;Email address&lt;/label&gt;<br>&lt;input type=&quot;email&quot; id=&quot;email&quot; aria-describedby=&quot;emailHelp emailError&quot;&gt;<br>&lt;div id=&quot;emailHelp&quot;&gt;We&#39;ll never share your email.&lt;/div&gt;<br>&lt;div id=&quot;emailError&quot;&gt;Please enter a valid email address.&lt;/div&gt;</pre><h4>Empty links</h4><p>An empty link is an &lt;a&gt; element that:</p><ul><li>Has no text content or accessible name, and</li><li>Doesn’t convey any purpose to screen readers.</li><li>Example of a bad empty link:</li></ul><pre>❌ &lt;a href=&quot;#&quot;&gt;&lt;/a&gt;<br>❌ &lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;edit-icon.svg&quot;&gt;&lt;/a&gt;</pre><ul><li>Screen reader users hear: “link” with no context.</li><li>Add visible text, or use aria-label or aria-labelledby:</li></ul><pre>✅ &lt;a href=&quot;/edit-profile&quot;&gt;Edit profile&lt;/a&gt;<br><br>✅ <br>&lt;a href=&quot;/edit-profile&quot; aria-label=&quot;Edit profile&quot;&gt;<br>  &lt;img src=&quot;edit-icon.svg&quot; alt=&quot;&quot;&gt;<br>&lt;/a&gt;<br><br>✅ <br>&lt;a href=&quot;/edit-profile&quot; aria-labelledby=&quot;edit-label&quot;&gt;<br>  &lt;img src=&quot;edit-icon.svg&quot; alt=&quot;&quot;&gt;<br>&lt;/a&gt;<br>&lt;span id=&quot;edit-label&quot; class=&quot;visually-hidden&quot;&gt;Edit profile&lt;/span&gt;<br><br>✅ &lt;a href=&quot;/cart&quot;&gt;&lt;img src=&quot;cart.svg&quot; alt=&quot;View shopping cart&quot;&gt;&lt;/a&gt;</pre><h4>Empty buttons</h4><p>An empty button is a &lt;button&gt; element that:</p><ul><li>Has no text content or accessible name, and</li><li>No accessible name via aria-label, aria-labelledby, or inner content.</li><li>Example of a bad empty button:</li></ul><pre>❌ &lt;button&gt;&lt;/button&gt;<br>❌ &lt;button&gt;&lt;img src=&quot;close-icon.svg&quot;&gt;&lt;/button&gt; &lt;! - no alt or label →</pre><ul><li>Screen reader users hear: “button” with no context or name.</li><li>Add visible text, or use aria-label or aria-labelledby:</li></ul><pre>✅ &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt; <br><br>✅ <br>&lt;button aria-label=&quot;Close&quot;&gt;<br>  &lt;img src=&quot;close.svg&quot; alt=&quot;&quot;&gt;<br>&lt;/button&gt;<br><br>✅ <br>&lt;button aria-labelledby=&quot;closeLabel&quot;&gt;<br>  &lt;img src=&quot;close.svg&quot; alt=&quot;&quot;&gt;<br>&lt;/button&gt;<br>&lt;span id=&quot;closeLabel&quot; class=“visually-hidden&quot;&gt;Close&lt;/span&gt;</pre><h4>Missing document language</h4><pre>&lt;!-- ❌ Missing language --&gt;<br>&lt;html&gt;</pre><p>🔎 Why it matters</p><ul><li>Screen readers use it to choose correct pronunciation rules</li><li>Translation tools rely on it</li><li>Browsers use it to choose hyphenation, spell-check, etc.</li></ul><pre>&lt;!-- ✅ English --&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>…<br>&lt;p&gt;Welcome! &lt;span lang=&quot;es&quot;&gt;¡Bienvenidos!&lt;/span&gt;&lt;/p&gt;</pre><h4>Do not use just color to convey meaning</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GzA8iau_OKrWkEavSfVyEg.png" /><figcaption>“Pick a color for your t-shirt” picker with colors listed only as colored buttons, without labels</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H_0n0jhfH10upZG8-91uXQ.png" /><figcaption>“Pick a color for your t-shirt” picker with colors listed as colored buttons AND labels</figcaption></figure><h4>Use semantic HTML</h4><ol><li>Improves screen reader experience</li><li>Better keyboard navigation<br> Semantic HTML elements are <strong>keyboard-focusable by default</strong>, <br> and their behavior is predictable.</li><li>Reduces need for ARIA</li><li>Supports Better SEO and Maintainability</li></ol><figure><img alt="On left non-semantic html — basically just all divs and one span. On right semantic HTML — header, nav, aside, main, article, figure, p, section" src="https://cdn-images-1.medium.com/max/1024/1*-DymdtVCbgwCaHmNwqWIxg.png" /><figcaption>What Is Semantic HTML?</figcaption></figure><h4>Use headings properly</h4><ol><li><strong>One &lt;h1&gt; per page</strong>: it should be the page title. It doesn’t have to be the first heading if, for example, your navigation menu starts with an &lt;h2&gt;.</li><li><strong>No skipping levels:</strong> Keep the structure hierarchical. Don’t jump from an &lt;h2&gt; to an &lt;h4&gt;, for instance.</li><li><strong>Don’t choose based on style:</strong> Use headings for their intended purpose, not just for how they look. Don’t use &lt;h2&gt; because you like the size; use it because it’s the right level in the hierarchy.</li><li><strong>Heading elements only for headings:</strong> Don’t style regular text as a heading. This confuses both users and search engines.</li><li><strong>Consistent use:</strong> Maintain the same heading structure across your site. If your navigation menu uses an &lt;h2&gt; on one page, it should use an &lt;h2&gt; everywhere.</li></ol><figure><img alt="On left a correct structure of HTML headings H1-&gt;H2-&gt;H3-&gt;H4. On right an incorrect structure of HTML headings H1-&gt;H2-&gt;H4-&gt;H3." src="https://cdn-images-1.medium.com/max/1024/1*DRvreg3lO0FV-7zp7uJM-w.png" /></figure><h4>Bypass blocks</h4><p>Bypass blocks, also known as “skip links”, are a crucial accessibility feature that allows users to quickly navigate past repeated content on a webpage, such as navigation menus or footers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YHudjcLk1qnWyLQoNMJCaQ.gif" /><figcaption>Google Search without using bypass block — have to tab 30–40 times to get to content (tabbing over all menu items, suggestions, Google profile icon, …)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VGPufrlIgr7jFYQ265bxpA.gif" /><figcaption>Google Search while using bypass block — have to tab 1 time to get to content</figcaption></figure><h4><strong>ARIA Live</strong></h4><p>Have you ever updated content on your website and wondered how to make sure everyone knows about the change? It’s a common challenge, especially for people who use screen readers or other assistive technologies. When content changes after a page loads — like adding items to a shopping cart or displaying error messages — these updates might go unnoticed by some users.</p><p><strong>Article: </strong><a href="https://www.a11y-collective.com/blog/aria-live/">https://www.a11y-collective.com/blog/aria-live/</a></p><p>Try using ChatGPT with VoiceOver on and you will hear it say “ChatGPT is still generating a response…” during generation, because ChatGPT uses ARIA live!</p><h3>13. Sources &amp; links</h3><ul><li><a href="https://gist.github.com/selfthinker/4cd7ed16ac2f0fedfc31b8032a1a1d71">Intentionally inaccessible websites and mobile apps</a></li><li><a href="https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32019L0882"><strong>The European Accessibility Act (EAA)</strong></a></li><li>🇸🇰<strong> </strong><a href="https://www.slov-lex.sk/ezbierky/pravne-predpisy/SK/ZZ/2022/351/20250628.html"><strong>Zákon č. 351/2022 Z. z. o prístupnosti výrobkov a služieb pre osoby so zdravotným postihnutím</strong></a></li><li><a href="https://www.w3.org/TR/WCAG21/"><strong>WCAG 2.1 (AA)</strong></a></li><li>🇸🇰<strong> </strong><a href="https://www.etsi.org/deliver/etsi_en/301500_301599/301549/03.02.01_60/en_301549v030201p.pdf"><strong>Slovenská technická norma STN EN 301 549 Požiadavky na prístupnosť produktov a služieb IKT</strong></a></li><li>🇸🇰 <a href="https://pristupne.sk/zakon-o-pristupnosti-vyrobkov-a-sluzieb-pre-koho-je-urceny-a-ako-sa-s-nim-vysporiadat/"><strong>Zákon o prístupnosti výrobkov a služieb — pre koho je určený a ako sa s ním vysporiadať</strong></a></li><li><a href="https://www.udacity.com/enrollment/ud891"><strong>Web Accessibility</strong></a> course at Udacity</li><li><a href="https://web.dev/learn/accessibility/"><strong>Learn Accessibility</strong></a> course at web.dev</li><li><a href="https://www.figma.com/community/file/1311421011482282592"><strong>Annotation Kit</strong></a><strong> </strong>for Figma</li><li><a href="https://unss.sk/audit-pristupnosti-webovych-stranok-a-mobilnych-aplikacii/"><strong>Únia Nevidiacich a slabozrakých Slovenska</strong></a> — a11y audits in Slovakia</li><li><a href="https://www.linkedin.com/posts/radekpavlicek_should-i-use-an-accessibility-overlay-activity-7298751828731543552-JjDS">LinkedIn Post</a> — Should I use an accessibility overlay?</li><li><a href="https://shouldiuseanaccessibilityoverlay.com/">https://shouldiuseanaccessibilityoverlay.com</a></li><li><a href="https://webaim.org/projects/million/"><strong>The WebAIM Million</strong></a> — a11y report for 1’000’000 top websites</li><li><a href="https://webaim.org/standards/wcag/checklist">WCAG Checklist</a></li><li><a href="https://www.figma.com/community/plugin/733159460536249875/a11y-color-contrast-checker">Figma A11Y — Color Contrast Checker</a></li><li><a href="https://coolors.co/contrast-checker/112a46-acc8e5">Color Contrast Checker</a></li><li><a href="https://webaim.org/resources/contrastchecker/">WebAIM Color Contrast Checker</a></li><li><a href="https://wave.webaim.org/">WAVE Web Accessibility Evaluation Tool</a> (also as a Chrome/Firefox extension)</li><li><a href="https://chromewebstore.google.com/detail/accessible-web-helper/gdnpkbipbholkoaggmlblpbmgemddbgb">Accessible Web Helper</a> — extension for Chrome</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=679551dbffac" width="1" height="1" alt=""><hr><p><a href="https://blog.meetbrackets.com/web-accessibility-in-2025-679551dbffac">Web Accessibility in 2025 (🇪🇺/🇸🇰)</a> was originally published in <a href="https://blog.meetbrackets.com/">BRACKETS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding at AI Speed: The Hidden Challenges We Don’t Talk About (Often)]]></title>
            <link>https://blog.meetbrackets.com/coding-at-ai-speed-the-hidden-challenges-we-dont-talk-about-often-e424b78fbb9f?source=rss-a8e0ae529712------2</link>
            <guid isPermaLink="false">https://medium.com/p/e424b78fbb9f</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Kristina Odziomkova]]></dc:creator>
            <pubDate>Tue, 01 Apr 2025 09:59:59 GMT</pubDate>
            <atom:updated>2025-04-01T10:03:13.673Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cG2huZKfoQAVTCi_NlQoTQ.jpeg" /></figure><h3>Introduction</h3><p>As a senior web developer, I’ve seen quite a few tools come and go that promised to revolutionize our workflow. But few have been as disruptive as AI-powered coding assistants.</p><p><strong>The promise?</strong> Code written 10x faster, automating the mundane and boring tasks, and making development more efficient.</p><blockquote>“Built to make you extraordinarily productive.“— Cursor AI code editor</blockquote><blockquote>“[…] coding experience that feels like literal magic“ — Windsurf AI code editor</blockquote><p><strong>The reality?</strong> A shift in bottlenecks, an increase in cognitive load, and new challenges we didn’t anticipate.</p><p>Let’s talk about what AI in development really looks like (from my personal perspective) today — the advantages, the frustrations, and the concerns for the future.</p><p><strong>Disclaimer: </strong>I am neither an AI doomsayer nor an AI evangelist — rather something in-between. A slight skeptic AND a child that got a new shiny toy. I see the results and the promises AI already does or might deliver in the future — but in my humble opinion, we have to keep ourselves down to earth when it comes to AI.</p><p>Since an image is worth a 1000 words, here you go:</p><figure><img alt="Apple TV’s Severance show gif with Milchick dancing vigorously in colorful lights on." src="https://cdn-images-1.medium.com/max/480/0*4kkJrLcZpHR3gCTG.gif" /><figcaption>Some of my colleagues and AI vibing together (source: <a href="https://giphy.com/">https://giphy.com</a>)</figcaption></figure><figure><img alt="Apple TV’s Severance show gif with Irv timidly vibing to the music and snapping his fingers." src="https://cdn-images-1.medium.com/max/480/0*laredupy5-S8baE6.gif" /><figcaption>Me and AI vibing together (source: <a href="https://giphy.com/">https://giphy.com</a>)</figcaption></figure><p>And before you ask: <strong>Yes, this blog post was also (in big part) written by AI</strong>. However, the concerns and experiences I will share are my own, only structured and stylised by AI to be more approachable and readable.</p><h3>The Promise of AI in Development</h3><p>AI-assisted coding tools like GitHub Copilot, ChatGPT, Cursor, Windsurf or Cline claim to boost productivity. They autocomplete entire functions, generate boilerplate code, suggest bug fixes and some if them even run the code and alter the output based on the results.</p><p>The idea is that developers can focus on higher-level problem-solving rather than repetitive coding tasks. At first glance, this sounds amazing. No more manually writing the same CRUD operations (boring!), no more tedious syntax lookups. Just speed, efficiency, and more time to build.</p><p>But as with any tool, AI doesn’t solve every problem — it just moves some of them around.</p><h3>The Bottlenecks That AI Doesn’t Solve (and Might Make Worse)</h3><h4>Code Review Overload</h4><p>Sure, AI helps write code faster, but code reviews are still a human-driven process. If I can now generate features at 10x the speed, my team isn’t magically reviewing and testing 10x faster. This results in a backlog of pull requests, longer review times, and ultimately, same or slower progress on actually delivering features.</p><p>Of course, there already exist AI assistants to review PRs for us — though if you are like me, you don’t trust them (yet) nearly as much as you trust the coding AI assistants.</p><p>Before my colleagues started using AI coding assistants on regular basis, I might have received 5 PRs a week — now I receive 5 in one day, and sometimes even faster! And they are usually longer, too.</p><h4>Mental Load &amp; Task Switching</h4><p>With AI generating code at breakneck speed, I now find myself juggling more tasks at once. More features mean more context switching, more documentation updates, and more meetings to discuss AI-generated implementations. Rather than reducing my workload, AI has just changed where my effort is spent. Instead of switching from 2 tasks in 8 hours to 10 tasks in 8 hours (with the help of AI), I’d rather finish 6 tasks in 6 hours, and be done for the day!</p><figure><img alt="Apple TV’s Severance show gif with Mark saying: “Okay, and we want that?” and Ricken replying “Oh, we do.”" src="https://cdn-images-1.medium.com/max/480/0*sKfMT8CHMBpvumTz.gif" /><figcaption>Source: <a href="https://giphy.com/">https://giphy.com</a></figcaption></figure><h4>Meetings &amp; Communication Lag</h4><p>From my perspective, AI doesn’t really speed up business decisions, client meetings, or deployment cycles — or when it does, not as much as it speeds up the development process. The disconnect between AI-powered coding and real-world software development processes becomes painfully clear when features are ready but waiting in limbo due to meetings, code reviews, discussions, mental load, and business priorities.</p><p>Clients also don’t magically start being 10x faster at responding, 10x faster at knowing what they want or 10x faster at acceptance testing.</p><h3>Quality &amp; Maintainability Concerns</h3><h4>Does AI-Generated Code Follow Best Practices?</h4><p>AI can produce syntactically correct and functional code, but that doesn’t mean it always aligns with best practices.</p><p>Sometime the generated code is:</p><ul><li>poorly structured</li><li>inefficient</li><li>duplicated</li><li>overly-commented (do I really need to have a comment “Step 1: This sums the values.” on the line of code that only does sum1 + sum2?)</li><li>insecure</li><li>unoptimized</li></ul><p>… requiring more refactoring and technical debt management down the line. Or just requiring more time for your colleagues to have to spend on better code reviews, because now they don’t trust that the new code has been seen by human eyes.</p><p><strong>Of course many of these problems might be solved by better prompting, but that is a skill many of us are only just learning.</strong></p><blockquote>[For now,] we have to think of the AI coding tools as eager juniors/mediors with limited knowledge of the project scope. — Pavol Perdík, CEO @ BRACKETS</blockquote><figure><img alt="Apple TV’s Severance show gif with Dylan asking Ms. Huang while walking in hallway: “So, like, is it rude to keep asking why you’re a kid?”" src="https://cdn-images-1.medium.com/max/500/0*73biNRAaJ4O8t5zK" /><figcaption>Source: <a href="https://pronouncingitwang.tumblr.com/post/774550491910766592/id-three-gifs-of-a-scene-in-severance-203-ms">https://pronouncingitwang.tumblr.com/post/774550491910766592/id-three-gifs-of-a-scene-in-severance-203-ms</a></figcaption></figure><h3>AI Dependency &amp; Reliability</h3><h4>AI Outages or Bans = Productivity Stalls</h4><p>When AI tools go down/away, what happens? Have we or will be become so reliant on AI code generation that a sudden outage disrupts our workflow? The reliance on cloud-based AI services adds another potential point of failure to the development process.</p><p>Another point of view — what if the EU suddenly wakes up and bans all AIs due to GDPR, intellectual property or other concerns? <strong>Well, too bad, we already estimated and sold the project to a client thinking that AI will help us with it! No more money left for yearly bonuses, or even waffle parties and fingertraps!</strong></p><figure><img alt="Apple TV’s Severance show gif with Mrs. Cobel playing with a fingertrap in her office." src="https://cdn-images-1.medium.com/max/374/0*Md7rj4WD3XF13Auu.gif" /><figcaption>Source: <a href="https://tenor.com/view/finger-trap-cobel-severance-praise-kier-lumon-gif-8270575445859601309">https://tenor.com</a></figcaption></figure><h4>Are Developers Losing Problem-Solving Skills?</h4><p>With AI providing instant solutions, are we training a new generation of developers to depend on machine-generated answers rather than honing their own problem-solving skills? Will junior developers struggle to debug AI-generated code they don’t fully understand?</p><figure><img alt="Reddit screenshot of post linked in the caption" src="https://cdn-images-1.medium.com/max/1024/1*9EyY150auJlSfnGQuY5XWA.png" /><figcaption>Source: <a href="https://www.reddit.com/r/learnprogramming/comments/1j6k7f8/i_just_tried_cursor_my_motivation_to_learn">https://www.reddit.com/r/learnprogramming/comments/1j6k7f8/i_just_tried_cursor_my_motivation_to_learn</a></figcaption></figure><p>After all, AI is just a tool, if you don’t have any developer experience, it might very well just screw you over.</p><figure><img alt="Reddit screenshot of post linked in the caption" src="https://cdn-images-1.medium.com/max/1024/1*-bloXsNF2p3T7SWPanozNw.png" /><figcaption>Source: <a href="https://www.reddit.com/r/cursor/comments/1inoryp/cursor_fck_up_my_4_months_of_works/?utm_medium=post_embed&amp;utm_name=6a702e5127eb4fd0ae93b34095a41f84&amp;utm_source=embedly&amp;utm_term=1inoryp">https://www.reddit.com/r/cursor/comments/1inoryp/cursor_fck_up_my_4_months_of_works</a></figcaption></figure><p>One day it might be able to setup everything from A to Z for you, and our developer skills might become obsolete, but I am not worried too much about that happening yet (let’s see how well my statement ages in a few months).</p><figure><img alt="Apple TV’s Severance show gif with Mark emphasizing to Helly: “The work is mysterious and important.”" src="https://cdn-images-1.medium.com/max/480/0*mZobyVEYsSEVwReB.gif" /><figcaption>Us developers in a few years (months?) once AI does stuff we don’t even understand (source: <a href="https://giphy.com/">https://giphy.com</a>)</figcaption></figure><h3>The Future: What Concerns Me Most</h3><p><strong>Will AI increase developer burnout?</strong> Faster coding doesn’t mean less work — it often means more expectations, leading to stress and fatigue. Humans have evolved over millennia, but the pace at which technology, culture, and society are changing is unprecedented. This acceleration can leave people feeling disconnected, overwhelmed, or struggling to keep up.</p><p><strong>Will we become AI babysitters?</strong> Instead of coding, will we spend most of their time reviewing and bug fixing AI-generated output? That does not sound like fun at all!</p><p><strong>How will the new developers change?</strong> If junior developers rely only on AI for coding, will they miss out on foundational learning that comes from struggling through problems?</p><h3>The Future: What I Hope It Can Be</h3><p><strong>The fun part of software development will stay — </strong>AI will take care of the boring, repetitive parts of software development and enable us to spend more time on the creative side.</p><p><strong>AI will improve work-life balance —</strong> Compared to the rest of the world and professions, I already cannot complain about my work-life balance. Nevertheless, I will forever be dreaming about a future, where the 4 day week or shorter workdays (without losing the quality of life) are the norm — maybe the AI age will help with that?</p><figure><img alt="Apple TV’s Severance show gif with Helly asking Mark at work: “A weekend just happened?.” “Yeah.” “I don’t vent feel like I left.”" src="https://cdn-images-1.medium.com/max/373/0*WXHwCrakv_9R4KYf.gif" /><figcaption>Source: <a href="https://tenor.com/">https://tenor.com</a></figcaption></figure><h3>Conclusion</h3><p>AI in development is undeniably a game-changer. It accelerates coding tasks, enhances productivity at certain tasks, and can offload some of the more boring aspects of the job. However, as we’ve seen, the rapid shift it introduces comes with its own set of challenges. From increased bottlenecks in code review and mental load to concerns over code quality, security risks, and dependency on AI tools, there are plenty of hidden hurdles to navigate.</p><p>The promise of AI is not to replace developers, but to make us more efficient — though it’s clear that AI’s role is still evolving. While AI can automate certain tasks, it also requires us to rethink our workflow, sharpen our critical thinking, and be more careful in reviewing the code that is generated.</p><p>In the end, AI is a tool — one that we must wield with caution, understanding that its rapid advancement might outpace our own ability to adapt. If we can do that, AI can help us create a future where we, as developers, continue to grow alongside the technology we build.</p><p>If you’ve come all the way down here and finished 100% of the article, please enjoy this complimentary Choreography &amp; Merriment music performance:</p><figure><img alt="Apple TV’s Severance show gif with Choreography &amp; Merriment music performance and Milchick dancing." src="https://cdn-images-1.medium.com/max/284/0*34nEPscJLMAFI7tj.gif" /><figcaption>Source: <a href="https://tenor.com/">https://tenor.com</a></figcaption></figure><p>and for more (also AI centered) software development content, don’t forget to check out our next Webstack 2025 web conference!</p><p><a href="https://www.inviton.eu/e-16845/webstack-conference-2025">Webstack Conference 2025 | Vstupenky, predpredaj</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e424b78fbb9f" width="1" height="1" alt=""><hr><p><a href="https://blog.meetbrackets.com/coding-at-ai-speed-the-hidden-challenges-we-dont-talk-about-often-e424b78fbb9f">Coding at AI Speed: The Hidden Challenges We Don’t Talk About (Often)</a> was originally published in <a href="https://blog.meetbrackets.com/">BRACKETS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Craftable PRO: Code Generator Behind the Scenes]]></title>
            <link>https://blog.meetbrackets.com/craftable-pro-code-generator-behind-the-scenes-0e6aa4fb0383?source=rss-a8e0ae529712------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e6aa4fb0383</guid>
            <category><![CDATA[yaml]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[generator]]></category>
            <category><![CDATA[blueprint]]></category>
            <dc:creator><![CDATA[Kristina Odziomkova]]></dc:creator>
            <pubDate>Tue, 25 Mar 2025 13:45:12 GMT</pubDate>
            <atom:updated>2025-04-10T05:20:47.864Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JFWHrqYBuKauI25iJUJr7A.jpeg" /></figure><h3>Introduction</h3><p>At the <a href="https://laravelmeetup.sk/">Laravel Meetup Bratislava</a> on March 30, 2025, we presented an insightful look into the code generation capabilities of <a href="https://craftable.pro/">Craftable PRO</a>. This blog post summarizes the key points from the presentation, exploring how Craftable PRO’s code generator works behind the scenes to accelerate admin panel development.</p><h4>What is Craftable PRO?</h4><figure><img alt="Image from Craftable PRO’s landing page showing the generated listing UI for users" src="https://cdn-images-1.medium.com/max/1024/1*0ZTEFw02q8IreYUzQPVkGQ.png" /><figcaption>Craftable PRO — New generation of administration</figcaption></figure><p><a href="https://craftable.pro/">Craftable PRO</a> is a powerful tool designed specifically for Laravel developers to quickly create beautiful admin panels, CRM or CMS systems. Its main value proposition is simple: “Create Beautiful Admin Panels Quickly”.</p><p>Built with Laravel developers in mind, Craftable PRO significantly speeds up the development process by automating the creation of admin interfaces, allowing developers to focus on business logic rather than boilerplate code.</p><h3>Blueprint: The Engine Behind Code Generation</h3><p>At the core of Craftable PRO’s code generation capabilities lays <a href="https://blueprint.laravelshift.com/">Blueprint</a>, a sophisticated code generation system for Laravel developers. Blueprint allows developers to:</p><p><strong>1. Draft applications with a simple syntax </strong>— Blueprint uses a simple YAML syntax to define models and controllers, offering shortcuts and leveraging conventions to maximize the developer experience.</p><p>2. <strong>Generate code using artisan commands</strong> — Blueprint comes with artisan commands, making it easy and familiar to build new components and reference existing ones within your Laravel application.</p><p>3. <strong>Output multiple Laravel components at once</strong> — Blueprint can generate models and controllers, but also factories, migrations, form requests, events, jobs, and mailables all in one go.</p><h4><strong>Default Blueprint vs. Craftable PRO Blueprint</strong></h4><p>Blueprint on its own is a great tool ❤, but we had so make some tweaks for it to fit our established workflow.</p><p><strong>Default Blueprint</strong></p><ul><li><strong>Workflow</strong>: YAML → migration, controller, model, routes, etc.</li><li><strong>Foundation</strong>: Based on YAML</li><li><strong>User Experience</strong>: Requires looking up documentation to see what’s supported and how to write the YAML</li><li><strong>Use Case</strong>: General purpose — more configurable and maintainable, usable on all types of projects</li></ul><p><strong>Craftable PRO Blueprint</strong></p><ul><li><strong>Workflow</strong>: Migration → CLI → YAML → controller, model, routes, etc.</li><li><strong>Foundation</strong>: Keeps migration as the basis for generation (as in the previous Craftable versions)</li><li><strong>User Experience</strong>: Asks predefined questions through CLI, so users don’t need to look up documentation</li><li><strong>Use Case</strong>: Specific purpose — generating admin panels with a predefined set of fields and features</li></ul><blockquote>The most important difference between the <strong>Default Blueprint</strong> and <strong>Craftable PRO Blueprint</strong> is their workflow and user experience.</blockquote><h3>The Complete Generator Workflow</h3><p>The CraftablePro Blueprint process follows a four-step workflow:</p><ol><li><strong>Migration — written by user</strong></li></ol><pre>public function up(): void<br>{<br>    Schema::create(&#39;posts&#39;, function (Blueprint $table) {<br>        $table-&gt;id();<br>        $table-&gt;json(&#39;title&#39;);<br>        $table-&gt;json(&#39;text&#39;);<br>        $table-&gt;string(&#39;slug&#39;);<br>        $table-&gt;boolean(&#39;is_draft&#39;);<br>        $table-&gt;dateTime(&#39;published_at&#39;)-&gt;nullable();<br>        $table-&gt;timestamps();<br>    });<br>}</pre><p><strong>2. CLI Wizard</strong></p><p>After defining the migration, you run a CLI wizard that asks predefined questions about the model, relationships, features, translatable columns, sorting, filtering, … and many other configuration options.</p><p>A quick peek inside:</p><figure><img alt="Alt text in the blog post after this image" src="https://cdn-images-1.medium.com/max/1024/1*yCi-E4ajcmMSF4hB-Xu22g.png" /><figcaption>Image 1— CLI Wizard</figcaption></figure><p><em>Alt text for Image 1— CLI Wizard: A terminal window displays the execution of the </em><em>craftable-pro:generate-crud -w command using Laravel&#39;s Artisan CLI. The interface presents a guided CRUD generator wizard with highlighted prompts. The user is configuring a CRUD setup for the &quot;posts&quot; table, choosing to overwrite an existing model. The wizard proceeds to define relationships, where the user selects &quot;Yes&quot; to add a relation, specifies the relation type as </em><em>belongsTo, and chooses &quot;Article&quot; as the related model from a list of options. The interface uses blue highlights for important instructions and navigation tips.</em></p><p><em>The CLI asks the following questions:</em></p><ol><li><strong><em>Please choose the table you would like to generate CRUD for:</em></strong><em> (User selects “posts”)</em></li><li><strong><em>Existing model Post detected. Do you want to overwrite it?</em></strong><em> (User selects “Yes”)</em></li><li><strong><em>Do you want to add a relation?</em></strong><em> (User selects “Yes”)</em></li><li><strong><em>What is the type of the relation?</em></strong><em> (User enters “belongsTo”)</em></li><li><strong><em>What is the name of the related model?</em></strong><em> (User selects “Article” from a list)</em></li><li><em>… and many more, not pictured on the screenshot</em></li></ol><p><strong>3. Generated YAML</strong></p><p>Based on the answers provided in the CLI wizard, Craftable PRO generates a YAML configuration file that defines all aspects of the model, controller, and views:</p><pre>craftable-pro:<br>  models:<br>    Post:<br>      table: posts<br>      skip_model: false<br>      columns:<br>        id: id<br>        title: json<br>        text: json<br>        slug: string<br>        is_draft: boolean<br>        published_at: &#39;datetime nullable&#39;<br>        created_at: &#39;datetime nullable&#39;<br>        updated_at: &#39;datetime nullable&#39;<br>      listing:<br>        id: &#39;sortable searchable&#39;<br>        title: &#39;sortable searchable&#39;<br>        text: &#39;sortable searchable&#39;<br>        slug: &#39;sortable searchable&#39;<br>        is_draft: &#39;sortable searchable&#39;<br>        published_at: sortable<br>        created_at: sortable<br>      form:<br>        columns:<br>          - cards:<br>              - fields:<br>                  - title<br>                  - text<br>                  - slug<br>                  - is_draft<br>                  - published_at<br>                  - image<br>      translatable:<br>        - title<br>        - text<br>      publishable: published_at<br>      media_collections:<br>        image: isImage<br>      relationships:<br>        - type: belongsToMany<br>          model: \Brackets\CraftablePro\Models\CraftableProUser<br>          foreign_key: post_id<br>          owner_key: craftable_pro_user_id<br>          accessor: first_name<br>          pivot_table: craftable_pro_user_post</pre><p><strong>4. Generated Files</strong></p><p>Finally, Craftable PRO uses the YAML configuration to generate all necessary files for a complete admin panel:</p><pre>$ sail artisan blueprint:build blueprint/posts.yaml<br><br>Created:<br>- app/Http/Controllers/Api/PostController.php<br>- app/Http/Requests/Api/Post/IndexPostRequest.php<br>- app/Http/Requests/Api/Post/StorePostRequest.php<br>- app/Http/Requests/Api/Post/UpdatePostRequest.php<br>- app/Http/Requests/Api/Post/ShowPostRequest.php<br>- app/Http/Requests/Api/Post/DestroyPostRequest.php<br>- app/Http/Resources/Api/PostResource.php<br>- app/Http/Resources/Api/PostCollection.php<br>- tests/Feature/Http/Controllers/Api/PostControllerTest.php<br>- database/migrations/2025_03_19_080315_add_api_permissions_for_posts.php<br>- database/migrations/2025_03_19_080315_add_permissions_for_posts.php<br>- app/Models/Post.php<br>- app/Http/Controllers/CraftablePro/PostController.php<br>- app/Http/Requests/CraftablePro/Post/IndexPostRequest.php<br>- app/Http/Requests/CraftablePro/Post/CreatePostRequest.php<br>- app/Http/Requests/CraftablePro/Post/StorePostRequest.php<br>- app/Http/Requests/CraftablePro/Post/EditPostRequest.php<br>- app/Http/Requests/CraftablePro/Post/UpdatePostRequest.php<br>- app/Http/Requests/CraftablePro/Post/DestroyPostRequest.php<br>- app/Http/Requests/CraftablePro/Post/BulkDestroyPostRequest.php<br>- database/factories/PostFactory.php<br>- resources/js/craftable-pro/Pages/Post/Index.vue<br>- resources/js/craftable-pro/Pages/Post/Create.vue<br>- resources/js/craftable-pro/Pages/Post/Edit.vue<br>- resources/js/craftable-pro/Pages/Post/Form.vue<br>- resources/js/craftable-pro/Pages/Post/types.d.ts</pre><p>This comprehensive generation saves developers countless hours of writing boilerplate code.</p><h3>How to implement your own custom generator leveraging the Blueprint package?</h3><p>If you are wondering how we implemented our custom extension of Blueprint, we will share the main steps:</p><ol><li>Create <strong>Blueprint</strong> model which will describe your needs. Our controllers (in comparison with default Blueprint controllers) will need to contain “features” list, so that we know, for example, whether to generate a method for “export”.</li></ol><pre>&lt;?php<br><br>namespace Brackets\CraftablePro\Blueprint\Models;<br><br>use Blueprint\Models\Controller;<br><br>class CraftableProController extends Controller<br>{<br>    protected array $relations = [];<br><br>    protected array $features = [];<br><br>    public function relations(): array<br>    {<br>        return $this-&gt;relations;<br>    }<br><br>    public function addRelation(array $statements): void<br>    {<br>        $this-&gt;relations[] = $statements;<br>    }<br><br>    public function features(): array<br>    {<br>        return $this-&gt;features();<br>    }<br><br>    public function addFeatures(array $features): void<br>    {<br>        $this-&gt;features = $features;<br>    }<br><br>    public function hasFeature(string $feature): bool<br>    {<br>        return collect($this-&gt;features)-&gt;contains($feature);<br>    }<br>}</pre><p>2. Create <strong>Lexer</strong>, which will describe how the YAML will be converted into the Blueprint model.</p><p>Lexer is a PHP class that takes parsed YAML tokens and outputs structured PHP objects. Multiple lexers can be registered and all will run through the entire YAML.</p><p>CraftablePro has these specific lexers:</p><ul><li>1 lexer for Model object (with additional info about translatable attributes, media collections)</li><li>1 lexer for Controller object</li><li>1 lexer for API Controller object</li></ul><pre>&lt;?php<br><br>namespace Brackets\CraftablePro\Blueprint\Lexers;<br><br>use Blueprint\Contracts\Lexer;<br>use Blueprint\Models\Statements\ResourceStatement;<br>use Brackets\CraftablePro\Blueprint\Models\CraftableProApiController;<br>use Brackets\CraftablePro\Blueprint\Models\Statements\CanStatement;<br>use Brackets\CraftablePro\Blueprint\Models\Statements\FormColumnsStatement;<br>use Brackets\CraftablePro\Blueprint\Models\Statements\ListingColumnsStatement;<br>use Brackets\CraftablePro\Blueprint\Models\Statements\SearchableColumnsStatement;<br>use Brackets\CraftablePro\Blueprint\Models\Statements\SortableColumnsStatement;<br>use Illuminate\Support\Str;<br><br>class CraftableProApiLexer implements Lexer<br>{<br>    private ApiStatementLexer $statementLexer;<br><br>    public function __construct(ApiStatementLexer $statementLexer)<br>    {<br>        $this-&gt;statementLexer = $statementLexer;<br>    }<br><br>    public function analyze(array $tokens): array<br>    {<br>        $registry = [<br>            &#39;craftable-pro-api-controllers&#39; =&gt; [],<br>        ];<br><br>        if (empty($tokens[&#39;craftable-pro&#39;][&#39;models&#39;])) {<br>            return $registry;<br>        }<br><br>        foreach ($tokens[&#39;craftable-pro&#39;][&#39;models&#39;] as $name =&gt; $definition) {<br>            if (! isset($definition[&#39;api&#39;]) || ! is_array($definition[&#39;api&#39;]) || ! count($definition[&#39;api&#39;])) {<br>                continue;<br>            }<br><br>            $controller = new CraftableProApiController($name);<br>            $statements = [<br>                new ResourceStatement(reference: $name, collection: false, paginate: false), // ModelResource.php<br>                new ResourceStatement(reference: $name, collection: true, paginate: true), // ModelCollection.php<br>            ];<br><br>            $modelName = Str::kebab(Str::plural($controller-&gt;name()));<br><br>            ...<br><br>            if (isset($definition[&#39;relationships&#39;])) {<br>                foreach ($definition[&#39;relationships&#39;] as $type =&gt; $relation) {<br>                    $relatedModelName = Str::afterLast($relation[&#39;model&#39;], &#39;\\&#39;);<br><br>                    if ($relation[&#39;type&#39;] === &#39;belongsToMany&#39;) {<br>                        $relationName = Str::camel(Str::plural($relatedModelName));<br>                    } else {<br>                        $relationName = Str::camel($relatedModelName);<br>                    }<br><br>                    $relation[&#39;model_name&#39;] = $relatedModelName;<br>                    $relation[&#39;name&#39;] = $relationName;<br>                    $relation[&#39;options_name&#39;] = &quot;{$relationName}Options&quot;;<br>                    $relation[&#39;label&#39;] = Str::headline($relationName);<br><br>                    $controller-&gt;addRelation($relation);<br>                }<br>            }<br><br>            $controller-&gt;addStatements($statements);<br><br>            foreach ($definition[&#39;api&#39;] as $method =&gt; $body) {<br>                $statements = $this-&gt;statementLexer-&gt;analyze($body);<br>                $statements[] = new CanStatement(&quot;craftable-pro-api.$modelName.$method&quot;);<br><br>                $controller-&gt;addMethod($method, $statements);<br>            }<br><br>            $registry[&#39;craftable-pro-api-controllers&#39;][$name] = $controller;<br>        }<br><br>        return $registry;<br>    }<br>}</pre><p>3. Create <strong>Generator</strong>, which will generate the final files from the output of the Lexer.</p><p>Generator is a PHP file that takes the entire Tree object (generated by lexers) as input and outputs the generated files that it’s responsible for. Multiple generators can be registered, and each gets the entire Tree object (to choose which parts of it it wants to process).</p><p>Craftable PRO has 16 generators including:</p><ul><li>ControllerGenerator</li><li>ModelGenerator</li><li>FactoryGenerator</li><li>ExportGenerator</li><li>SeederGenerator</li><li><strong>VueGenerator — yes, you can generate even non-PHP files! Alongside PHP files, Craftable PRO also generates the Vue and TypeScript files for you ❤</strong></li><li>ApiControllerGenerator</li><li>ApiResourceGenerator</li><li>ApiRequestGenerator</li><li><strong>ApiPhpUnitGenerator</strong></li><li>And more…</li></ul><p><em>Example:</em></p><pre>&lt;?php<br><br>namespace Brackets\CraftablePro\Blueprint\Generators;<br><br>use Blueprint\Concerns\HandlesImports;<br>use Blueprint\Concerns\HandlesTraits;<br>use Blueprint\Generators\ControllerGenerator;<br>use Blueprint\Models\Controller;<br>use Blueprint\Tree;<br>use Brackets\CraftablePro\Blueprint\Models\CraftableProController;<br>use Brackets\CraftablePro\Blueprint\Models\Statements\FormColumnsStatement;<br>use Brackets\CraftablePro\Blueprint\Models\Statements\ListingColumnsStatement;<br>use Brackets\CraftablePro\Blueprint\Models\Statements\SearchableColumnsStatement;<br>use Brackets\CraftablePro\Blueprint\Models\Statements\SortableColumnsStatement;<br>use Illuminate\Support\Str;<br><br>class CraftableProControllerGenerator extends ControllerGenerator<br>{<br>    use HandlesImports;<br>    use HandlesTraits;<br><br>    protected array $types = [&#39;controllers&#39;];<br><br>    protected string $exportNamespace = &#39;App\Exports\CraftablePro&#39;;<br><br>    public function output(Tree $tree): array<br>    {<br>        $this-&gt;tree = $tree;<br><br>        $stub = $this-&gt;filesystem-&gt;craftableProStub(&#39;craftable-pro-controller.class.stub&#39;);<br><br>        /** @var CraftableProController $controller */<br>        foreach (($tree-&gt;toArray()[&#39;craftable-pro-controllers&#39;] ?? []) as $controller) {<br>            $controllerModelName = Str::singular($controller-&gt;prefix());<br><br>            $this-&gt;addImport($controller, &#39;Illuminate\\Http\\Request&#39;);<br>            $this-&gt;addImport($controller, &#39;App\\Http\\Controllers\\Controller&#39;);<br>            $this-&gt;addImport($controller, &#39;Brackets\\CraftablePro\\Queries\\Filters\\FuzzyFilter&#39;);<br>            <br>            ...<br><br>            if ($controller-&gt;hasFeature(&#39;export&#39;)) {<br>                $this-&gt;addImport($controller, &#39;Maatwebsite\\Excel\\Facades\\Excel&#39;);<br>                $this-&gt;addImport($controller, &#39;Symfony\\Component\\HttpFoundation\\BinaryFileResponse&#39;);<br>                $this-&gt;addImport($controller, $this-&gt;exportNamespace.&#39;\\&#39;.$controllerModelName.&#39;Export&#39;);<br>            }<br><br>            foreach ($controller-&gt;methods() as $method =&gt; $statements) {<br>                $this-&gt;addImport($controller, &#39;App\\Http\\Requests\\CraftablePro\\&#39;.Str::ucfirst($controllerModelName).&#39;\\&#39;.Str::ucfirst($method).$controllerModelName.&#39;Request&#39;);<br>            }<br><br>            $path = $this-&gt;getPath($controller);<br><br>            $this-&gt;create($path, $this-&gt;populateStub($stub, $controller));<br>        }<br><br>        return $this-&gt;output;<br>    }<br><br>    protected function populateStub(string $stub, Controller $controller): string<br>    {<br>        $stub = str_replace(&#39;{{ namespace }}&#39;, $controller-&gt;fullyQualifiedNamespace(), $stub);<br>        $stub = str_replace(&#39;{{ class }}&#39;, $controller-&gt;className(), $stub);<br>        $stub = str_replace(&#39;{{ methods }}&#39;, $this-&gt;buildMethods($controller), $stub);<br>        $stub = str_replace(&#39;{{ imports }}&#39;, $this-&gt;buildImports($controller), $stub);<br><br>        return $stub;<br>    }<br><br>    protected function buildMethods(Controller $controller): string<br>    {<br>        $methods = &#39;&#39;;<br><br>        $controllerModelName = Str::singular($controller-&gt;prefix());<br>        $controllerModelNamePlural = Str::plural($controller-&gt;prefix());<br><br>        foreach ($controller-&gt;methods() as $name =&gt; $methodStatements) {<br>            $statements = collect($controller-&gt;statements());<br><br>            $method = str_replace(<br>                &#39;{{ method }}&#39;,<br>                $name,<br>                $this-&gt;filesystem-&gt;craftableProStub(&#39;craftable-pro-controller.method.&#39;.Str::kebab($name).&#39;.stub&#39;)<br>            );<br><br>            $method = str_replace(<br>                &#39;{{ requestClass }}&#39;,<br>                Str::ucfirst($name).$controllerModelName.&#39;Request&#39;,<br>                $method<br>            );<br><br>            $method = str_replace(&#39;{{ modelName }}&#39;, $controllerModelName, $method);<br>            $method = str_replace(&#39;{{ modelNamePluralLowerCase }}&#39;, Str::lcfirst($controllerModelNamePlural), $method);<br>            $method = str_replace(&#39;{{ modelNameLowerCase }}&#39;, Str::lcfirst($controllerModelName), $method);<br><br>            ...<br><br>            $method = str_replace(&#39;{{ eagerLoadRelations }}&#39;, $controller-&gt;joinRelations(), $method);<br>            $method = str_replace(&#39;{{ modelRelationsGetQueries }}&#39;, $this-&gt;buildModelRelationsGetQueries($controller-&gt;relations()), $method);<br>            $method = str_replace(&#39;{{ modelRelationsSyncQueries }}&#39;, $this-&gt;buildModelRelationsSyncQueries($controller-&gt;relations(), $controllerModelName), $method);<br>            $method = str_replace(&#39;{{ loadRelations }}&#39;, $this-&gt;buildModelRelationsLoad($controller, $controllerModelName), $method);<br>            $method = str_replace(&#39;{{ modelRelationDetachQueries }}&#39;, $this-&gt;buildModelRelationsDetachQueries($controller-&gt;relations(), $controllerModelName), $method);<br>            $method = str_replace(&#39;{{ modelRoute }}&#39;, &#39;craftable-pro.&#39;.Str::kebab($controllerModelNamePlural), $method);<br><br>            if ($name === &#39;export&#39;) {<br>                $method = str_replace(&#39;{{ exportName }}&#39;, $controllerModelName.&#39;Export&#39;, $method);<br>                $method = str_replace(&#39;{{ exportFileName }}&#39;, Str::lower(Str::plural($controllerModelName)), $method);<br>            }<br><br>            $methods .= PHP_EOL.$method;<br>        }<br><br>        return trim($methods);<br>    }<br><br>    ...<br>}</pre><p>4. Create <strong>stub files</strong> which will serve as templates. The generators will take them and replace the placeholders with appropriate code. We will show a few examples:</p><p><em>Controller class stub:</em></p><pre>&lt;?php<br><br>namespace {{ namespace }};<br><br>{{ imports }}<br><br>class {{ class }} extends Controller<br>{<br>    {{ methods }}<br>}</pre><p><em>Controller edit method stub:</em></p><pre>/**<br> * Show the form for editing the specified resource.<br> */<br>public function edit({{ requestClass }} $request, {{ modelName }} ${{ modelNameLowerCase }}): Response<br>{<br>    {{ loadRelations }}<br>    return Inertia::render(&#39;{{ modelName }}/Edit&#39;, [<br>        &#39;{{ modelNameLowerCase }}&#39; =&gt; ${{ modelNameLowerCase }},<br>        {{ modelRelationsGetQueries }}<br>    ]);<br>}</pre><p>5. Register lexers and generators</p><pre>Generators in config/blueprint.php:<br><br>&#39;generators&#39; =&gt; [<br>    &#39;craftable-pro-controller&#39; =&gt; \Brackets\CraftablePro\Blueprint\Generators\CraftableProControllerGenerator::class,<br>    ...<br> ],</pre><pre>Lexers in your ServiceProvider:<br><br>public function register(): void<br>{<br>    $blueprint = app(Blueprint::class);<br>    $blueprint-&gt;registerLexer(new CraftableProControllerLexer());<br>}</pre><p>6. Run the Blueprint build command</p><pre>php artisan blueprint:build draft.yaml</pre><p>And now you should have your own generator up and ready!</p><h3>Conclusion</h3><p>This sophisticated yet developer-friendly approach results in several tangible benefits:</p><ul><li><strong>Accelerated Development</strong>: What might take days to code manually can be generated in minutes</li><li><strong>Consistency</strong>: All generated code follows the same patterns and best practices</li><li><strong>Reduced</strong> <strong>Boilerplate</strong>: Developers can focus on business logic rather than repetitive CRUD operations</li><li><strong>Maintainability</strong>: The generated code is clean, well-structured, and follows Laravel conventions</li></ul><h3>What’s next?</h3><p>We are already planning the next <a href="https://laravelmeetup.sk/">community Laravel meet-up</a>, so stay tuned!</p><p>If you are in mood for a real conference, the next edition of <strong>Webstack (2025)</strong> is coming on 24.9.2025 and you can already <a href="https://www.inviton.eu/e-16845/webstack-conference-2025">grab your tickets</a>!</p><p><a href="https://www.inviton.eu/e-16845/webstack-conference-2025">Webstack Conference 2025 | Vstupenky, predpredaj</a></p><h3>Resources &amp; Links</h3><ul><li><strong>Craftable PRO</strong>: <a href="https://craftable.pro/">https://craftable.pro</a></li><li><strong>Laravel Blueprint</strong>: <a href="https://blueprint.laravelshift.com/">https://blueprint.laravelshift.com</a></li><li><strong>Webstack Conference 2025</strong>: <a href="https://webstack.sk/">https://webstack.sk</a></li><li><strong>Laravel Meetup Slovakia</strong>: <a href="https://laravelmeetup.sk/">https://laravelmeetup.sk</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e6aa4fb0383" width="1" height="1" alt=""><hr><p><a href="https://blog.meetbrackets.com/craftable-pro-code-generator-behind-the-scenes-0e6aa4fb0383">Craftable PRO: Code Generator Behind the Scenes</a> was originally published in <a href="https://blog.meetbrackets.com/">BRACKETS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[_web developers conference_ Webstack 2024]]></title>
            <link>https://blog.meetbrackets.com/web-developers-conference-webstack-2024-45b5b104025f?source=rss-a8e0ae529712------2</link>
            <guid isPermaLink="false">https://medium.com/p/45b5b104025f</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[conference]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Kristina Odziomkova]]></dc:creator>
            <pubDate>Mon, 30 Sep 2024 13:35:30 GMT</pubDate>
            <atom:updated>2024-09-30T13:54:09.582Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://webstack.sk/">Webstack 2024</a>, a top web development conference, took place in Bratislava on September 25th at HubHub Twin City C. The event gathered developers for insights into the latest web technologies and encouraged collaboration. Whether you’re into PHP, Laravel, or cloud-native apps, Webstack 2024 delivered great content for all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gj2a0qzIX73VlsAq.jpeg" /></figure><h3>A big THANK YOU to the✨ TOP✨ speakers and panelists from ✨TOP✨ software companies</h3><p><strong>Jozef Harinek</strong> — Tech Lead at <a href="https://www.slido.com/">Slido</a></p><p><strong>Miroslav Rigler — </strong>Applications Lead at <a href="https://www.gerulata.com/">Gerulata</a></p><p><strong>Adam Hamšík — </strong>CEO &amp; Co-Founder at <a href="https://lablabs.io/">Labyrinth Labs</a></p><p><strong>Adam Močkoř</strong> — Lead Developer at CX studio <a href="https://www.lbstudio.sk/">Lighting Beetle</a></p><p><strong>Jakub Potocký — </strong>Full-stack developer at <a href="https://www.partnersgroup.com/">Partners Group</a></p><p><strong>Matej Minár — </strong>Engineering Manager at <a href="https://sentry.io/">Sentry</a></p><p><strong>Adam Hamšík</strong> — CEO &amp; Co-Founder at <a href="https://lablabs.io/">Labyrinth Labs</a></p><p><strong>Dušan Katona</strong> — Head of Engineering at <a href="https://www.cloudtalk.io/">Cloudtalk</a></p><p><strong>Marcel Klimo</strong> — Head of AI R&amp;D at <a href="https://vacuumlabs.com/">Vacuumlabs</a></p><p><strong>Tomáš Kramar </strong>— CTO &amp; Co-founder at <a href="https://www.luigisbox.com/">Luigi’s Box</a></p><h3>And also THANK YOU to the Webstack moderators and organizers!</h3><p><strong>Pavol Perdík</strong> — CEO of <a href="https://meetbrackets.com/">BRACKETS</a>, Webstack moderator</p><p><strong>Marek Šuppa</strong> — Head of Data at <a href="https://www.slido.com/">Slido</a>, Webstack panel discussion moderator</p><p><strong>Barbora Gallisová</strong> — Project Manager at <a href="https://meetbrackets.com/">BRACKETS</a>, event organizator</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ca3NyXLMh5qpkrXW.jpeg" /><figcaption>Webstack’s partners 💙</figcaption></figure><h4><strong>The highlights of the afternoon — 🔥 the talks 🔥</strong></h4><h3>#1: “<strong>Lessons learned from scaling frontend apps at Slido”</strong></h3><p>The conference started strong from the beginning with the topic of “<strong>Lessons learned from scaling frontend apps at Slido” </strong>given by Slido’s Tech Lead of integrations team — Jozef Harinek.</p><p>Jozef shared insights from his six years at Slido, highlighting the key challenges of scaling their frontend applications. He focused on solving issues related to <strong>scalability</strong>, <strong>performance</strong>, and <strong>maintainability</strong>, which were the most interesting and rewarding problems he encountered.</p><p>In its beginnings, Slido was just a simple form that users could vote in. Over time, it evolved to include dedicated interfaces for both admins and participants. This was followed by the introduction of initial integrations and the addition of more client applications. As Slido continued to grow, it also expanded its teams to support this development.</p><h4><strong>The Developer Experience before:</strong></h4><ul><li>each client app had its own repository</li><li>each client app had its own set of deployment configurations (improvements did not get to all repositories and maintenance was becoming difficult)</li><li>lots of scaffolding done repetitively</li><li>limited set of environments to deploy to — each needed to be manually configured first</li></ul><p>The developer experience was getting worse as no developer likes unmaintainable codebase, the need for duplicity and the resulting frustration. After initial changes, the developer experience actually got a little bit worse than before, however after continuous feedback it improved to become much better than before.</p><h4><strong>The Developer Experience now:</strong></h4><ul><li>1 monorepo for most FE apps</li><li>powered by <a href="https://nx.dev/">nx.dev</a></li><li>shared pipelines in the repository</li><li>shared configuration</li><li>dedicated team that constantly improves the state of tooling</li><li>branch-based deployments → unlimited deployment environments</li></ul><blockquote><strong>Lesson #1: </strong>Investment into developer experience can go a long way</blockquote><p>Slido has developed various client applications to enhance user experience, including an admin interface for hosts on the web, an iframe embed for switchers, and integrations with platforms like Google Slides, PowerPoint, Microsoft Teams, Webex, Zoom, and Vidcast.</p><p>However, this growth revealed some drawbacks, such as multiple implementations of the same functionality across different tech stacks, making it challenging to introduce new features consistently. Each implementation increased the mental load on teams, as they had to manage updates across various platforms while mastering both the domain and specific core features, leading to a high chance of losing context.</p><p>To address these challenges, the solution was to centralize responsibility for core features within a single team, ensuring that domain expertise is focused and well-managed. This brings us to</p><blockquote><strong>Lesson #2:</strong> Not every team needs to be an expert in the core features of your product.</blockquote><p>With each architecture, there come challenges. Slido solved most of the monorepo architecture drawback by developing shared (utility) services — e.g. for error monitoring, telemetry and internationalization. There are technology tradeoffs, for sake of easy maintenance and extendability and also some UI tradeoffs — for the sake of being able to have one implementation across the board.</p><blockquote><strong>Lesson #3: </strong>Well defined boundaries bring lots of guidance.</blockquote><p>And now to the fun part — testing! Two to three years ago, they had very few tests on frontend. That has since changed and the current architecture that supports easier test writing looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lnBnYEObAkJBEe2Qc-Ii-w.png" /></figure><p>The UI layer can be replaced by test layer, and they can easily write tests for it. The External dependencies layer can be easily replaced with mocked dependencies.</p><h4><strong>Architecture features</strong></h4><ul><li>headless first</li><li>UI layer that feels almost optional</li><li>Easily swappable external dependencies</li><li>no logic in the UI layer if possible</li><li>models hold only current state</li><li>all business logic is in the Controller layer</li></ul><blockquote><strong>Lesson #4: </strong>Testing should be truly easy — also on frontend.</blockquote><h4><strong>After talk Q&amp;A</strong></h4><p><em>How is your deployment process?</em></p><ul><li>using Nx, GitHub + GitHub Actions, E2E tests in Playwright</li><li>it was a process and it is still not perfect</li><li>K8s was a middle ground, they were using it exclusively in the past but then they abandoned it. Now they only use it for some apps.</li></ul><p><em>What tech stack do you use?</em></p><ul><li>PHP, JS, mostly TS, React, Angular, also some .NET for an integration with Powerpoint</li></ul><p><em>What is the company size?</em></p><ul><li>40–50 developers, 100–120 employees total</li></ul><p><em>How did the Cisco acquisition affect the day to day life in the company?</em></p><ul><li>there are some formal trainings to do</li><li>some priorities come directly from Cisco, such as integrating Slido with their Webex</li><li>however they kept most of their freedom and all their tools in the dev teams</li></ul><p><strong>Thank you Jozef!</strong> 👏👏👏👏👏</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LGi4YfS_gIkmHHqA.jpeg" /></figure><h3><strong>#2: Debugging Laravel apps for performance</strong></h3><p>After a short break for networking, refreshing and talking with the partners, started the second talk “<strong>Debugging Laravel apps for performance” </strong>by Miroslav Rigler, an Applications Lead at Gerulata.</p><h4><strong>Why Does Performance Matter?</strong></h4><p>Performance is a critical aspect of any web application, but it’s often overlooked. While delivering a great user experience is essential, prioritizing it over performance can lead to inefficiencies and missed opportunities. Here’s why performance should always be a key focus:</p><ul><li><strong>User Experience Is Not Always the Top Priority</strong><br>A slick user interface alone won’t keep users engaged if the app is slow.</li><li><strong>Better Conversions and Sales</strong><br>Performance directly impacts business metrics. Faster websites lead to higher conversion rates and increased sales.</li><li><strong>SEO Implications</strong><br>Search engines, especially Google, now prioritize fast websites in search rankings.</li><li><strong>Slow Code Is More Expensive to Run</strong><br>Slow, inefficient code consumes more server resources, which increases hosting costs. This is particularly important in cloud environments where scaling is tied to resource usage.</li><li><strong>Unnecessary Environmental Impact</strong><br>Slower code and inefficient use of resources also result in a higher carbon footprint, contributing to unnecessary environmental strain. Optimizing performance isn’t just about cost — it’s also about sustainability.</li></ul><h4><strong>Tools for debugging for performance</strong></h4><ul><li><em>dd </em>— not very practical in modern use cases, e.g. for SPAs with Laravel API</li><li><em>dump — </em>Spatie Ray — GUI</li><li><em>logging</em> — out of the box or with <a href="https://github.com/laravel/pail">Laravel Pail</a></li></ul><p><strong>Application is a blackbox and to gain an insight into application blackbox, you can use these tools:</strong></p><ul><li><a href="https://laravel.com/docs/telescope">Laravel Telescope</a></li><li><a href="https://github.com/barryvdh/laravel-debugbar">Laravel Debugbar</a></li><li><a href="https://github.com/itsgoingd/clockwork">Clockwork</a> — developed and maintained by Miroslav himself!</li></ul><p><strong>But Sometimes you need to go even deeper…</strong></p><ul><li>Xdebug</li><li>SPX PHP extension, recently added to <a href="https://herd.laravel.com/">Laravel Herd</a></li></ul><p><strong>Tools for continuous monitoring</strong></p><ul><li><a href="https://www.bugsnag.com/">Bugsnag</a></li><li><a href="https://sentry.io/">Sentry</a></li><li><a href="https://www.datadoghq.com/">Datadog</a></li><li><a href="https://newrelic.com/">New Relic</a></li><li><a href="https://flareapp.io/">Flare</a></li><li><a href="https://inspector.dev/">Inspector.dev</a></li><li><a href="https://www.blackfire.io/">Blackfire.io</a> — includes xdebug profiler</li><li><a href="https://opentelemetry.io/">OpenTelemetry</a> — for Laravel also a <a href="https://spatie.be/docs/laravel-open-telemetry/v1/introduction">Spatie package</a>. Useful for big stacks with lots of moving parts written in different languages — esp. micro-services</li></ul><h4><strong>Solutions for most common Laravel performance problems</strong></h4><p><strong>N+1 query problem + hydrating too many models</strong> — can be debugged through e.g. Laravel Telescope and solved by eager loading, using strict mode — prevents lazy loading, prevents silently discarding attributes, prevents access missing attributes; using $model-&gt;whenLoaded(‘relationship’) in resource collections…</p><p><strong>Expensive Elastic/DB queries </strong>— solutions: precompute data daily in a scheduled commands, or cache the results. Do the intensive work once and reuse results on subsequent requests.</p><p><strong>Long running subsequent functions </strong>— use queues, possibly also with <a href="https://laravel.com/docs/horizon">Laravel Horizon</a>. Queue types: DB, Redis, SQS, Beanstalkd, sync…</p><p><strong>Generating expensive Excel exports </strong>— precompute exports ahead of time in scheduled command, queue the job and build progress UI, queue the job and send result by email, or use a different excel export library…</p><h4><strong>Further resources:</strong></h4><ul><li><a href="https://laravel-performance.com/">Performance with Laravel</a></li><li><a href="https://learn-laravel-queues.com/">Laravel Queues in Action</a></li></ul><p><strong>Thank you Miroslav! 👏👏👏👏👏</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8tGL-AgH7Q3upcwt.jpeg" /></figure><h3><strong>#3: PHP in the Cloud: Embracing Cloud-Native for Scalable Applications</strong></h3><p>After a short break we continued with the third talk, titled “<strong>PHP in the Cloud: Embracing Cloud-Native for Scalable Applications” </strong>by Adam Hamšík, the CEO &amp; Co-Founder at Labyrinth Labs.</p><h4><strong>What is a cloud native app?</strong></h4><ul><li>app that can fully leverage cloud environment</li><li>scalable</li><li>resilient</li><li>distributed — can run in multiple copies</li><li>observable</li><li>so in short, something that can run for example on Kubernetes</li></ul><blockquote>A word of advice: Maintaining multiple apps with different PHP versions is messy — due to different extension requirements, configuration, and complicated upgrade process. Keep an eye on security upgrades for PHP and extensions — update often, ideally automatically.</blockquote><h4><strong>PHP execution engines:</strong></h4><p>Most of the PHP developers are probably familiar with the <strong>nginx + php fpm </strong>combination, which is robust but slow. It has to initialise app context for every single request!</p><p>Thankfully there are many <strong>event driven alternatives:</strong></p><ul><li><a href="https://openswoole.com/">Open Swoole</a></li><li><a href="https://reactphp.org/">ReactPHP</a></li><li><a href="https://frankenphp.dev/">FrankenPHP</a></li><li><a href="https://amphp.org/">AMPHP</a></li></ul><p>The downside of these event driven alternatives is that you might have to update your PHP app to work with it.</p><h4><strong>PHP in Kubernetes</strong></h4><p>Stateless services scale and are much easier to run. You can utilise spot instances, and if you have predictable spikes in your workflow use <a href="https://keda.sh/">Keda</a> for pre-scaling.</p><ul><li>Each pod has at least 2 containers — nginx + PHP.</li><li>Application secrets — find a good repeatable way to fetch and maintain application secrets</li><li>Running a lot of smaller sized pods is easier and cheaper than running VM sized pods. There is less waste. Make sure you tune workers and requests together.</li><li>Pod startup time matters. HPA will not help you if it takes forever to start a pod.</li><li>Startup probe can help you with warming up your containers</li></ul><p>PHP offers goods performance if you tune it for it:</p><ul><li>cache early and often</li><li>validate your apps, find way how to load test your app</li><li>still single thread execution model</li><li>look for PHP options to get most of the performance<br> — opcache<br> — apcu<br> — jit<br> — or replace FPM with other execution engine</li></ul><h4><strong>PHP FPM vs. Swoole</strong></h4><p><strong>Pros:</strong></p><ul><li>migration to Swoole saved them 70% of compute costs and lowered latency by 2/3. This is however app specific.</li></ul><p><strong>Cons:</strong></p><ul><li>you have to make sure your extensions are compatible</li><li>you depend on another vendor</li><li>you have to optimize multiple places in the app to see full benefit</li></ul><h4><strong>PHP vs. workers</strong></h4><ul><li>running workers in PHP really sucks, it is hard to use execution engines</li><li>you are mostly stuck with php-cli as your main driver / single process, single thread. Hard to gather metrics and logs.</li><li>it is hard to set scaling right — not PHP specific, it is much harder to scale workers than stateless services</li></ul><h4><strong>PHP base image container</strong></h4><p>The developers in Labyrinth Labs have developed their own PHP base image container which might also be published in the future, so keep an eye out!</p><ul><li>custom PHP-FPM container with multiple extensions and configurable with env variables</li><li>multiple build options — debug, build, base</li><li>maintained and updated for all supported PHP versions</li><li>currently building both an x86 and arm64 version</li></ul><h4>PHP Observability</h4><p>Observability is the key to understand your workload.</p><ul><li>metrics &amp; logs are just a beginning</li><li>adding application specific metrics makes you better understand what is going on. They also make good SLI.</li><li>don’t save logs into files — they will increase container filesystem cache and use more RAM than needed. Instead, print to stdout and collect your logs from a node.</li></ul><h4>After talk Q&amp;A</h4><p><em>When should a multi-client software house adopt K8s? What minimal criteria make it a good fit and when does it not make any sense?</em></p><ul><li>we run it all the time, generally it is always ok</li><li>if your project runs on 1VM, it is not a good case for K8s</li><li>if you have 20 clients and each runs on a VM, K8s is a good option</li></ul><p><em>What do you think of FrankenPHP?</em></p><ul><li>no experience with FrankenPHP, using Swoole</li></ul><p><em>What is the right time to migrate an app to the cloud? Would you recommend having an app in cloud from the beginning or just go with VPS and migrate to cloud later?</em></p><ul><li>when you find your market fit, investments</li><li>when you are ready for scaling</li></ul><p><em>What is your most favorite and least favorite thinkg about K8s?</em></p><ul><li>most favorite: the community and ecosystem</li><li>least favorite: frequent updates — every 6 months</li></ul><p><strong>Thank you Adam! 👏👏👏👏👏</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eAT2jaj9VcSRTMda.jpeg" /></figure><h3>#4: <strong>Designer and Developer collaboration</strong></h3><p>After two tech-heavier talks came a more relaxed, more soft-skill oriented but in-no-way-less-interesting talk “<strong>Designer and Developer collaboration” </strong>by Adam Močkoř, Lead Developer at CX studio Lighting Beetle.</p><h4>Why does collaboration matter?</h4><p>If the designer makes a beautiful, pixel perfect design but does not have knowledge of how it will be used, problems may arise. Such as this one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IVOI778jSmjylVTApbJ2RA.png" /></figure><p>To prevent such problems, it is a good idea to integrate developers in the ideation process. For most of them, it is also a fun experience where they learn a lot, and it might improve time-to-ship significantly → collaboration is the obvious answer!</p><h4><strong>What could collaboration mean for devs?</strong></h4><ul><li>feasibility — figure out if the idea is doable</li><li>ideation — best time for feasibility talks, where our creativity helps shape workable solutions</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8O3P-EAfk2d4_C2r_t1fZg.png" /></figure><h4>Practical approach #1 — systems thinking</h4><p><a href="https://en.wikipedia.org/wiki/Systems_thinking"><strong>Systems thinking</strong></a> is a way of making sense of the complexity of the world by looking at it in terms of wholes and relationships rather than by splitting it down into its parts.</p><p>Advantages:</p><ul><li>get the beat of the system</li><li>expose your mental models to the light of the day</li><li>distribute information</li><li>expand the horizons</li><li>establish feedback loops</li><li>work for the good of the whole system</li></ul><p><a href="https://www.amazon.com/Thinking-Systems-Donella-H-Meadows/dp/1603580557">Thinking in Systems: International Bestseller</a></p><h4>Practical approach #2 — leverage meetings</h4><h4>Practical approach #3 — how is your designer today?</h4><p>Foster deeper connections between developers and designers. A simple “How are you feeling today?” might do the trick.</p><h4>Practical approach #4 — think and care about the next person after you</h4><p>Think of work as a flow of information. There will always be someone before us (e.g. designer) and after us (tester, new developer…). Make the processes more human centric and foster stronger relationships with those around you.</p><h4><strong>Questions you can ask or be asked during collaboration:</strong></h4><ul><li>Is this feasible?</li><li>What constraints should we consider for the performance of these visual elements?</li><li>Are there any parts of the design that might be difficult to code and would need simplification?</li><li>Can this interaction (like a hover effect or drag-and-drop feature) be easily implemented with the current framework?</li><li>Can we simplify this design to make it easier to implement without losing its essence?</li><li>How should we handle edge cases or unexpected user behavior with this design?</li></ul><h4>Methods &amp; Resources</h4><ul><li><a href="https://kanbantool.com/kanban-guide/5-whys">5 whys</a> — repeatedly asking the question “why?” until the root cause of a problem is determined. Anecdotally, it takes five “why?” questions to get to the bottom of any issue.</li><li><a href="https://www.designcouncil.org.uk/our-resources/the-double-diamond/">The Double Diamond</a> — The Double Diamond is a visual representation of the design and innovation process. It’s a simple way to describe the steps taken in any design and innovation project, irrespective of methods and tools used.</li></ul><p><strong>Thank you Adam! 👏👏👏👏👏</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8366QOzjxkmsszAk.jpeg" /></figure><h3>#5: <strong>A big (PHP)Unit of work</strong></h3><p>Last but not least, after some great catering, Jakub Potocký, a full-stack developer from Partners Group, gave a talk on “<strong>A big (PHP)Unit of work”.</strong></p><h4>So, what actually is testing?</h4><p>Testing — running code in automated, deterministic and repeatable way. It is making sure everything works as intended.</p><p>Testing for us is all about:</p><ul><li>allowing CI/CD flow</li><li>ensuring the stack is up-to-date</li><li>helping with discovering and fixing bugs</li><li>ensuring long term maintainability</li><li>maintaining quick feedback loop</li></ul><h4>Testing tools for PHP/Laravel</h4><p><a href="https://docs.phpunit.de/en">PHPUnit</a> — a programmer-oriented testing framework for PHP.</p><p><a href="https://github.com/laravel/dusk">Laravel Dusk</a> provides an expressive, easy-to-use browser automation and testing API.</p><p><a href="https://packages.tools/testbench">orchestral/testbench</a> — a PHP package that simplifies the process to create feature and integration tests for your Laravel packages without massive configuration and build steps.</p><h4>Tips &amp; tricks to simplify testing</h4><ul><li>“going strict” is testing before writing tests</li></ul><pre>declare(strict_types=1)</pre><ul><li>unnecessary complexity should be avoided</li><li>dependency injection simplifies testing</li><li>splitting up simplifies unit testing</li><li>readonly and final classes are not ready — final classes cannot be mocked (PHP8.1+), readonly classes cannot be extended by non ready only classes (PHP8.2+)</li><li>using seeders as a preparation</li><li>clean code helps — Pint, PHPCS…</li><li>structure prevents mess — same directory structure for unit tests as for source code. Tests for <em>app/Http/Controllers/UserController.php</em> in a test file located in <em>tests/app/Http/Controllers/UserControllerTest.php</em></li><li>describe your tests — use descriptive class and test methods names</li><li>mocking allows for true unit testing</li><li>don’t repeat yourself — use data providers instead of duplicating tests</li><li>early returns and edge cases must be tested</li><li>test must fail if it goes wrong</li><li>AI speeds up test development</li></ul><h4><strong>Speeding up the test suite</strong></h4><ul><li>watch for slow tests</li><li>logs can be suspicious</li><li>check that you are not seeding more that you need</li><li>mock external services</li><li>parallel tests — as a last resort for optimization</li></ul><p><strong>Thank you Jakub! 👏👏👏👏👏</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MgT8rDFbtbHI9Rht.jpeg" /></figure><h3>#6: Pannel Discussion — “<strong>Balancing Technical Debt in Product Startups vs. SW Houses/Agencies”</strong></h3><p>After five great tech talks, it was finally time for the panel discussion on the topic of “<strong>Balancing Technical Debt in Product Startups vs. SW Houses/Agencies”.</strong> It brought up some interesting insights and here we will summarise what we managed to write down during the debate.</p><blockquote>The full debate, same as all talks, will be available as video recordings soon.</blockquote><p><em>Q #1: Is tech debt inevitable?</em></p><ul><li><strong>M.M.</strong>: “[…] absolutely normal process, especially in MVP phase.”</li><li><strong>A.M.</strong>: “Yes, but you need to understand that the debt is there and that you will have to solve it eventually.”</li><li><strong>A.M.</strong>: “[…] When postponing getting rid of tech debt until forever, your engineers will leave, you will have outages, you will pay to the cloud provider to scale…”</li><li><strong>M.K.</strong>: “[…] performance will suffer, building new features will take longer — in these scenarios, the customer will understand the tech debt problem.”</li><li><strong>M.K.</strong>: […] “choose a client that understands.”</li><li><strong>T.K.:</strong> “Tech debt is the byproduct of the learning process — when client sees the first version of the app, they will (almost always) ask for changes.”</li></ul><p><em>Q #2: How do you handle the tension between resolving tech debt and pushing/developing new features?</em></p><ul><li><strong>M.M.</strong>: “It is important to know which debt is the most important to take care of now and which can be postponed.”</li><li><strong>D.K.</strong>: “Having a longterm roadmap helps — we can tell the client “We can make these 1–2 features faster if we prioritise this tech debt cleanup beforehand””</li></ul><p><em>Q #3: what implications will it have on tech debt that most code will be written by AI in the future?</em></p><ul><li><strong>M.K.</strong>: “There will be fewer coders but the same amount of engineers/developers. The simple tasks will slowly be done by AI.”</li><li><strong>M.M.: </strong>“[…] the broken windows theory — bad code attracts more bad code, so fix it before it happens.”</li><li><strong>D.K.: </strong>“[…] leave the campground cleaner than you found it — refactor a small thing every time you can.”</li></ul><p><em>Q #4: What do you think about estimates being often viewed as promises? How can we prevent that?</em></p><ul><li>“To the client, provide milestones, updates, update the roadmap …”</li></ul><p><em>Q #5: Do you ever feel guilty for handing over a shiny new product that is basically duct-taped together behind the scenes?</em></p><ul><li>“No, context is what matters.”</li><li>“Everyone understands this, when handing projects over to other teams, they say: “we know how it goes”.”</li></ul><p><em>Q #6: What is the worst tech debt you have inherited?</em></p><ul><li>“One giant database in micro-services oriented DB. It did not fit in the biggest instance provided by AWS.”</li><li>“Managing a very old Java app, very large monolith. They tried to rewrite it, but the company does not exist anymore.”</li></ul><p><strong>Thank you Matej, Adam, Dušan, Marcel, Tomáš and Marek! 👏👏👏👏👏👏</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Pmy6NcLqEm66n2Ul.jpeg" /><figcaption>Panel discussion on the topic of “Balancing Technical Debt in Product Startups vs. SW Houses/Agencies”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AeyAlXxI1KBZs9-x.jpeg" /><figcaption>Sentry, Labyrinth Labs and Craftable PRO booths</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R0bX2puVawTCzEZt.jpeg" /><figcaption>Delicious catering 🔝</figcaption></figure><h3>Testimonials</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LQkFz54qw9IZwUj8nPzG7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xwQN0YIQ-sG475B0aCINtQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0qvIa74t30oJugJ3g2VfFQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fq_AtMcpTcEtiD6sF0aNMQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NUur2Btv1NIUZfH1MpzRJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BOWpZHlz5ER6rFbz___sGg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_y8q5aV_bNiV5dSrGRLOOg.png" /></figure><h3>Webstack 2025</h3><p>What themes would you like to see in the future? For us, that would definitely be soft-skills and DevOps! Let us know in the comments or on <a href="https://www.linkedin.com/company/webstack-conference">LinkedIn</a> :)</p><p>Webstack 2025 is coming on 24.9.2025 and you can already <a href="https://www.inviton.eu/e-16845/webstack-conference-2025">grab your tickets</a>! For a limited time even with a 50% discount! This offer is valid until <strong>October 10th, 2024 </strong>using the promo code<strong> webstack2025.</strong></p><p><a href="https://www.inviton.eu/e-16845/webstack-conference-2025">Webstack Conference 2025 | Vstupenky, predpredaj</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45b5b104025f" width="1" height="1" alt=""><hr><p><a href="https://blog.meetbrackets.com/web-developers-conference-webstack-2024-45b5b104025f">_web developers conference_ Webstack 2024</a> was originally published in <a href="https://blog.meetbrackets.com/">BRACKETS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Chaos to Control: Why Automated Tests Are Essential]]></title>
            <link>https://blog.meetbrackets.com/from-chaos-to-control-why-automated-tests-are-essential-dd9fdbbdf564?source=rss-a8e0ae529712------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd9fdbbdf564</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Kristina Odziomkova]]></dc:creator>
            <pubDate>Tue, 20 Aug 2024 12:47:34 GMT</pubDate>
            <atom:updated>2024-09-30T14:19:50.832Z</atom:updated>
            <content:encoded><![CDATA[<p>The pressure to fit into the client’s budget, to deliver MVPs quickly and later to release new features and updates can sometimes lead to corners being cut — especially when it comes to testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BxrZ1dcs1QoF79YSDX02Fw.jpeg" /></figure><p>Many developers (and not just in the junior section) consider tests to be a waste of time. Why spend so much time and lines of code on automated tests, when they can test each new feature manually, or leave it to the QA? (Or to the client? 🤫) Why do they need tests when they make sure each feature they add is 100% correct and bug-free? (Yes, we actually heard that exact reasoning from a potential candidate 🥲).</p><p>Automated testing is more than just a safety net; it’s a vital component of modern development practices that enhances productivity, reduces errors, and boosts overall code quality. With the right automated tests in place, developers can catch bugs early, maintain stability during updates, refactor easily and ultimately deliver a better experience to the client and their users.</p><p>Whether you’re an experienced developer or just starting out, understanding the benefits of automated testing will be a step in the right direction.</p><h3>1. Understanding the basics: What are automated tests?</h3><p>Automated tests are pieces of code, just like any other code you write in your app. They make sure you don’t have to retest all the features after each little change in the codebase. It can happen even to the best developer that changing a piece of code in one place will eventually break something at a completely unexpected place. Unless you test the whole project manually after each release to production, there is a high chance that a user or your client will find the bug first!</p><h3>2. The Cost of Manual Testing: Time, Resources, and Risks</h3><p>While automated tests require an upfront investment of time and resources, it’s important to remember that manual testing, especially for older code, also demands significant time and effort — effort that grows as the project expands. Manual testing is crucial for ensuring the quality of new features, but it becomes less efficient when repeatedly testing existing code, as it’s more susceptible to human error and oversight. Additionally, the repetitive nature of manual retesting can lead to decreased motivation.</p><p>Therefore, the time needed for automated testing should be factored into the overall time and cost estimation of the features, rather than being treated as an optional add-on if there is leftover budget. This approach allows manual testing to focus on new features, where it adds the most value.</p><h3>3. Ensuring Code Quality and Stability Over Time</h3><p>Automated tests help maintain code quality and stability, especially during refactoring and when adding new features, ensuring that existing functionality remains intact. It’s not just the big refactors that break stuff, sometimes even an automated code styler/fixer can make a change that breaks something. When the codebase is sufficiently covered with tests, the bugs would have been found rightaway.</p><h3>4. Facilitating Continuous Integration and Deployment (CI/CD)</h3><p>Thanks to automated tests and running them in the CI/CD pipeline, the changes will be deployed only when all the tests pass.</p><h3>5. Reducing the Risk of Regression Bugs</h3><p>Bugs still happen, even with test coverage, but a good rule of thumb is to write a new automated test after each bug fix (or before, if you prefer TDD), to ensure that the same bug will not happen again. Not many things lower your client’s opinion of you more than having to report problems again and again that have already been solved multiple times.</p><h3>6. Written tests as documentation</h3><p>Going through the test suite might help a new developer to understand how some features work, especially if the actual project documentation is missing. Moreover, some use cases might be difficult to explain or describe in code and code comments and much easier to understand by seeing the code work with mocked data and seeing the desired results.</p><h3>7. The Developer Experience</h3><ul><li>If you push untested, or insufficiently tested code to the testing environment, e.g. new API endpoints, and your (frontend) colleagues have to implement them, they will certainly not be happy if half of the API throws HTTP 500 errors.</li><li>If your “finished” task returns to you 5 times, each time with a new report of a bug, it can be frustrating and demoralizing.</li><li>When a new colleague comes to the project and does not have the reassurance of the passing tests that their changes did not break anything, it can create a sense of uncertainty and hesitation, making them less confident in implementing their contributions and potentially slowing down the development process.</li></ul><h3>8. Future Trends in Automated Testing</h3><p>With the raise of AI, it is certain that automated testing, which is certainly the more disliked and difficult part of software development, is a great candidate for its help. There are already many great tools and you just have to search to find the perfect match for your stack.</p><p>If you have trouble coming up with test cases that should be covered, you can discuss them during sprint plannings, daily stand-ups or when starting to work on a task with your colleagues or the client. However, chatbots such as ChatGPT might come in handy in such cases. If you describe your problem, the inputs and outputs and/or the business logic, they might be able to give you some pretty good ideas, or even a starting piece of code.</p><p>Giving ChatGPT this prompt:</p><blockquote>I have an endpoint POST “/api/event that only authorized and authenticated users can access, and the input arguments are: name — required, price — required, note — nullable, what test cases should I test?</blockquote><p>yields this result (shortened for clarity):</p><blockquote>Here are some essential test cases to consider:</blockquote><blockquote><strong>TC1: Access Denied for Unauthorized Users<br>Expected Result:</strong> Return a 401 Unauthorized status code.</blockquote><blockquote><strong>TC2: Access Denied for Authenticated but Unauthorized Users<br>Expected Result:</strong> Return a 403 Forbidden status code.</blockquote><blockquote><strong>TC3: Missing Required Fields<br>Expected Result:</strong> Return a 400 Bad Request status code with a validation error message indicating that name is required.</blockquote><blockquote><strong>TC4: Price Field Validation<br>Expected Result:</strong> Return a 400 Bad Request status code with a validation error indicating that price must be a positive number.</blockquote><blockquote><strong>TC5: Price Field as Non-numeric Value<br>Expected Result:</strong> Return a 400 Bad Request status code with a validation error indicating that price must be a number.</blockquote><p>Then you can prompt it to give you a code in your given programming language and framework:</p><blockquote>give me PHPunit tests in Laravel for given endpoint and these test cases: <br>TC1: Access Denied for Unauthorized Users Expected <br>Result: Return a 401 Unauthorized status code. <br>TC2: Access Denied for Authenticated but Unauthorized Users <br>Expected Result: Return a 403 Forbidden status code. <br>TC3: Missing Required Fields <br>Expected Result: Return a 400 Bad Request status code with a validation error message indicating that name is required. <br>TC4: Price Field Validation <br>Expected Result: Return a 400 Bad Request status code with a validation error indicating that price must be a positive number. <br>TC5: Price Field as Non-numeric Value <br>Expected Result: Return a 400 Bad Request status code with a validation error indicating that price must be a number.</blockquote><p>and it will give you the code:</p><pre>namespace Tests\Feature;<br><br>use Illuminate\Foundation\Testing\RefreshDatabase;<br>use Illuminate\Foundation\Testing\WithoutMiddleware;<br>use Illuminate\Support\Facades\Auth;<br>use Tests\TestCase;<br><br>class EventApiTest extends TestCase<br>{<br>    use RefreshDatabase; // Use this if you want to reset the database for each test.<br><br>    /**<br>     * TC1: Access Denied for Unauthorized Users<br>     */<br>    public function test_access_denied_for_unauthorized_users()<br>    {<br>        $response = $this-&gt;postJson(&#39;/api/event&#39;, [<br>            &#39;name&#39; =&gt; &#39;Sample Event&#39;,<br>            &#39;price&#39; =&gt; 10.00,<br>        ]);<br><br>        $response-&gt;assertStatus(401); // Unauthorized<br>    }<br><br>    /**<br>     * TC2: Access Denied for Authenticated but Unauthorized Users<br>     */<br>    public function test_access_denied_for_authenticated_but_unauthorized_users()<br>    {<br>        // Simulate a user who is authenticated but does not have permissions.<br>        $user = \App\Models\User::factory()-&gt;create();<br>        $this-&gt;actingAs($user); // Authenticate the user<br><br>        $response = $this-&gt;postJson(&#39;/api/event&#39;, [<br>            &#39;name&#39; =&gt; &#39;Sample Event&#39;,<br>            &#39;price&#39; =&gt; 10.00,<br>        ]);<br><br>        $response-&gt;assertStatus(403); // Forbidden<br>    }<br><br>    /**<br>     * TC3: Missing Required Fields<br>     */<br>    public function test_missing_required_fields()<br>    {<br>        $user = \App\Models\User::factory()-&gt;create();<br>        $this-&gt;actingAs($user); // Authenticate the user<br><br>        $response = $this-&gt;postJson(&#39;/api/event&#39;, [<br>            &#39;price&#39; =&gt; 10.00,<br>        ]);<br><br>        $response-&gt;assertStatus(400) // Bad Request<br>                 -&gt;assertJsonValidationErrors([&#39;name&#39;]); // Validate error for &#39;name&#39;<br>    }<br><br>    /**<br>     * TC4: Price Field Validation (Positive Number)<br>     */<br>    public function test_price_field_validation_positive_number()<br>    {<br>        $user = \App\Models\User::factory()-&gt;create();<br>        $this-&gt;actingAs($user); // Authenticate the user<br><br>        $response = $this-&gt;postJson(&#39;/api/event&#39;, [<br>            &#39;name&#39; =&gt; &#39;Sample Event&#39;,<br>            &#39;price&#39; =&gt; -5.00, // Negative price<br>        ]);<br><br>        $response-&gt;assertStatus(400) // Bad Request<br>                 -&gt;assertJsonValidationErrors([&#39;price&#39;]); // Validate error for &#39;price&#39;<br>    }<br><br>    /**<br>     * TC5: Price Field as Non-numeric Value<br>     */<br>    public function test_price_field_as_non_numeric_value()<br>    {<br>        $user = \App\Models\User::factory()-&gt;create();<br>        $this-&gt;actingAs($user); // Authenticate the user<br><br>        $response = $this-&gt;postJson(&#39;/api/event&#39;, [<br>            &#39;name&#39; =&gt; &#39;Sample Event&#39;,<br>            &#39;price&#39; =&gt; &#39;not-a-number&#39;, // Non-numeric price<br>        ]);<br><br>        $response-&gt;assertStatus(400) // Bad Request<br>                 -&gt;assertJsonValidationErrors([&#39;price&#39;]); // Validate error for &#39;price&#39;<br>    }<br>}</pre><p>It probably won’t be just a copy-paste situation where everything works, but it will save you a lot of time writing the boilerplate code which is boring doing manually.</p><h3>9. Building a Culture of Testing in Your Development Team</h3><p>Building a culture of testing within a development team is crucial for ensuring software quality. Here are some steps that might help you:</p><ol><li><em>Team leaders and senior developers should actively participate in writing tests and discussing their importance.</em></li><li><em>Incorporate testing in the development workflow. Every code commit could trigger automated tests to run, ensuring that tests are a fundamental part of the development process.</em></li><li><em>Establish clear testing guidelines and standards.</em></li><li><em>Provide training and resources</em></li><li><em>Acknowledge and celebrate milestones related to testing, such as achieving high test coverage or successfully catching critical bugs before release.</em></li><li><em>Make testing a key component of the code review process. Reviewers should check for adequate test coverage and the quality of test cases before code is merged into the main branch.</em></li></ol><p>If this article has been interesting to you, consider joining us live for our web developer conference <a href="https://webstack.sk/">Webstack</a> in Bratislava, Slovakia where many other interesting themes are coming up, and not just about PHP and Laravel!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pFyZprKBf4leD8xEL0W0Fw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd9fdbbdf564" width="1" height="1" alt=""><hr><p><a href="https://blog.meetbrackets.com/from-chaos-to-control-why-automated-tests-are-essential-dd9fdbbdf564">From Chaos to Control: Why Automated Tests Are Essential</a> was originally published in <a href="https://blog.meetbrackets.com/">BRACKETS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Video manipulation with Laravel, Python & AWS Lambda]]></title>
            <link>https://blog.meetbrackets.com/video-manipulation-with-laravel-python-aws-lambda-360b95d47a23?source=rss-a8e0ae529712------2</link>
            <guid isPermaLink="false">https://medium.com/p/360b95d47a23</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <dc:creator><![CDATA[Kristina Odziomkova]]></dc:creator>
            <pubDate>Fri, 07 Jun 2024 10:18:18 GMT</pubDate>
            <atom:updated>2024-06-07T13:42:48.471Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VkML1IF30fcqT8dY4udg9g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S7SA9lvDTUissS95Yp_UJg.png" /><figcaption>Graphic proposal for the resulting video of an analysis of a runner’s technique, developed by <a href="https://runology.app/">RUNology</a></figcaption></figure><p>The intersection of software development and video processing in today’s technological landscape is revolutionizing the digital world through dynamic collaboration. At its core, software development provides the framework and tools necessary to create, manipulate, and optimize digital content, while video processing focuses on enhancing the visual aspects of that content.</p><p>As a software company or freelance developer, you may find yourself facing unexpected requests, such as incorporating video processing into your projects. Imagine your client suddenly wants you to integrate a human skeleton drawing onto a video. How would you handle this challenge, especially ensuring timely execution as multiple users upload videos for analysis concurrently?</p><p><strong>Objective:</strong> A mobile app user <strong>uploads a short video</strong> of their running technique, which is then forwarded to an external video analysis service (custom tailored by <a href="https://www.cognexa.com/"><strong>Cognexa</strong></a>, a software development company specializing in <strong>AI products</strong>) for comprehensive evaluation.</p><p>The service <strong>generates a JSON file</strong> containing the data for the final video. It includes <strong>coordinates of various body parts</strong> throughout each frame, identification of <strong>running phases</strong>, <strong>average angles</strong> of the runner’s elbows and knees, and a performance “score” indicating the runner’s technique proficiency. Upon completion of the analysis, both the JSON file and the original video are returned to us. Using the JSON data, we have to <strong>draw the phases</strong>, <strong>skeleton</strong>, <strong>angles</strong>, and more on top of the video, while <strong>cutting it</strong> into 6 passages, <strong>slowing</strong> some of them down, <strong>inserting</strong> still frames of interest, and <strong>adding graphics.</strong> Moreover, we commited to delivering this entire process within a timeframe of 20–30 minutes, (even if there are 50 or 500 other video analyses of other users being processed in parallel).</p><p><strong>Original video:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F9l-nercOn94&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9l-nercOn94&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2F9l-nercOn94%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/387a64ecba9e9e6ab22a3744f3f449d4/href">https://medium.com/media/387a64ecba9e9e6ab22a3744f3f449d4/href</a></iframe><p><strong>Processed video:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F9SsxLf675zQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9SsxLf675zQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F9SsxLf675zQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/00889104ae21e368208cf9927bca9b53/href">https://medium.com/media/00889104ae21e368208cf9927bca9b53/href</a></iframe><p>If this app and its features piqued your interest, head over to the <a href="https://runology.app/"><strong>Runology</strong></a> website to learn more, or download it from the <a href="https://apps.apple.com/us/app/runology/id1668075706"><strong>App Store</strong></a> or <a href="https://play.google.com/store/apps/details?id=com.runology.runology"><strong>Google Play Store</strong></a>.</p><p><strong>The journey starts:</strong> since in <a href="https://meetbrackets.com/">BRACKETS</a> we are well versed in PHP and Laravel, our first attempt was to try and do it all in PHP. Recognizing that building video manipulation functionalities from the ground up would be impractical for a single client project, our primary objective was to find a suitable library that would have (almost) everything we needed: vector drawing, frame cutting, overlays, and speed control. Unfortunately, there are not many and a majority of those existing are pretty old or difficult to use.</p><p>One notable mention that we have tried using is <a href="https://github.com/PHP-FFMpeg/PHP-FFMpeg">https://github.com/PHP-FFMpeg/PHP-FFMpeg</a> (which is still supported and maintained), which can do many things, but it is not perfect (for our use case) and it is difficult to easily maintain its dependencies on our own servers. It is also not as fast as we need.</p><p><strong>A few weeks and a few prototypes later:</strong> The road to defining the final architecture of our video processor has been long and widely discussed in our team, but not that interesting to be mentioned here. So let’s skip to the final proposal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YWcG-_03ma4_u9NEeRUZWw.png" /><figcaption>Laravel + Python + AWS Lambda</figcaption></figure><p>Why <strong>Laravel</strong>?</p><ol><li><strong>Existing codebase:</strong> The API for the mobile app was already existing and written in Laravel.</li><li><strong>Preference:</strong> We specialize in Laravel based backends and APIs.</li></ol><p>Why <strong>AWS Lambda</strong>?</p><ol><li><strong>Cost Efficiency</strong>: With Lambda, you pay only for the compute time your code consumes, which can result in significant cost savings compared to maintaining and scaling your own servers where you pay for resources whether they’re in use or not.</li><li><strong>Automatic Scaling</strong>: AWS Lambda automatically scales to accommodate the volume of incoming requests, ensuring optimal performance without the need for manual intervention.</li><li><strong>No Server Management</strong>: Lambda abstracts away the underlying infrastructure, so you don’t need to worry about server provisioning, patching, or maintenance.</li><li><strong>High Availability</strong>: AWS Lambda runs your code across multiple availability zones within a region, providing built-in high availability and fault tolerance.</li><li>But <strong>most importantly</strong> — we were itching to finally use the <a href="https://github.com/hammerstonedev/sidecar">Laravel Sidecar</a> package in a real project, which we got to know at the <a href="https://fullstackeurope.com/2022">Full Stack Europe 2022</a> conference.</li></ol><p>Why <strong>Python</strong>?</p><ul><li><strong>AWS Lambda:</strong> Python is one of the languages supported by the AWS Lambda, while PHP is not. In the beginning, before we realised we would have to use Docker inside AWS Lambda anyway, instead of directly using Lambda’s supported runtimes, this was a big reason.</li><li><strong>Syntax and Readability</strong>: Python is known for its clear and concise syntax, which makes it easier to read and write compared to PHP. Python’s syntax resembles natural language more closely.</li><li><strong>Versatility</strong>: Python is a general-purpose programming language, meaning it can be used for a wide range of applications beyond web development, including data analysis, artificial intelligence, scientific computing, and automation. PHP, while primarily used for web development, is not as versatile in other domains.</li><li><strong>Rich Ecosystem</strong>: Python has a vast ecosystem of libraries and frameworks that simplify various tasks, such as data analysis (NumPy), computer vision and<strong> </strong>machine learning (OpenCV, SciPy, scikit), video editing (MoviePy), vector graphics (gizeh) and more. This enables developers to leverage existing tools and resources.</li></ul><p>Did we have experience in Python? Not so much. However…</p><blockquote>“Every great developer you know got there by solving problems they were unqualified to solve until they actually did it.” — Patrick McKenzie</blockquote><p>Before we dive in to the code and implementation details, here are two simplified diagrams of the resulting architecture, which today successfully runs in production:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*27JZc4THmhQS6qiU_rPeOQ.png" /><figcaption>Simplified diagram of the architecture</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*y8Q0NQojuTiN-eMJZYT9GQ.png" /><figcaption>Simplified diagram of the architecture</figcaption></figure><h4>Implementation</h4><ol><li><strong>Send video to the external service and await result asynchronously.</strong><br>Example of the JSON returned:</li></ol><pre>{<br>   &quot;averageElbowAngle&quot;: 84.7172239639953,<br>   &quot;averageMaxKneeAngle&quot;: 163.45883127356927,<br>   &quot;averageVerticalAngle&quot;: 0.029365070543177763,<br>   &quot;timestamps&quot;: [<br>   {<br>      &quot;timestamp&quot;: 1483,<br>      &quot;landmarks&quot;: [<br>        {<br>          &quot;name&quot;: &quot;left_wrist&quot;,<br>          &quot;x&quot;: 0.9977331161499023,<br>          &quot;y&quot;: 0.29992595314979553<br>        },<br>        {<br>          &quot;name&quot;: &quot;right_wrist&quot;,<br>          &quot;x&quot;: 0.9977331161499023,<br>          &quot;y&quot;: 0.29992595314979553<br>        },<br>        {<br>          &quot;name&quot;: &quot;left_knee&quot;,<br>          &quot;x&quot;: 0.9995927810668945,<br>          &quot;y&quot;: 0.46182650327682495<br>        },<br>        {<br>          &quot;name&quot;: &quot;right_knee&quot;,<br>          &quot;x&quot;: 0.9995927810668945,<br>          &quot;y&quot;: 0.46017447113990784<br>        },<br>        {<br>          &quot;name&quot;: &quot;left_ankle&quot;,<br>          &quot;x&quot;: 0.9837855100631714,<br>          &quot;y&quot;: 0.5427767634391785<br>        },<br>        {<br>          &quot;name&quot;: &quot;right_ankle&quot;,<br>          &quot;x&quot;: 0.9837855100631714,<br>          &quot;y&quot;: 0.541124701499939<br>        }<br>      ],<br>    },<br>  {<br>    &quot;timestamp&quot;: 1516,<br>    &quot;landmarks&quot;: [<br>      ...<br>    ],<br>  }]<br>}</pre><p><strong>2. Write Python code to handle the video processing</strong></p><p>The whole Python code has thousands and thousands of lines, so we will not put it all here, but here is a simplified example of how to draw vector lines over frames of the video, and save the resulting video + how to get the parameters for functions from Laravel to Python:</p><p><em>Packages</em></p><pre>[packages]<br>opencv-python = &quot;*&quot;<br>numpy = &quot;*&quot;<br>scipy = &quot;*&quot;<br>moviepy = &quot;*&quot;<br>scikit-image = &quot;*&quot;<br><br>[requires]<br>python_version = &quot;3.9&quot;</pre><p><em>src/Main.py</em></p><pre>#reading function parameters sent to AWS Lambda from Laravel<br>def handler(d, e):<br>    function_name = os.environ.get(&#39;VIDEO_FUNCTION_NAME&#39;)<br><br>    #there are multiple functions to handle multiple parts of the video in parallel<br>    #in this example, only 2 will be mentioned<br>    if function_name == &#39;RunningPersonWithSkeleton&#39;:<br>          return RunningPersonWithSkeleton(<br>                 d.get(&#39;runner_name&#39;),<br>                 d.get(&#39;annotation_json&#39;), #S3 URL to JSON from step 1<br>                 d.get(&#39;runology_score&#39;), <br>                 d.get(&#39;video_url&#39;), #S3 URL to original video<br>                 d.get(&#39;output_video_s3_bucket_path&#39;), #S3 URL where to save the finished video<br>                 d.get(&#39;callback_url&#39;), #Laravel API URL where to send notification after finish<br>                 d.get(&#39;error_callback_url&#39;), #Laravel API URL where to send notification after error<br>             ).process_video()<br>    elif function_name == &#39;RunningPersonWithArmSwing&#39;:<br>          return RunningPersonWithArmSwing(<br>                 d.get(&#39;runner_name&#39;),<br>                 d.get(&#39;annotation_json&#39;),<br>                 d.get(&#39;runology_score&#39;),<br>                 d.get(&#39;video_url&#39;),<br>                 d.get(&#39;output_video_s3_bucket_path&#39;),<br>                 d.get(&#39;callback_url&#39;),<br>                 d.get(&#39;error_callback_url&#39;),<br>             ).process_video()</pre><p><em>src/RunningPersonWithSkeleton.py</em></p><pre>import json<br>import time<br>import cv2<br>import numpy as np<br>from moviepy.editor import *<br>import os<br>import requests<br>from urllib.request import urlopen<br><br>class RunningPersonWithSkeleton:<br>    def __init__(<br>        self,<br>        runner_name,<br>        annotation_json,<br>        input_video_path,<br>        output_video_s3_bucket_path,<br>        callback_url,<br>        error_callback_url<br>    ):<br>       self.callback_url = callback_url<br>       self.error_callback_url = error_callback_url<br>       self.runner_name = runner_name<br>       self.input_video_path = input_video_path<br>       self.output_video_s3_bucket_path = output_video_s3_bucket_path<br>       #local URL in AWS Lambda where to download the original video from S3 before processing it<br>       #within Lambda, only the tmp folder is writable<br>       self.local_input_video_path = &#39;/tmp/original.mp4&#39; <br>       <br>       #local URL in AWS Lambda where to save the video before uploading it to AWS S3<br>       #within Lambda, only the tmp folder is writable<br>       self.local_output_video_path = &#39;/tmp/output&#39; + str(time.time()) + &#39;.mp4&#39;<br>       self.annotations = json.loads(urlopen(annotation_json).read())<br>     def process_video(self):<br>        try:<br>            #  Download the data behind the URL<br>            response = requests.get(self.input_video_path)<br>            #  Open the response generated into a new file in your local<br>            open(self.local_input_video_path, &quot;wb&quot;).write(response.content)<br>            video = VideoFileClip(self.local_input_video_path).without_audio()<br>            <br>            # compose video with skeleton, texts, etc.<br>            final_clip = self.compose_video_with_graphics(video)<br>            # slow down the video to 0.3x speed<br>            final_clip_slow_motion = final_clip.fx(vfx.speedx, 0.3)<br>            <br>            original_video = self.compose_original_video(VideoFileClip(self.local_input_video_path).without_audio())<br>            # compose final video with images and transition<br>            final_video = CompositeVideoClip([<br>                original_video,  # original video with skeleton<br>                final_clip_slow_motion.set_start(original_video.duration),  # slow motion video<br>            final_video.write_videofile(self.local_output_video_path, fps=self.fps, verbose=False, logger=None)<br>            VideoHelper.upload_to_s3(self.local_output_video_path, self.output_video_s3_bucket_path)<br>        except Exception as e:<br>            requests.post(self.error_callback_url, data={&quot;errors&quot;: str(e)})<br>            return None<br>        response = requests.post(self.callback_url, data={&quot;output_video_url&quot;: self.output_video_s3_bucket_path})<br>        return self.output_video_s3_bucket_path<br>    def compose_video_with_graphics(self, video):<br>        # make a video of only just skeleton and graphics<br>        graphics_clip_mask = VideoClip(lambda t: self.make_frame(t)[:, :, 3] / 255.0,<br>                                       duration=video.duration, ismask=True)<br>        graphics_clip = VideoClip(lambda t: self.make_frame(t)[:, :, :3],<br>                                  duration=video.duration).set_mask(graphics_clip_mask)<br>        # add Runology logo to upper right corner<br>        logo = self.video_helper.get_logo_for_video(video)<br>        # compose all layers on top of each other<br>        final_clip = self.video_helper.compose_video(<br>            video,<br>            graphics_clip.set_position((&#39;center&#39;, &#39;center&#39;)),<br>            logo,<br>        )<br>        return final_clip<br>    def make_frame(self, t):<br>        # we need milliseconds<br>        timestamp = t * 1000<br>        # surface for drawing all graphics<br>        surface = np.zeros((self.video_helper.original_video_height, self.video_helper.original_video_width, 4), dtype=np.uint8)<br>        # use OpenCV to draw lines<br>        # this is only a simplified example drawing one line from point &#39;first&#39; to point &#39;second&#39;<br>        # this data is taken from the JSON, but we will not show more here<br>        cv2.line(<br>            img=surface,<br>            pt1=(<br>                int(first[&#39;x&#39;] * self.annotation_helper.original_video_width),<br>                int(first[&#39;y&#39;] * self.annotation_helper.original_video_height),<br>            ),<br>            pt2=(<br>                int(second[&#39;x&#39;] * self.annotation_helper.original_video_width),<br>                int(second[&#39;y&#39;] * self.annotation_helper.original_video_height),<br>            ),<br>            color=self.video_helper.azure + (255,),<br>            thickness=self.stick_width<br>        )        <br>        return surface</pre><p><em>src/VideoHelper.py</em></p><pre>@staticmethod<br>    def upload_to_s3(local_output_video_path, output_video_s3_bucket_path):<br>        # upload to S3<br>        my_config = Config(<br>            region_name=os.environ.get(&#39;S3_AWS_DEFAULT_REGION&#39;),<br>            retries={<br>                &#39;max_attempts&#39;: 3,<br>                &#39;mode&#39;: &#39;standard&#39;<br>            }<br>        )<br>        s3 = boto3.client(<br>            &#39;s3&#39;,<br>            aws_access_key_id=os.environ.get(&#39;S3_AWS_ACCESS_KEY&#39;),<br>            aws_secret_access_key=os.environ.get(&#39;S3_AWS_SECRET_ACCESS_KEY&#39;),<br>            config=my_config,<br>        )<br><br>        try:<br>            with open(local_output_video_path, &quot;rb&quot;) as f:<br>                s3.upload_fileobj(f, os.environ.get(&#39;S3_AWS_BUCKET&#39;), output_video_s3_bucket_path)<br>        except ClientError as error:<br>            # Put your error handling logic here<br>            raise error<br>        except ParamValidationError as error:<br>            raise ValueError(&#39;The parameters you provided are incorrect: {}&#39;.format(error))</pre><p><strong>3. Create a Docker image for </strong><a href="https://aws.amazon.com/lambda/"><strong>AWS Lambda</strong></a></p><p>It is possible to run Python code without using Docker, using Lambda’s runtimes, but we opted for Docker because it was easier for us.</p><p><em>Dockerfile</em></p><pre>FROM --platform=linux/amd64 public.ecr.aws/lambda/python:3.9<br><br>#all linux packages that you need<br>RUN yum update --assumeyes &amp;&amp; yum install ffmpeg libsm6 libxext6 libgl1 mesa-libGL ImageMagick ImageMagick-devel  -y<br>#all Python packaged that you need<br>RUN pip install --no-cache-dir --upgrade pip &amp;&amp; \<br>    pip install --no-cache-dir numpy moviepy opencv-python pillow scikit-image<br>#copy the Python code<br>COPY assets assets #here we have images, etc.<br>COPY src src #here we have the Python code<br>COPY fonts fonts<br>CMD [ &quot;src/Main.handler&quot;] #here we link it to the Main.py&#39;s handler function which has been mentioned earlier</pre><p><strong>4. Upload the Docker image to </strong><a href="https://aws.amazon.com/ecr/"><strong>AWS ECR</strong></a></p><p><a href="https://aws.amazon.com/ecr/"><em>Amazon Elastic Container Registry</em></a> is a fully managed container registry that makes it easy to store, manage, share, and deploy your container images and artifacts anywhere.</p><p>Follow the current documentation as to how to upload your Docker image.</p><p><strong>5. Install Sidecar into Laravel</strong></p><p>Follow the current documentation: <a href="https://hammerstone.dev/sidecar/docs/main/installation">https://hammerstone.dev/sidecar/docs/main/installation</a>.</p><p><strong>6. Set up AWS Lambda</strong></p><p>Laravel Sidecar comes with an Artisan command to set up the connection to AWS Lambda, feel free to follow their documentation: <a href="https://hammerstone.dev/sidecar/docs/main/configuration">https://hammerstone.dev/sidecar/docs/main/configuration</a>.</p><p>To change the default memory and disk size used by Lambda and the architecture, fill in the <strong>sidecar.php</strong> config</p><pre>/*<br> * The default timeout for your functions, in seconds.<br> * This can be overridden per function.<br> */<br>&#39;timeout&#39; =&gt; env(&#39;SIDECAR_TIMEOUT&#39;, 15 * 60),<br><br>/*<br> * The default memory for your functions, in megabytes.<br> * This can be overridden per function.<br> */<br>&#39;memory&#39; =&gt; env(&#39;SIDECAR_MEMORY&#39;, 4196),<br><br>/*<br> * The default ephemeral storage for your functions, in megabytes.<br> * This can be overridden per function.<br> */<br>&#39;storage&#39; =&gt; env(&#39;SIDECAR_STORAGE&#39;, 512),<br><br>/*<br> * The default architecture your function runs on.<br> * Available options are: x86_64, arm64<br> */<br>&#39;architecture&#39; =&gt; env(&#39;SIDECAR_ARCH&#39;, Architecture::X86_64),</pre><p>The more memory and storage your Lambda functions are allowed to use, the more you will be billed by AWS. Therefore it is necessary to find the optimal ratio between price and performance for your use case.</p><p>We run 7 Lambda functions per one video analysis and the estimated average cost for one whole video analysis comes to about 0.05–0.08€.</p><p>The cost could be further lowered by using the <strong>AMD64</strong> architecture on AWS Lambda, which should be faster. However, the Docker image we created did not work with AMD64 arch and we would have to put in more time and resources into implementing and testing an AMD64 compliant Docker image.</p><p><strong>7.</strong> <strong>Implement the Sidecar LambdaFunctions</strong> following the documentation. Sidecar LambdaFunctions are the pieces which connect Laravel to AWS Lambda.</p><pre>&lt;?php<br><br>namespace App\Sidecar;<br><br>use Hammerstone\Sidecar\LambdaFunction;<br>use Hammerstone\Sidecar\Package;<br><br>class RunningPersonWithSkeleton extends LambdaFunction<br>{<br>    public function handler(): string<br>    {<br>        return Package::CONTAINER_HANDLER;<br>    }<br><br>    // here put the URL of the uploaded Docker image and its version<br>    public function package(): array<br>    {<br>        return [<br>            &#39;ImageUri&#39; =&gt; &#39;xxx.amazonaws.com/my-images:v1&#39;,<br>        ];<br>    }<br><br>    // variables that will be available to the Python script<br>    public function variables(): array<br>    {<br>        return [<br>            &#39;S3_AWS_DEFAULT_REGION&#39; =&gt; config(&#39;filesystems.disks.s3.region&#39;),<br>            &#39;S3_AWS_ACCESS_KEY&#39; =&gt; config(&#39;filesystems.disks.s3.key&#39;),<br>            &#39;S3_AWS_SECRET_ACCESS_KEY&#39; =&gt; config(&#39;filesystems.disks.s3.secret&#39;),<br>            &#39;S3_AWS_BUCKET&#39; =&gt; config(&#39;filesystems.disks.s3.bucket&#39;),<br>            &#39;VIDEO_FUNCTION_NAME&#39; =&gt; &#39;RunningPersonWithSkeleton&#39;,<br>        ];<br>    }<br>}</pre><pre>$result = App\Sidecar\RunningPersonWithSkeleton::executeAsEvent([<br>    &#39;annotation_json&#39; =&gt; $annotationJsonPath,<br>    &#39;video_url&#39; =&gt; $videoPath,<br>    &#39;runner_name&#39; =&gt; $videoAnalysis-&gt;user?-&gt;name ?? &#39;&#39;,<br>    &#39;output_video_s3_bucket_path&#39; =&gt; $videoAnalysis-&gt;s3_path.&#39;/skeleton.mp4&#39;,<br>    &#39;callback_url&#39; =&gt; URL::temporarySignedRoute(<br>        &#39;api.video.skeleton-finished&#39;, now()-&gt;addHours(1), [&#39;videoAnalysis&#39; =&gt; $videoAnalysis]<br>    ),<br>    &#39;error_callback_url&#39; =&gt; URL::temporarySignedRoute(<br>        &#39;api.video.skeleton-failed&#39;, now()-&gt;addHours(1), [&#39;videoAnalysis&#39; =&gt; $videoAnalysis]<br>    ),<br>]);</pre><p><strong>8. Create API endpoints in Laravel for the ping from AWS Lambda to handle success and failure. Instead of authentication we opted for temporarySignedUrls</strong></p><pre>&#39;callback_url&#39; =&gt; URL::temporarySignedRoute(<br>      &#39;api.video.skeleton-finished&#39;, now()-&gt;addHours(1), [&#39;videoAnalysis&#39; =&gt; $videoAnalysis]<br>),<br>&#39;error_callback_url&#39; =&gt; URL::temporarySignedRoute(<br>    &#39;api.video.skeleton-failed&#39;, now()-&gt;addHours(1), [&#39;videoAnalysis&#39; =&gt; $videoAnalysis]<br>),</pre><p><strong>9. And you are finished!</strong><br>Now you can send a notification to your user that the video analysis has been finished (or failed).</p><h4>Conclusion</h4><p>We only decided to share a few key points of the code, with the permission of our client and with subtle changes.</p><p>The purpose of this post was not to give a finished solution, but to share the architecture of one possible solution and to show by examples how we implemented some key aspects. However, if you have questions, we will be happy to answer them if possible!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=360b95d47a23" width="1" height="1" alt=""><hr><p><a href="https://blog.meetbrackets.com/video-manipulation-with-laravel-python-aws-lambda-360b95d47a23">Video manipulation with Laravel, Python &amp; AWS Lambda</a> was originally published in <a href="https://blog.meetbrackets.com/">BRACKETS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Customize User Model in Laravel]]></title>
            <link>https://blog.meetbrackets.com/how-to-customize-user-model-in-laravel-cf20865586b8?source=rss-a8e0ae529712------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf20865586b8</guid>
            <category><![CDATA[laravel-framework]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Kristina Odziomkova]]></dc:creator>
            <pubDate>Thu, 21 Mar 2024 14:20:05 GMT</pubDate>
            <atom:updated>2024-03-21T14:20:05.893Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M4p3x0FobrDK6ROjpJW9Hw.png" /></figure><p>Packages are the cornerstone of PHP and Laravel development. Without them, we would have to reinvent (or copy&amp;paste) the wheel for every single project. However, a package may not fully meet all your needs, so it’s important that they are well-built and easily customizable.</p><p>One of the very well-known and one of our favorite packages is the Laravel-medialibrary from Spatie (<a href="https://spatie.be/docs/laravel-medialibrary/introduction">Introduction | laravel-medialibrary</a> ). The main model the package works with is called Media. 90% of the time, it fulfills all of our project’s needs, but for the remaining 10% we need to extend or tweak its functionality and that’s where the “swappability” feature comes into play.</p><p>If you are interested in how it’s implemented, feel free to head to its source code and browse. We will mention a simplified version of how we did it for our package further in this article.</p><p>One of the most important out-of-the-box models in Craftable PRO is definitely the <em>CraftableProUser</em>, which is the default authenticatable model. In the beginnings of the package history, however, it used to reside inside the vendor package and be hard-coded in many places of the codebase — and attempting to extend its functionality or swap it for a different model would have proved to be a great challenge.</p><p>We have implemented this feature recently and it turned out to be easier than expected.</p><p>The gist of it is as follows:</p><p>1. Add an attribute to config for the model’s class name:</p><pre>&#39;craftable_pro_user_model&#39; =&gt; Brackets\CraftablePro\Models\CraftableProUser::class</pre><p>2. Create a base model which contains only the necessary code without which the package would not function:</p><pre>&lt;?php<br>namespace Brackets\CraftablePro\Models;<br><br>use Brackets\CraftablePro\Helpers\Initials;<br>use Illuminate\Database\Eloquent\Casts\Attribute;<br>use Illuminate\Database\Eloquent\SoftDeletes;<br>use Illuminate\Foundation\Auth\User as Authenticatable;<br>use Spatie\Permission\Traits\HasRoles;<br>class BaseCraftableProUser extends Authenticatable<br>{<br>    use HasRoles;<br>    <br>    protected $guard = &#39;craftable-pro&#39;;<br>    protected $fillable = [<br>        &#39;first_name&#39;,<br>        &#39;last_name&#39;,<br>        &#39;email&#39;,<br>    ];<br>    protected function initials(): Attribute<br>    {<br>        return Attribute::make(<br>            get: fn ($value) =&gt; Initials::new()-&gt;generate($this-&gt;first_name . &#39; &#39; . $this-&gt;last_name)<br>        );<br>    }<br>}</pre><p>3. Replace all hard-coded mentions of the model with the config value. Instead of:</p><pre>$user = CraftableProUser::updateOrCreate([<br>  &#39;email&#39; =&gt; $email,<br>], [<br>  &#39;first_name&#39; =&gt; &#39;Administrator&#39;,<br>]</pre><p>do:</p><pre>$user = config(&#39;craftable-pro.craftable_pro_user_model&#39;)::updateOrCreate([<br>  &#39;email&#39; =&gt; $email,<br>], [<br>  &#39;first_name&#39; =&gt; &#39;Administrator&#39;,<br>]</pre><p>Now, let’s go and see how this new feature can be configured and used within Craftable Pro. For a quicker overview, the official documentation is located here: <a href="https://docs.craftable.pro/basic-features/users#custom-user-model">Users — Craftable PRO Documentation</a></p><p><em>Task: add a full_name attribute and a teams relationship to the authenticatable user model without having to rewrite any package code.</em></p><p><strong>Step 1. Create a new Eloquent model extending the base class</strong></p><pre>&lt;?php<br><br>namespace App\Models;<br><br>use Brackets\CraftablePro\Models\BaseCraftableProUser;<br><br>class AdminUser extends BaseCraftableProUser<br>{<br>    protected $table = &#39;craftable_pro_users&#39;;<br>}</pre><p>It can also be called the same as the original <em>CraftableProUser</em> model, since it is in a different namespace. Despite that, we will call it <em>AdminUser</em> for clarity.</p><p>If you want to keep using the underlying <em>craftable_pro_users</em> database table, you have to specify it because it does not get inherited from the base model.</p><p><strong>Step 2. Register the new model in the <em>config/craftable-pro.php</em> file</strong></p><p>If you don’t see the <em>config/craftable-pro.php</em> file, it first has to be published through the <em>php artisan vendor:publish — tag=craftable-pro-config</em> command.</p><pre>return [<br>    /*<br>     * The fully qualified class name of the Craftable Pro user model.<br>     */<br>    &#39;craftable_pro_user_model&#39; =&gt; App\Models\AdminUser::class,<br>    ...<br>];</pre><p><strong>Step 3. Configure the guards and auth providers in <em>config/auth.php</em> file:</strong></p><p>Unfortunately (but understandably) there is no way to use a config value from one config file within another config file, so we have to specify the new model here as well.</p><pre>use App\Models\AdminUser;<br><br>return [<br>  &#39;providers&#39; =&gt; [<br>        &#39;craftable-pro-users&#39; =&gt; [<br>            &#39;driver&#39; =&gt; &#39;eloquent&#39;,<br>            &#39;model&#39; =&gt; MyCraftableProUser::class,<br>        ],<br>  ],<br>  &#39;guards&#39; =&gt; [<br>        &#39;craftable-pro&#39; =&gt; [<br>            &#39;driver&#39; =&gt; &#39;session&#39;,<br>            &#39;provider&#39; =&gt; &#39;craftable-pro-users&#39;,<br>        ],<br>  ],<br>  ...<br>]</pre><p><strong>Step 4. Customize the new <em>AdminUser</em> model however you like</strong></p><p>Add attributes, relationships, appends, eager loading… — whatever you want.</p><pre>&lt;?php<br><br>namespace App\Models;<br><br>use Brackets\CraftablePro\Models\BaseCraftableProUser;<br>use Illuminate\Database\Eloquent\Relations\BelongsToMany;<br><br>class AdminUser extends BaseCraftableProUser<br>{<br>    protected $table = &#39;craftable_pro_users&#39;;<br>    public function __construct(array $attributes = [])<br>    {<br>        parent::__construct($attributes);<br>        $this-&gt;appends = [...parent::getAppends(), &#39;full_name&#39;];<br>        $this-&gt;with = [&#39;teams&#39;];<br>    }<br>    public function getFullNameAttribute(): string<br>    {<br>        return $this-&gt;first_name . &#39; &#39; . $this-&gt;last_name;<br>    }<br>    public function teams(): BelongsToMany<br>    {<br>        return $this-&gt;belongsToMany(Team::class);<br>    }<br>}</pre><p><strong>Step 5a. Update data in the database where necessary, mainly in polymorphic relationships:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*P0MgwcpgMjNKvfCicrrq7Q.png" /></figure><p>to</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*fF9YUuht84WZvAs6WaFxng.png" /></figure><p><strong>Step 5b. If you are already using Laravel’s morph map, update the model class name instead:</strong></p><pre>Relation::morphMap([<br>  &#39;CraftableProUser&#39; =&gt; CraftableProUser::class<br>])</pre><p>to</p><pre>Relation::morphMap([<br>  &#39;CraftableProUser&#39; =&gt; App\Models\AdminUser::class<br>]);</pre><h3>Customizing the user listing</h3><p>To customize the user listing (Access tab), it is necessary to first copy the vue code from <em>vendor/brackets/craftable-pro/resources/js/Pages/CraftableProUser/Index.vue</em> and replace with it the code in <em>resources/js/craftable-pro/Pages/CraftableProUser/Index.vue</em> as the originally published<em> resources/js/craftable-pro/Pages/CraftableProUser/Index.vue</em> file is only a stub that links to the vendor file.</p><p>Let’s replace the name with the new <em>full_name</em> attribute:</p><pre>&lt;ListingDataCell&gt;<br>    &lt;div class=&quot;flex items-center&quot;&gt;<br>        &lt;Avatar<br>            :src=&quot;item.avatar_url&quot;<br>            :name=&quot;`${item.first_name} ${item.last_name}`&quot;<br>        /&gt;<br>        &lt;div class=&quot;ml-4&quot;&gt;<br>            &lt;div class=&quot;font-medium text-gray-900&quot;&gt;<br>                &lt;!-- TODO: maybe have full_name attribute? --&gt;<br>                {{ item.first_name }} {{ item.last_name }}<br>            &lt;/div&gt;<br>            &lt;div class=&quot;text-gray-500&quot;&gt;{{ item.email }}&lt;/div&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>&lt;/ListingDataCell&gt;</pre><p>This code can now be refactored as such:</p><pre>&lt;ListingDataCell&gt;<br>    &lt;div class=&quot;flex items-center&quot;&gt;<br>        &lt;Avatar<br>            :src=&quot;item.avatar_url&quot;<br>            :name=&quot;item.full_name&quot;<br>        /&gt;<br>        &lt;div class=&quot;ml-4&quot;&gt;<br>            &lt;div class=&quot;font-medium text-gray-900&quot;&gt;<br>                {{ item.full_name }}<br>            &lt;/div&gt;<br>            &lt;div class=&quot;text-gray-500&quot;&gt;{{ item.email }}&lt;/div&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>&lt;/ListingDataCell&gt;</pre><p>Don’t forget to run the <em>npm run craftable-pro:build</em> command and you are done!</p><p>In summary, packages are vital components in PHP and Laravel development, streamlining processes and saving valuable time by providing pre-built functionalities.</p><p>The recent integration of this feature into Craftable PRO, particularly with the CraftableProUser model, highlights the importance of well-designed and adaptable packages. What was once a complex task has now become manageable, thanks to thoughtful design and implementation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf20865586b8" width="1" height="1" alt=""><hr><p><a href="https://blog.meetbrackets.com/how-to-customize-user-model-in-laravel-cf20865586b8">How to Customize User Model in Laravel</a> was originally published in <a href="https://blog.meetbrackets.com/">BRACKETS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to become a Software Engineer in 14 days*]]></title>
            <link>https://blog.meetbrackets.com/how-to-become-a-software-engineer-in-14-days-be5b21d70401?source=rss-a8e0ae529712------2</link>
            <guid isPermaLink="false">https://medium.com/p/be5b21d70401</guid>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[women-in-tech]]></category>
            <dc:creator><![CDATA[Kristina Odziomkova]]></dc:creator>
            <pubDate>Thu, 08 Sep 2022 08:29:55 GMT</pubDate>
            <atom:updated>2022-11-02T19:19:35.182Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d031CGVYh1oN83ClTGCHzQ.jpeg" /></figure><h4>The One with the Imposter Syndrome, Foosball and Becoming a Senior Web Developer by Accident. Aaand friends... I mean the F*R*I*E*N*D*S</h4><p><em>*applies only if you live on </em><a href="https://www.universetoday.com/14282/how-long-is-a-day-on-venus/"><em>Venus</em></a><em>. Please don’t look for shortcuts, because you won’t really find any. All good things take time. :)</em></p><p>Once upon a time, exactly ten years ago, the main protagonist of this story was just starting her senior year of high school. The year of your life, when it’s high time to finally start thinking about your future career (unless you have known since child what you want to be when you grow up). In the meantime, you start to prepare for your <strong>high school graduation</strong> exams at the end of the year — in her case, four years’ worth of four subjects of own choosing. Aspiring doctors and medical professionals usually pick Biology and Chemistry. Future physicists will probably choose Physics and Math. But what does one choose if they still don’t know what they want to do with their life?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*u94JiJ0wtF_Qzw16AYPd7Q.gif" /></figure><p>That person was (obviously) me and she had no idea that in ten years she would be where she is now, and writing about it.</p><p>I have always excelled in STEM subjects — my favorite was Math and Physics, and I never enjoyed subjects where not logic, but memorization, was key — such as History and Literature. I do love to read — but only books and topics of my own choosing. I do not really care about what this one author in this one hundred-year-old book meant by this one obscure sentence, which could have been explained in ten different ways by ten different people.</p><p>In the prior year I had also fallen in love with Psychology while spending my junior year at a high school in the U.S. It was a subject that had not been taught in my home high school, unfortunately. Surprisingly, there also wasn’t any mandatory computer class — and that is why I never considered going into I.T. in the first place.</p><p>Based on my interests, I was considering going into Astrophysics, Math or Psychology, but my ambitions were too high. I only applied to prestigious UK universities and the ones that even bothered to reply to me told me, that I would need to get the highest grades on my final exams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*62x9BDnzuK95aIr5Lpecew.gif" /></figure><p>I decided on taking the English, Math and Geography exam, alongside the mandatory Slovak language exam. Why Geography and not Physics? Because it was a much easier subject. :)</p><p>Unfortunately, during the oral exams I drew one of the 2–3 questions out of 30 that I wasn’t very good at. I ended up with a one level lower grades both in Slovak and Geography. Such grades would still make most people happy, but for me, they closed all the doors that I had previously managed to put my foot in. Understandably I was devastated and all the effort I had put into preparing for the final exams seemed futile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Valgr3KvTSu4Ih64h1zVnQ.gif" /></figure><p>The even worse thing was that most universities in my country only had been accepting applications until end of March and it was way too late to apply for them, unless I wanted to skip a year and start later. My best friend and I did toy around with the thought of taking a break for one year, going to work abroad and then coming back and start university, but I wasn’t sure if I would be able to go back to studying after that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*HXPqxJUyXidQq2tJoQ9J_A.gif" /></figure><p>Fortunately, my best friend was smarter than me and knew all about the local universities and their deadlines. She pointed me in the direction of the Slovak University of Technology, which was accepting applications until late summer. She had applied for Applied Informatics and so had I, but in a different faculty. By then I still did not know much about computer science, but the faculty where I applied to had also been the Alma Mater for both my parents — so I knew it was a good choice nonetheless.</p><p><strong>Applied informatics</strong> was a course where they took anyone who applied, without any entry exams, but it was so much harder to stay there past the first semester. I think half of the people dropped out by then, but not me!</p><p>For the first two years I was learning a lot of different topics in diverse subjects, but I still knew very little about coding and which way I eventually wanted to go. We did everything in Java, C and MatLab and honestly, I wasn’t too excited about any of them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*HEs8Lrw46JP8aAr_l8HxOw.gif" /></figure><p>In the third year, we had the first web development course in PHP and even though the lecture slides were all written in colorful comic sans font which made my head hurt, I almost instantly — for some reason — decided that this is what I want to do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*bgRqNQMZ_8NPVbxXv3ywgQ.gif" /><figcaption>You might not believe me, but this is pretty much how the lecture slides for my PHP class looked like (sans the cool animation).</figcaption></figure><p>It was just a basic introduction so by the end of the year, I wasn’t very good in PHP and truthfully also not in any other language. I decided to code my bachelor thesis in C++ (why, oh god, why? It might be a good language but not when you have almost never used it before and now your whole thesis depends on it.)</p><p>Somehow, I managed not to butcher my C++ code and it actually kind of worked good enough that I wrote my thesis about the results and I passed, getting my <strong>Bachelor’s degree</strong>.</p><p>I decided to continue with the <strong>Master’s</strong> in the same field, because I wanted the engineering Master’s title and I still didn’t feel smart enough to drop out and find a full-time job as a developer.</p><p>This was about the time when the <strong>imposter syndrome</strong> really set in. After three years of university, many of my classmates were already good at least in one technology and working in real jobs. I felt like I would never be good enough to actually find a job in this field — there are quite a few anecdotal evidences of people who excelled in school but not in the professional life. And I started to think that I was going to be one of them.</p><p>However, I don’t like to give up so quickly, so I applied for a few part-time junior roles during our yearly <strong>job market</strong> at school. We mostly went to the job fairs for the cool swag and stickers they were giving out but at the end of my third year I decided to take it seriously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*XHfANkn1_us4mFgD1cUunw.gif" /></figure><p>As usual, I was hoping for the best but expecting the worst. My expectations were not met and I actually got one job offer! It was not a PHP role, but a Junior Java developer — and I took it.</p><p>I was very excited and even more so when my friend from university joined me in the same company. I was assigned to an internal project and my goal was to create an app for the recruiters. I did start some work in Java — such as some small app to read and parse emails from applicants, but later, we decided we are going to make a web app and to do it in PHP! Strangely enough, no one else in the company was doing PHP, just me, and I was very junior in it. My mentor knew PHP but he was mostly working with C#.</p><p>We decided to take one old open-source project and build on top of it. It was plain PHP without any framework, and the code was written in 2005 (I was just 10 years old in 2005!). Even though I would not touch such code even with a 5 feet long pole today, unless absolutely necessary, back then it was my first real project in PHP and I was very happy. In the end we managed to create a usable product. Although probably not very maintainable anymore, after I left.</p><p>The only skill I improved there more than coding was playing foosball. If you practice something for two years, multiple times a day, 5 days a week, you are bound to see some results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*vypqz8FoaBVrFZjwQ2ZqhA.gif" /></figure><p>Unfortunately, I had to leave this company and its fabulous foosball table, because they were not focused on the kind of web development that I wanted to do. Around this time I was working on and finishing my Master thesis with my team, and this time we used PHP and <strong>Laravel</strong>. Laravel was completely new to me and I had some problems with it in the beginning, but then I began to like it.</p><p>My second job was all about Laravel and web development and I spent 1.5 years there, most of it full-time after finishing university. The company was specializing on fintech solutions and after some time I decided that it was not something that I wanted to do.</p><p>I met my current company —<a href="https://brackets.sk/"> BRACKETS </a>— at a public <strong>Bratislava Laravel Meetup </strong>(where my previous company sent me, by the way 🤭) that they organize every year.</p><p><a href="https://www.facebook.com/events/354667113304821">Laravel Meetup 2022</a></p><p>A few weeks later I applied to work for them. I was quite surprised that they gave me an offer because they mostly hired seniors and I was far away from being one. Overjoyed, I took the position and today marks two years and eight months since I started working there, with no plan of going anywhere else. :) (Even though we don’t have a super cool foosball table 🥲, but we do have Mölkky 🤩)</p><p>It took me many months and a few projects to start feeling like I could also rely on myself and my ideas, and not just blindly follow others. With every project, every new technology and every successful deploy, I was feeling more confident in my skills and the <strong>imposter syndrome</strong> was starting to lose its grip on me. As time passed, I have been asked to make a few presentations, both for my colleagues and the public Laravel Meetup, and people started coming to me to ask for help, instead of just the other way around. I have also completed a few personal projects in my free time for friends and acquaintances, which helped them make their jobs easier and less repetitive.</p><p>So I guess the answer to beating the imposter syndrome is confidence in your own skills, taking pride in your work and seeing the product of your labor being used in real life and actually being beneficial to others.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*QCks4cIzllXVqUltOeecpw.gif" /></figure><p>And that is the story about how I accidentally landed a career that I never considered, but which ended up being the one most suited for me.</p><p>Software development is not all sunshine and roses and it is definitely not suited for everyone, but it has given me a lot of things —</p><p>— in no particular order:</p><ol><li>the freedom to solve real life problems for me and people around me to make our lives a bit easier</li><li>flexible work schedule and work place</li><li>exceptional financial compensation so I can support my travel and sport dreams</li><li>skilled and smart team of co-workers around me</li><li>traveling for team-buildings and software conferences to new places</li><li>self-confidence and pride in my skills</li><li>still a work in progress, but my stage fright from presenting in front of a crowd of people has gotten to a manageable level</li></ol><p>If you or anyone in your life is at the same place where I was ten years ago, feel free to share this with them or ask me any questions. I’ll be there for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*PKF4lef8YgIWyXs1kMrqVg.gif" /></figure><p>(Do I love Friends? Oh yes, yes I do.)</p><p><strong>And by the way, we are based in Slovakia and we are hiring — check out our </strong><a href="https://brackets.sk/culture#hiring"><strong>open positions</strong></a><strong> to learn more!</strong></p><p>This blog post did not start as a promo to our current hiring phase, but I decided to include it, because I really want to see our team grow. You don’t have to be the next Google dev star and we won’t ask you to invert a binary tree on a whiteboard during the interview. We like to teach people everything we know and we will not fire you if you crash a production by mistake (please don’t do it on a Friday afternoon though).</p><p>Remote work is an option too — I spend most of my time on remote, but it is always a lot of fun to pop into the office for a day, talk with colleagues in person instead of on video, share a company breakfast together and listen to some questionable music choices we make (Christmas music in July is one of our LESS questionable choices) ❤️.</p><p>Take a shot even if your imposter syndrome tells you not to, and maybe by this time next year, you will be on the plane to Belgium (or anywhere else) with us for our next <a href="https://fullstackeurope.com/2022">Full Stack Europe</a> 2023 conference. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be5b21d70401" width="1" height="1" alt=""><hr><p><a href="https://blog.meetbrackets.com/how-to-become-a-software-engineer-in-14-days-be5b21d70401">How to become a Software Engineer in 14 days*</a> was originally published in <a href="https://blog.meetbrackets.com/">BRACKETS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing external APIs (in Laravel)]]></title>
            <link>https://blog.meetbrackets.com/implementing-external-apis-in-laravel-96a46473fb7a?source=rss-a8e0ae529712------2</link>
            <guid isPermaLink="false">https://medium.com/p/96a46473fb7a</guid>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Kristina Odziomkova]]></dc:creator>
            <pubDate>Tue, 14 Jun 2022 09:29:07 GMT</pubDate>
            <atom:updated>2022-06-16T08:47:29.663Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FPrYqhMbx24591TGjOFbVA.jpeg" /></figure><p>If you ever had to implement an external API (in Laravel) and later had to rewrite half of your codebase because the external API had to be swapped for a different one, this article might interest you.</p><p><em>Some of the concepts mentioned in this article may be unique to Laravel, but the core idea should be possible to replicate in other languages and technologies. Technologies used here are PHP8.1 and Laravel 9.</em></p><h4>Imagine you have an app where you need to implement an external API that provides financial information, e.g. mortgage offers. There are many such APIs available and your client might change their mind about which one to use 6 months down the road (or 1 month, based on a true story).</h4><p>You want to implement two methods — get offers for mortgages, and mortgage refinancing. The most basic, yet suboptimal way, might look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*acgeX4xktaFh1ZF5W81uWg.png" /></figure><p><strong>What is so bad about it?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WVfBBQpLSxhZuqq6ZeceRQ.png" /></figure><ul><li><strong>Implementing API straight from controller <br></strong>- no code reusability<br>- external API is not contained in one place but many controllers/methods<br>- it would be time-consuming to refactor or to replace with different data provider (if we had more than two methods of course)</li><li><strong>Hard-coded URLs</strong><br>- URLs should be in one place, e.g. config + .env, not scattered throughout the codebase</li><li><strong>Returning data with no defined structure</strong><br>- we don’t know on first sight what data is returned<br>- associative arrays are also not a good approach here — we can’t define/type-hint what’s inside them<br>- passing data from method to method without known structure is chaotic and hard to follow</li><li><strong>Difficult to switch API service for testing service</strong><br>- sometimes we cannot access external API from localhost/tests, so we want to mock it with test data<br>- sometimes we want to switch one API provider for another API<br>provider without having to refactor half of the codebase</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F13HgwGsXF0aiGY%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F13HgwGsXF0aiGY%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExamJ2aDR3YWNvazltZ243MzA5Y2UxNWtvcmN2aHNkd2s0cDdoejYxciZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2F13HgwGsXF0aiGY%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/36bab17e7cb6b5565e779b07f2d18b53/href">https://medium.com/media/36bab17e7cb6b5565e779b07f2d18b53/href</a></iframe><p>Here is the solution that I keep using across many projects and that has been working really well for me.</p><p><em>Disclaimer: all this code has been copied from my company’s real working project and simplified for the purposes of this article, but the simplified version has not been tested — there might be some overlooked (e.g. syntax) errors. This article is more about the concept, not about copy-pasting the code and expecting it to run on the first try.</em></p><ol><li><strong>Create an interface that will be implemented by all data providers that provide mortgage data</strong></li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf1b3d248b6c8da14eb7e1e6bc53c1a7/href">https://medium.com/media/cf1b3d248b6c8da14eb7e1e6bc53c1a7/href</a></iframe><p>2. <strong>Create a data transfer object for mortgage data</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/403d737d392bb305c66121fe41eb6334/href">https://medium.com/media/403d737d392bb305c66121fe41eb6334/href</a></iframe><p>3. <strong>(Optional) Implement a NullObjectProvider</strong> — read more about <em>Null Object Design Pattern</em> if unsure what it is good for</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/345dac3f284288102183aa78ab29e35b/href">https://medium.com/media/345dac3f284288102183aa78ab29e35b/href</a></iframe><p>4. <strong>(Optional) Implement a TestingProvider</strong> — you can use it in tests if you do not want to or cannot access the external API from them.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/33602dac785bfe67100a6011674eb875/href">https://medium.com/media/33602dac785bfe67100a6011674eb875/href</a></iframe><p>5. <strong>Implement the actual external API</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ccd3ecfa53ae7667fc6be386dd0adf4/href">https://medium.com/media/2ccd3ecfa53ae7667fc6be386dd0adf4/href</a></iframe><p>6. <strong>Bind the desired implementation in a service provider </strong>— create a new service provider or put it into the existing <em>AppServiceProvider</em>. I created a new one because we implemented multiple different data services, not just one.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb4753168e6df83e2b95bf001d635ed9/href">https://medium.com/media/eb4753168e6df83e2b95bf001d635ed9/href</a></iframe><p>7. <strong>Create a config file</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2590a44189d5ddcd50aab1fc8d246090/href">https://medium.com/media/2590a44189d5ddcd50aab1fc8d246090/href</a></iframe><p>8. <strong>Use it in your code — </strong>use dependency injection to inject the bound implementation</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83402fb434a20a7f7408ec5de60a64ed/href">https://medium.com/media/83402fb434a20a7f7408ec5de60a64ed/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FkAtRPQd4pB4sOcikgd%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FkAtRPQd4pB4sOcikgd%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FkAtRPQd4pB4sOcikgd%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/d5fea1db893b9bcc68a215b72519990e/href">https://medium.com/media/d5fea1db893b9bcc68a215b72519990e/href</a></iframe><p><strong>Using TestingProvider with PHPUnit</strong></p><p>You can set the .env variable MORTGAGE_OFFER_PROVIDER in the <em>/phpunit.xml</em> file if you only want to use the testing provider for tests</p><pre>&lt;?<em>xml version</em>=&quot;1.0&quot; <em>encoding</em>=&quot;UTF-8&quot;?&gt;<br>&lt;phpunit ...&gt;<br>    &lt;testsuites&gt;<br>        ...<br>    &lt;/testsuites&gt;<br>    &lt;coverage&gt;<br>        ...<br>    &lt;/coverage&gt;<br>    &lt;php&gt;<br>        &lt;server <em>name</em>=&quot;APP_ENV&quot; <em>value</em>=&quot;testing&quot;/&gt;<br>        ...<br>        &lt;server <em>name</em>=&quot;MORTGAGE_OFFER_PROVIDER&quot; <em>value</em>=&quot;testing&quot;/&gt;<br>    &lt;/php&gt;<br>&lt;/phpunit&gt;</pre><p>If you also run your tests in a pipeline, e.g. on Bitbucket, you can set it in the <em>/phpunit.bitbucket.xml</em> file the same way.</p><p>Next meeting with the client:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F7GyRl9X7n7Lta6z8gb%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F7GyRl9X7n7Lta6z8gb%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F7GyRl9X7n7Lta6z8gb%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/48c890fc3a79e63276ced35206ef671d/href">https://medium.com/media/48c890fc3a79e63276ced35206ef671d/href</a></iframe><p>Client wants to use a different external API because they found out the current one does not provide reliable data?</p><p>All you have to do now is to:</p><ol><li>create a <strong>new</strong> data provider class implementing the interface</li><li>implement the methods inside it according to the new external API specification</li><li><strong>bind it</strong> in the service provider</li><li>change one value in .env/config</li></ol><p>and you are done! You don’t have to change any existing code! (Unless you want to remove the old implementation because you know it will never be used again.)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxUPOqo6E1XvWXwlCyQ%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxUPOqo6E1XvWXwlCyQ%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExNnZmMGkybWQzMGxqbWNtejJvYWZzN2RtM2RlNXdnZjYxbjM2MzRnbiZlcD12MV9naWZzX2dpZklkJmN0PWc%2FxUPOqo6E1XvWXwlCyQ%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="246" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab3d48bd3fbdcae6d99d106825df15e0/href">https://medium.com/media/ab3d48bd3fbdcae6d99d106825df15e0/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96a46473fb7a" width="1" height="1" alt=""><hr><p><a href="https://blog.meetbrackets.com/implementing-external-apis-in-laravel-96a46473fb7a">Implementing external APIs (in Laravel)</a> was originally published in <a href="https://blog.meetbrackets.com/">BRACKETS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One way to work with money in PHP/Laravel]]></title>
            <link>https://blog.meetbrackets.com/one-way-to-work-with-money-in-php-laravel-bf49d8946213?source=rss-a8e0ae529712------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf49d8946213</guid>
            <category><![CDATA[currency]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[money]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Kristina Odziomkova]]></dc:creator>
            <pubDate>Mon, 16 May 2022 08:06:46 GMT</pubDate>
            <atom:updated>2022-06-16T08:55:44.717Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UI6OymIpyoecQCdF7W9dzA.jpeg" /></figure><h3>Bill Karwin on Twitter: &quot;If I had a dime for every time I&#39;ve seen someone use FLOAT to store currency, I&#39;d have $999.997634. #ieee754jokes / Twitter&quot;</h3><p>If I had a dime for every time I&#39;ve seen someone use FLOAT to store currency, I&#39;d have $999.997634. #ieee754jokes</p><p>At some point, probably most of us have had to work with monetary values in our applications. There is a lot of debate on how to do it right, but the consensus is clear — <strong>never use floats and floating-point arithmetic</strong>. That’s how you wind up with dissatisfied clients on your back, demanding to know why buying two products priced 149.99€ + 159.99€ is asking their clients to pay 309.99€ instead of 309.98€. You would not trust such an app (or worse, the whole company), would you?</p><p>After I indirectly learned from one such mistake, for my next project I decided to go with <strong>integers</strong> — storing monetary values in cents and only formatting them into decimals in client exports or on the front-end.</p><p>I still was not a very experienced developer, and I did not use any special types or objects to represent the money, only primitive integers. That is how I wound up with many <strong>confusing helper functions</strong>, such as</p><pre><strong>denominate_currency</strong>(float $value, Currency <em>$currency</em>): int</pre><p>and</p><pre><strong>undenominate_currency</strong>(int $value, Currency <em>$currency</em>): float</pre><p>which were handling conversions.</p><p>I have not yet run into a problem with precision and rounding with this approach, so I must have done something right. However, <strong>the code is not very clean</strong> and I often have to think whether the value I am working with is in cents or not. It is also confusing for the front-end developers using the GraphQL API — all they see is an <strong>Int</strong> type — so they have to guess from the attribute’s name whether it is money, or just a regular integer value.</p><p>Two years later, a little bit smarter and more experienced, I got assigned to another project which dealt with financial data. I was about to implement a backend for a financial tool which needed to calculate loans, investments, and more.</p><p>I decided to use the <strong>Money PHP library, </strong>which under the hood uses the PHP extension <em>BCMath.</em></p><blockquote><em>BCMath </em>supports numbers of any size and precision up to 2147483647 (or 0x7FFFFFFF) decimal digits, if there is sufficient memory, represented as strings.</blockquote><p><a href="https://github.com/moneyphp/money">GitHub - moneyphp/money: PHP implementation of Fowler&#39;s Money pattern.</a></p><p>Here’s what I have done:</p><h4>1. Set up the database money fields to use big integers</h4><pre><em>$table</em>-&gt;bigInteger(&#39;payment_per_term&#39;);</pre><h4>2. Cast Eloquent models’ attributes to Money objects</h4><p>If you try to save a Money attribute but supply a string / float / integer, Laravel will let you know about your mistake.</p><p><strong>MoneyCast.php </strong>— custom cast (we only use one currency (EUR) in this project)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/358ecd05109178a6233585c4d08258b1/href">https://medium.com/media/358ecd05109178a6233585c4d08258b1/href</a></iframe><p><strong>Use it in models</strong></p><pre><em>class </em>Product<br>{<br>    <em>protected </em>$casts = [<br>        &#39;payment_per_term&#39; =&gt; MoneyCast::<em>class</em>,<br>    ];<br>}</pre><h4>3. Use it in calculations, input and return types</h4><pre><em>public function </em>calculateCofinancing(<br>   Money <em>$loanValue</em>, <br>   Money <em>$necessaryValue<br></em>): Money {<br>    $value = <em>$necessaryValue</em>-&gt;subtract(<em>$loanValue</em>);<br><br>    <em>return </em>$value-&gt;lessThanOrEqual(Money::EUR(0)) <br>       ? Money::EUR(0) <br>       : $value;<br>}</pre><p>I really like this approach, even if it’s sometimes less readable:</p><pre>// compare </pre><pre>($a + $b)/$c</pre><pre>// vs.</pre><pre>$a-&gt;add($b)-&gt;divide($c)</pre><p>For complex calculations, however, I had to use a different approach. When I was calculating compound interest formula and doing all calculations with the Money objects, the amounts always got <strong>rounded to whole cents</strong> after each calculation. By the end result, it was off by many cents or even euros.</p><p>That’s why I refactored my function to directly use BCMath functions and suddenly, my results were exact. All the nested BCMath functions might seem chaotic or confusing, but with a little bit of commenting and time, it should be easy to understand them.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e55b383fd14d0aff868bad1c2104c07f/href">https://medium.com/media/e55b383fd14d0aff868bad1c2104c07f/href</a></iframe><p>Because of my direct approach, I had to round the end results manually, before passing it into a Money constructor. BCMath was missing the functionality needed for this, so I also had to install one more library:</p><p><a href="https://github.com/krowinski/bcmath-extended">GitHub - krowinski/bcmath-extended: Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers. Also wraps existing BCMath functions.</a></p><p><strong>Final words</strong>: this approach worked for me because I only had to work with one currency, and did not need smaller fractions of currency than whole cents. Multi-currency approach should not be too difficult to implement, if needed, but for smaller fractions of currency than whole cents, I cannot yet recommend this approach, because I have not tried it.</p><p>If only the Money library had some nice way to work with unrounded values until the very end of the calculation. Or maybe it does and I am not just using it completely correctly. :) What are your experiences with this or other approaches of working with money?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf49d8946213" width="1" height="1" alt=""><hr><p><a href="https://blog.meetbrackets.com/one-way-to-work-with-money-in-php-laravel-bf49d8946213">One way to work with money in PHP/Laravel</a> was originally published in <a href="https://blog.meetbrackets.com/">BRACKETS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>