<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hamza</title>
    <description>The latest articles on DEV Community by Hamza (@hamzatopo).</description>
    <link>https://dev.to/hamzatopo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F279771%2F00688416-efc6-4218-926f-dc68a555bd51.png</url>
      <title>DEV Community: Hamza</title>
      <link>https://dev.to/hamzatopo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hamzatopo"/>
    <language>en</language>
    <item>
      <title>I built SketchStash — a small tool to store terminal commands and dev snippets</title>
      <dc:creator>Hamza</dc:creator>
      <pubDate>Sun, 15 Mar 2026 04:52:27 +0000</pubDate>
      <link>https://dev.to/hamzatopo/i-built-sketchstash-a-small-tool-to-store-terminal-commands-and-dev-snippets-17n3</link>
      <guid>https://dev.to/hamzatopo/i-built-sketchstash-a-small-tool-to-store-terminal-commands-and-dev-snippets-17n3</guid>
      <description>&lt;p&gt;Hi devs 👋&lt;/p&gt;

&lt;p&gt;I built a small tool called SketchStash to store terminal commands, snippets and technical notes in one clean workspace.&lt;/p&gt;

&lt;p&gt;Instead of losing commands in terminal history, the idea is to keep everything searchable and organized.&lt;/p&gt;

&lt;p&gt;Current features:&lt;br&gt;
• Code snippet editor&lt;br&gt;
• Command search&lt;br&gt;
• Tag system&lt;br&gt;
• Pagination&lt;br&gt;
• Focus audio player&lt;br&gt;
• Dark / light theme&lt;br&gt;
• Responsive UI&lt;/p&gt;

&lt;p&gt;Stack:&lt;br&gt;
React + TypeScript&lt;br&gt;
Symfony API&lt;br&gt;
Docker&lt;br&gt;
MySQL&lt;/p&gt;

&lt;p&gt;Coming soon:&lt;br&gt;
Auth (register/login)&lt;br&gt;
Tag management&lt;br&gt;
Bulk delete&lt;/p&gt;

&lt;p&gt;Would love your feedback 🙌&lt;/p&gt;

&lt;p&gt;Live demo:&lt;br&gt;
&lt;a href="https://sketchstash.online" rel="noopener noreferrer"&gt;https://sketchstash.online&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>symfony</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>I built a tiny Linux tool that shouts “FAHH” when I type the wrong command</title>
      <dc:creator>Hamza</dc:creator>
      <pubDate>Thu, 05 Mar 2026 13:53:48 +0000</pubDate>
      <link>https://dev.to/hamzatopo/i-built-a-tiny-linux-tool-that-shouts-fahh-when-i-type-the-wrong-command-3fio</link>
      <guid>https://dev.to/hamzatopo/i-built-a-tiny-linux-tool-that-shouts-fahh-when-i-type-the-wrong-command-3fio</guid>
      <description>&lt;h1&gt;
  
  
  I built a tiny Linux tool that shouts “FAHH” when I type the wrong command
&lt;/h1&gt;

&lt;p&gt;A few weeks ago I noticed something about the way I work in the terminal.&lt;/p&gt;

&lt;p&gt;When I’m focused and typing commands fast, I tend to make a lot of small mistakes.&lt;/p&gt;

&lt;p&gt;Wrong command.&lt;br&gt;&lt;br&gt;
Misspelled command.&lt;br&gt;&lt;br&gt;
Sometimes I just type something that doesn't exist.&lt;/p&gt;

&lt;p&gt;And the terminal just replies with the usual:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;command &lt;/span&gt;not found
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That message is… boring.&lt;/p&gt;

&lt;p&gt;And also very easy to ignore.&lt;/p&gt;

&lt;p&gt;So I started thinking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What if the terminal could actually &lt;strong&gt;react&lt;/strong&gt; when I type something wrong?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Not visually.&lt;br&gt;&lt;br&gt;
Not with an error popup.&lt;/p&gt;

&lt;p&gt;But with &lt;strong&gt;sound&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Something dramatic.&lt;/p&gt;

&lt;p&gt;Something like:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FAHH.&lt;/strong&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  The idea
&lt;/h2&gt;

&lt;p&gt;I wanted something very simple:&lt;/p&gt;

&lt;p&gt;Whenever I type a command that doesn't exist in the terminal, play a sound.&lt;/p&gt;

&lt;p&gt;Nothing fancy.&lt;br&gt;&lt;br&gt;
Just a tiny reaction that reminds me:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Hey… that command doesn't exist."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I initially looked for something like this inside &lt;strong&gt;VSCode extensions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;There were some interesting ones, but they only worked inside the editor terminal.&lt;/p&gt;

&lt;p&gt;I wanted something that works everywhere:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WSL
&lt;/li&gt;
&lt;li&gt;Debian
&lt;/li&gt;
&lt;li&gt;normal Linux terminals
&lt;/li&gt;
&lt;li&gt;zsh
&lt;/li&gt;
&lt;li&gt;bash
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Basically &lt;strong&gt;anything I run in the shell&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So I decided to build a tiny CLI tool for it.&lt;/p&gt;


&lt;h2&gt;
  
  
  The result
&lt;/h2&gt;

&lt;p&gt;I ended up creating a small tool called:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;fahhctl&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What it does is very simple.&lt;/p&gt;

&lt;p&gt;When you type a command that doesn't exist:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;fakecommand
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You still see the normal error message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;command &lt;/span&gt;not found: fakecommand
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But you also hear:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FAHH 🔊&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;The tool installs a small hook into your shell configuration.&lt;/p&gt;

&lt;p&gt;When the shell detects a command that doesn't exist, it simply runs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;fahhctl play
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which plays a sound file.&lt;/p&gt;

&lt;p&gt;That’s it.&lt;/p&gt;

&lt;p&gt;No background process.&lt;br&gt;&lt;br&gt;
No daemon.&lt;br&gt;&lt;br&gt;
Just a tiny hook and a sound.&lt;/p&gt;


&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;If you're curious and want to try it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/hamza-topo/fahhctl/main/install.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then reload your shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;source&lt;/span&gt; ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now try typing something wrong.&lt;/p&gt;




&lt;h2&gt;
  
  
  Customize the sound
&lt;/h2&gt;

&lt;p&gt;The default sound is a dramatic &lt;strong&gt;FAHH&lt;/strong&gt;, but you can replace it with anything.&lt;/p&gt;

&lt;p&gt;The sound file lives here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~/.local/share/fahh/fahh.mp3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So you can replace it with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a meme sound
&lt;/li&gt;
&lt;li&gt;a warning beep
&lt;/li&gt;
&lt;li&gt;a voice saying "wrong command"
&lt;/li&gt;
&lt;li&gt;whatever you want&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why I actually like this
&lt;/h2&gt;

&lt;p&gt;It sounds silly, but it’s surprisingly useful.&lt;/p&gt;

&lt;p&gt;The sound acts like a &lt;strong&gt;tiny feedback loop&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of silently ignoring mistakes, the terminal gives a quick reaction.&lt;/p&gt;

&lt;p&gt;It helps me stay a bit more focused when I’m typing commands fast.&lt;/p&gt;

&lt;p&gt;Also… it's just fun.&lt;/p&gt;




&lt;h2&gt;
  
  
  The project
&lt;/h2&gt;

&lt;p&gt;If you're curious about the code or want to try it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/hamza-topo/fahhctl" rel="noopener noreferrer"&gt;https://github.com/hamza-topo/fahhctl&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's a very small project, but it was fun to build.&lt;/p&gt;

&lt;p&gt;And sometimes the smallest tools are the most satisfying ones.&lt;/p&gt;

</description>
      <category>cli</category>
      <category>linux</category>
      <category>showdev</category>
      <category>tooling</category>
    </item>
    <item>
      <title>React js &amp; Github actions</title>
      <dc:creator>Hamza</dc:creator>
      <pubDate>Thu, 05 Sep 2024 08:57:44 +0000</pubDate>
      <link>https://dev.to/hamzatopo/react-js-github-actions-321e</link>
      <guid>https://dev.to/hamzatopo/react-js-github-actions-321e</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hey there, fellow developers! 🎉 Let's get your React app out into the world! 🚀 Today, we're going to deploy it to GitHub Pages, a super easy way to share your creations with everyone.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Create Your GitHub Repository&lt;/strong&gt;: (skipp this if you alread have done this)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Head over to GitHub and click the "New" button.&lt;/li&gt;
&lt;li&gt;Name your repository (let's call it react-awesome-app).&lt;/li&gt;
&lt;li&gt;(Optional) Add a description.&lt;/li&gt;
&lt;li&gt;Choose "Public" visibility.&lt;/li&gt;
&lt;li&gt;Click "Create repository".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Set Up Your Local React Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open your terminal and run &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;npx create-react-app react-awesome-app&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Navigate to your project:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;cd react-awesome-app&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Connect Your Local Project to GitHub&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Initialize Git: &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;git init.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add all files: &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;git add .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Commit changes: &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;git commit -m 'Initial commit'&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a main branch: &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;git branch -M main&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the remote:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;git remote add origin &lt;a href="https://github.com/%7Byour-github-username%7D/react-awesome-app.git" rel="noopener noreferrer"&gt;https://github.com/{your-github-username}/react-awesome-app.git&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Push to GitHub: &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;git push -u origin main&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Build for Deployment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;npm start&lt;/code&gt; to check everything works.&lt;br&gt;
Create a production build: &lt;code&gt;npm run build&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Step 5: Configure GitHub Pages&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open package.json.&lt;br&gt;
Add homepage:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;"homepage": "https://{your-github-username}.github.io/react-awesome-app"&lt;/code&gt;&lt;br&gt;
Step 6: Deploy Your App&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Install gh-pages: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;npm install gh-pages --save-dev&lt;br&gt;
Add scripts to package.json:&lt;br&gt;
&lt;code&gt;"scripts": {&lt;br&gt;
  "predeploy": "npm run build",&lt;br&gt;
  "deploy": "gh-pages -d build"&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Deploy: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;npm run deploy&lt;br&gt;
That's it! 🎉 Your app is now live on GitHub Pages. Share the link with the world!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The public link for your application will be : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;react-awesome-app to be replaced by your github repo name
https://{username}.github.io/{repository-name}/&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Laravel : DESIGN PATTERN REPOSITORY</title>
      <dc:creator>Hamza</dc:creator>
      <pubDate>Tue, 06 Feb 2024 11:54:06 +0000</pubDate>
      <link>https://dev.to/hamzatopo/laravel-design-pattern-repository-4m7f</link>
      <guid>https://dev.to/hamzatopo/laravel-design-pattern-repository-4m7f</guid>
      <description>&lt;p&gt;🏠 &lt;strong&gt;Short Story:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I vividly recall my initial encounter with the term "Design Pattern" – a moment of profound confusion as I grappled with whether it was a mere philosophical concept or a collection of abstract theories. The burning question in my mind was: how could such a concept be practically applied to something as tangible as my to-do list project 😅?&lt;/p&gt;

&lt;p&gt;As it turns out, design patterns are not elusive philosophies; instead, they are a set of solutions crafted to address recurring problems encountered during the software design process. These solutions present a structured approach to overcome common challenges, equipping developers with established and efficient methods to handle issues that frequently arise during coding.&lt;/p&gt;

&lt;p&gt;One of the most renowned examples of a design pattern is the Singleton pattern. Imagine creating a new instance of a MySQL database connection for every single request – not only is it inefficient, but it's also downright impractical. Enter the Singleton pattern, which ensures that only one instance of an object (such as a database connection) is created, streamlining operations and optimizing resource usage.&lt;/p&gt;

&lt;p&gt;Certainly! Today, let's delve into one of the essential design patterns within the context of the Laravel framework: the Repository Design Pattern.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repository Design Pattern:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Repository Design Pattern, a structural pattern, serves to separate the logic responsible for retrieving data from the underlying storage (such as a database) from the rest of the application. In Laravel, this pattern is frequently employed to interact with database models.&lt;/p&gt;

&lt;p&gt;In simpler terms, we introduce an intermediary layer between my &lt;code&gt;UserController&lt;/code&gt; and &lt;code&gt;UserModel&lt;/code&gt;, which I'll refer to as &lt;code&gt;UserRepository&lt;/code&gt;. Familiar with CRUD methods, right? Well, let's consolidate them within &lt;code&gt;UserRepository&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In my projects, I typically initiate the development process by establishing a dedicated folder named "Repositories" within the "app" directory. The next step is to create a PHP interface; I can name it &lt;code&gt;RepositoryInterface.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Repositories&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Database\Eloquent\Collection&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;RepositoryInterface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cd"&gt;/**
     * create method
     * 
     * @author Topo &amp;lt;topo@test.com&amp;gt;
     * @param  mixed $model
     */&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$model&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This interface serves as a blueprint containing prototypes for essential CRUD (Create, Read, Update, Delete) methods. These methods act as the foundation for implementing the repository design pattern, and for now, we will just use the &lt;code&gt;create&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;Next, let's define our &lt;code&gt;UserRepository&lt;/code&gt; class. To do so, let's create this class and implement the &lt;code&gt;RepositoryInterface&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Repositories&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Models\User&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserRepository&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;RepositoryInterface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Isn't that easy? Can you see how much your code looks well-separated, readable, and easy to maintain?&lt;/p&gt;

&lt;p&gt;The question now is, how can I call this repository in my controller? Well, it's not a big deal. This is where we can use Dependency Injection (DI). In the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Http\Controllers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Repositories\UserRepository&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserController&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="c1"&gt;//since im using php 8.x im allowed to use this syntax 😅&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="kt"&gt;UserRepository&lt;/span&gt; &lt;span class="nv"&gt;$userRepository&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Request&lt;/span&gt; &lt;span class="nv"&gt;$request&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="c1"&gt;// Validate your request &lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;userRepository&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$request&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Conclusion 👋&lt;/strong&gt;&lt;br&gt;
In conclusion, the Repository Design Pattern proves to be a powerful and indispensable tool for enhancing the readability of your code and adhering to the Single Responsibility Principle. By adopting this pattern, you can achieve a clean and modular architecture, keeping the logic responsible for data retrieval neatly separated from the rest of your application.&lt;/p&gt;

&lt;p&gt;The introduction of the intermediary layer, such as the &lt;code&gt;UserRepository&lt;/code&gt;, not only streamlines CRUD operations but also contributes to the overall maintainability of your codebase. No longer do you find &lt;code&gt;User::create()&lt;/code&gt; directly in your controller 🤢, but rather, the creation logic is encapsulated within the dedicated repository. This separation of concerns not only enhances the clarity of your code but also ensures that each component has a specific and well-defined responsibility.&lt;/p&gt;

&lt;p&gt;Embracing the Repository Design Pattern is not just about organizing code; it's a strategic move towards creating robust and scalable applications. It empowers developers with a systematic approach to handling data access, making your codebase more maintainable, readable, and aligned with best practices in software design.&lt;/p&gt;

</description>
      <category>larevel</category>
      <category>designpatterns</category>
      <category>services</category>
      <category>repositories</category>
    </item>
  </channel>
</rss>
