<?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: Christos Koumpis</title>
    <description>The latest articles on DEV Community by Christos Koumpis (@button99).</description>
    <link>https://dev.to/button99</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%2F728026%2Fbf4d9a34-ff90-46f0-ba7e-e65933f5bf2a.png</url>
      <title>DEV Community: Christos Koumpis</title>
      <link>https://dev.to/button99</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/button99"/>
    <language>en</language>
    <item>
      <title>How I Write Laravel Code That Future-Me Can still Read.</title>
      <dc:creator>Christos Koumpis</dc:creator>
      <pubDate>Wed, 11 Feb 2026 10:46:41 +0000</pubDate>
      <link>https://dev.to/button99/how-i-write-laravel-code-that-future-me-can-still-read-2755</link>
      <guid>https://dev.to/button99/how-i-write-laravel-code-that-future-me-can-still-read-2755</guid>
      <description>&lt;p&gt;I stopped chasing clever solutions and started optimizing for one thing: &lt;strong&gt;Can I understand this quickly 1 year later?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That one question helped me build a set of rules I follow when writing code.&lt;/p&gt;

&lt;h2&gt;
  
  
  1) Keep Controllers thin.
&lt;/h2&gt;

&lt;p&gt;If a Controller method starts doing validation, business logic, mapping, response etc. Its doing too much work.&lt;/p&gt;

&lt;p&gt;So my controllers changed to: &lt;br&gt;
&lt;strong&gt;Request in -&amp;gt; Action Call -&amp;gt; Response out.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function store(StoreInvoiceRequest $request, CreateInvoiceAction $action)
{
    $invoice = $action-&amp;gt;execute($request-&amp;gt;validated());

    return InvoiceResource::make($invoice);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2) Move business logic into Actions/Services.
&lt;/h2&gt;

&lt;p&gt;When logic matters to the domain, I don't bury it in controllers or models.&lt;/p&gt;

&lt;p&gt;It belongs in a dedicated class with a clear responsibility.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final class CreateInvoiceAction
{
    public function execute(array $data): Invoice
    {
        return DB::transaction(function () use ($data) {
            $invoice = Invoice::create([
                'customer_id' =&amp;gt; $data['customer_id'],
                'due_date' =&amp;gt; $data['due_date'],
                'status' =&amp;gt; 'draft',
            ]);

            foreach ($data['items'] as $item) {
                $invoice-&amp;gt;items()-&amp;gt;create([
                    'description' =&amp;gt; $item['description'],
                    'qty' =&amp;gt; $item['qty'],
                    'unit_price' =&amp;gt; $item['unit_price'],
                ]);
            }

            return $invoice-&amp;gt;refresh();
        });
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3) Use Form Requests for validation.
&lt;/h2&gt;

&lt;p&gt;I avoid inline validation in controllers unless its truly tiny.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final class StoreInvoiceRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'customer_id' =&amp;gt; ['required', 'exists:customers,id'],
            'due_date' =&amp;gt; ['required', 'date'],
            'items' =&amp;gt; ['required', 'array', 'min:1'],
            'items.*.description' =&amp;gt; ['required', 'string', 'max:255'],
            'items.*.qty' =&amp;gt; ['required', 'integer', 'min:1'],
            'items.*.unit_price' =&amp;gt; ['required', 'numeric', 'min:0'],
        ];
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4) Prefer explicit queries over "magic"
&lt;/h2&gt;

&lt;p&gt;Eloquent is a powerful tool, but unclear query chains can become painful really fast.&lt;/p&gt;

&lt;p&gt;That's why I :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scope frequently used filters.&lt;/li&gt;
&lt;li&gt;Use eager loading.&lt;/li&gt;
&lt;li&gt;Select only needed columns for heavy endpoints.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$invoices = Invoice::query()
    -&amp;gt;with(['customer:id,name', 'items:id,invoice_id,qty,unit_price'])
    -&amp;gt;where('status', 'sent')
    -&amp;gt;whereDate('due_date', '&amp;lt;', now())
    -&amp;gt;latest('due_date')
    -&amp;gt;paginate(20);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5) Use Resources for API Responses.
&lt;/h2&gt;

&lt;p&gt;There is no need to return raw models from APIs.&lt;br&gt;
&lt;code&gt;JsonResource&lt;/code&gt; keeps response structured and stable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final class InvoiceResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' =&amp;gt; $this-&amp;gt;id,
            'number' =&amp;gt; $this-&amp;gt;number,
            'status' =&amp;gt; $this-&amp;gt;status,
            'total' =&amp;gt; $this-&amp;gt;total,
            'customer' =&amp;gt; [
                'id' =&amp;gt; $this-&amp;gt;customer-&amp;gt;id,
                'name' =&amp;gt; $this-&amp;gt;customer-&amp;gt;name,
            ],
        ];
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6) Better naming.
&lt;/h2&gt;

&lt;p&gt;I believe intent based names are self documented.&lt;/p&gt;

&lt;p&gt;Examples: &lt;br&gt;
&lt;code&gt;CalculateInvoiceTotals&lt;/code&gt;&lt;br&gt;
&lt;code&gt;SendReminder&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7) Use transactions for multi step writes.
&lt;/h2&gt;

&lt;p&gt;If multiple records must succeed, then I use &lt;code&gt;DB::transaction()&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  8) Comment decisions, not syntax.
&lt;/h2&gt;

&lt;p&gt;Example: &lt;br&gt;
&lt;code&gt;// Use immutable snapshot so invoice totals don't change if product prices update later&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That kind of comment saves me real debugging time.&lt;/p&gt;

&lt;p&gt;Always looking to improve this system. What are you doing in your projects that consistently works?&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>code</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Create Meme games with Laravel</title>
      <dc:creator>Christos Koumpis</dc:creator>
      <pubDate>Mon, 12 May 2025 07:52:21 +0000</pubDate>
      <link>https://dev.to/button99/create-meme-games-with-laravel-4l2</link>
      <guid>https://dev.to/button99/create-meme-games-with-laravel-4l2</guid>
      <description>&lt;p&gt;Hello, recently me and my friend came up with an idea to create a website with meme mini games. We wanted something fast, secure and reliable and since we are familiar with PHP; we chose to create the project using the Laravel Framework. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Laravel?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Laravel has a big ecosystem and that helps developers to turn ideas into real products fast. With just a few tools we were up and running. We used Laravel Pint for clear and consistent style, Laravel Sanctum for API authentication and of course we used the famous Vue starter kit. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Difficulties&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every developer faces challenges when they start a new project: Ours were: &lt;br&gt;
        • What mini games could we have?&lt;br&gt;
        • Where will we host the app?&lt;/p&gt;

&lt;p&gt;We overcame the issues through communication and our experience from previous projects. For example, for the mini games we added a Battle page, where the users can vote which character they think would win in a fight. Also, we made a Who is page, where a random image appears and the users must guess the correct character name.&lt;/p&gt;

&lt;p&gt;Now for the technical part, we decided to use MySQL as database. For Hosting, we used Hetzner with Laravel Forge for fast and reliable deployment. Forge made the setup simple and withing minutes our app was live and ready to go.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This project showed us how rewarding, it can be to turn a simple idea into reality. Laravel helped us to develop smooth, but at the end of the day it was our creativity and collaboration that really brought it to life. One of the best parts has been hearing from users. People have enjoyed playing the games and gave us suggestions of new features.&lt;br&gt;
If you ware into memes and battles and want to try it, check out &lt;a href="https://rotrivals.com" rel="noopener noreferrer"&gt;https://rotrivals.com&lt;/a&gt; &lt;br&gt;
Tell us what you think! We would love to hear. &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>laravel</category>
      <category>php</category>
      <category>vue</category>
    </item>
    <item>
      <title>Creating my first PHP Package</title>
      <dc:creator>Christos Koumpis</dc:creator>
      <pubDate>Wed, 11 Sep 2024 16:00:58 +0000</pubDate>
      <link>https://dev.to/button99/creating-my-first-php-package-1j52</link>
      <guid>https://dev.to/button99/creating-my-first-php-package-1j52</guid>
      <description>&lt;p&gt;Hello Devs,&lt;/p&gt;

&lt;p&gt;I recently had the crazy idea of developing a PHP package for logging errors in scripts. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What inspired me?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As I started on building my very first package, the experience was nothing short of thrilling. The first question that I asked myself was "Why should I create this?" The answer soon followed. &lt;br&gt;
I wanted a command-line tool that not only logs errors but does so in a vibrant, visually engaging way. With that in my mind, I opened my favorite code editor, turned to the PHP documentation, and began turning this idea into reality.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;What does it do?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The package is simple and effective. It logs messages in PHP Scripts and presents them in a beautiful, colorful format, making debugging not only easier but also more enjoyable! You can check it out on Packagist &lt;a href="https://packagist.org/packages/ckoumpis/php-prompt" rel="noopener noreferrer"&gt;ckoumpis/php-prompt&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Code Samples&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Here's a quick example of how you can use it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Console::log("Hello from ckoumpis/php-prompt!");
Console::success("Operation successful!");
Console::error("An error occurred!");
Console::warning("Warning");Console::blue("This is a blue message");
Console::magenta("This is a magenta message");
Console::cyan("Cyan message for notification");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Progress Bars and Spinners&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The package also includes progress bars and spinners for better feedback in long running scripts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for($i = 1; $i &amp;lt;= $total; $i++) {
    ProgressBar::display($i, $total);
    usleep(10000);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or with &lt;code&gt;steps&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ProgressBar::withSteps(1, 10, 1);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Spinners&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for($i = 0; $i &amp;lt; 10; $i++) {
    Spinner::spin();
    sleep(1);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or with Steps&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Spinner::withSteps(0, 10, 1);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Collaboration&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;I welcome anyone to contribute in the project. I would love for others to join me in making this tool even better. Together we can build something cool and useful.&lt;/p&gt;

</description>
      <category>php</category>
      <category>programming</category>
      <category>opensource</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Reflecting my 4 month journey as Junior Software Engineer</title>
      <dc:creator>Christos Koumpis</dc:creator>
      <pubDate>Fri, 18 Aug 2023 09:46:21 +0000</pubDate>
      <link>https://dev.to/button99/reflecting-my-4-month-journey-as-junior-software-engineer-9p2</link>
      <guid>https://dev.to/button99/reflecting-my-4-month-journey-as-junior-software-engineer-9p2</guid>
      <description>&lt;p&gt;Hello Devs,&lt;/p&gt;

&lt;p&gt;Today I’d like to share with you my 4 month journey as Junior Software Engineer. From the beginning my familiarity with PHP and its framework Laravel was humble. Additionally, I honed my skills in JavaScript (Vue.js), PostgreSQL and MySQL. &lt;/p&gt;

&lt;p&gt;The day I received the offer was an exciting time for me. Announcing my new role as a Software Engineer filled me with pride, knowing that I had achieved my first goal and now I was looking forward into the next steps! &lt;/p&gt;

&lt;p&gt;As my first day dawned and I was prepared for it… I was ready to engage with new people learn more about their stack and contribute into new projects. My journey  started with reading code and asking questions from general to more intricate ones. &lt;/p&gt;

&lt;p&gt;The time passed and my first project arrived! I was sure that I will manage to make it and I put all of my effort in it! I searched, I read and I finally did it! I was so happy and I was feeling so productive that I managed to reach this first milestone in my career!&lt;/p&gt;

&lt;p&gt;As I look forward, this journey remains steadfast and a lot of Challenges lie ahead, but so do opportunities for innovation.&lt;/p&gt;

&lt;p&gt;To those aspiring to achieve their goals, embrace opportunities fearlessly when they come knocking. Try to be different and do not be afraid for everything that comes into your path.&lt;/p&gt;

&lt;p&gt;Until next time,&lt;/p&gt;

&lt;p&gt;Christos&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>career</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
