<?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: Seth Phat</title>
    <description>The latest articles on DEV Community by Seth Phat (@sethsandaru).</description>
    <link>https://dev.to/sethsandaru</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%2F220814%2F4cce6b5b-bac0-4394-81c0-32fc2997dd50.png</url>
      <title>DEV Community: Seth Phat</title>
      <link>https://dev.to/sethsandaru</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sethsandaru"/>
    <language>en</language>
    <item>
      <title>Free API to render HTML to PDF - RenderPDF.io</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Tue, 16 Apr 2024 06:42:32 +0000</pubDate>
      <link>https://dev.to/sethsandaru/free-api-to-render-html-to-pdf-renderpdfio-4032</link>
      <guid>https://dev.to/sethsandaru/free-api-to-render-html-to-pdf-renderpdfio-4032</guid>
      <description>&lt;p&gt;Hey guys,&lt;/p&gt;

&lt;p&gt;I wanna share with you guys about &lt;a href="https://renderpdf.io"&gt;RenderPDF.io&lt;/a&gt; 🔥&lt;/p&gt;

&lt;h2&gt;
  
  
  A developer-friendly API to render PDFs -  RenderPDF.io
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://renderpdf.io"&gt;RenderPDF.io&lt;/a&gt; makes rendering HTML to PDF super easy &amp;amp; simple 😎&lt;/p&gt;

&lt;p&gt;We provide awesome &amp;amp; hassle-free API and let you use it within a few clicks.&lt;/p&gt;

&lt;p&gt;A simple API call = A rendered PDF ready to be served to your customers 🔥.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;httpClient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;baseUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://renderpdf.io/api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Bearer YOUR_API_KEY&lt;/span&gt;&lt;span class="dl"&gt;'&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;renderPdf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;htmlContent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;httpClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/pdfs/render-sync&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;htmlContent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;// add more options here if you need&lt;/span&gt;
  &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fileUrl&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// a "Hello World" PDF ❤️&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pdfUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;renderPdf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello World&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Homepage: &lt;a href="https://renderpdf.io"&gt;https://renderpdf.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Documentation: &lt;a href="https://docs.renderpdf.io"&gt;https://docs.renderpdf.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Get your FREE API KEY at: &lt;a href="https://renderpdf.io/login"&gt;https://renderpdf.io/login&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Engine
&lt;/h3&gt;

&lt;p&gt;Powered by Chromium 🚀, you can use the latest CSS/styling that you want and create a modern PDF out of it 😎.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why RenderPDF.io?
&lt;/h2&gt;

&lt;p&gt;We all know that rendering PDFs is a not-so-fun job. Most people would have to research libraries, try/test out a lot of CSS, even we have to deploy &amp;amp; manage stuff. Which costs a lot of time &amp;amp; effort.&lt;/p&gt;

&lt;p&gt;I've been there, using &lt;code&gt;wkhtmltopdf&lt;/code&gt; and a lot of CSS styling went wrong, have to Google for hours, etc.&lt;/p&gt;

&lt;p&gt;RenderPDF.io will definitely make your life easier. I've been using TailwindCSS for my Invoicing PDFs and it is just lovely and beautiful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thank you
&lt;/h2&gt;

&lt;p&gt;Get your FREE API KEY today and love your life 🥰&lt;/p&gt;

&lt;p&gt;Thank you for reading!&lt;/p&gt;

</description>
      <category>programming</category>
      <category>pdf</category>
      <category>api</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🌹 Awesome development tools for PHP 2023</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Sat, 21 Oct 2023 07:36:49 +0000</pubDate>
      <link>https://dev.to/sethsandaru/awesome-development-tools-for-php-2023-5boj</link>
      <guid>https://dev.to/sethsandaru/awesome-development-tools-for-php-2023-5boj</guid>
      <description>&lt;p&gt;Hi guys,&lt;/p&gt;

&lt;p&gt;Time flies, PHP is still being used and popular in the world 😎&lt;/p&gt;

&lt;p&gt;Getting started and working with PHP is totally fast &amp;amp; awesome nowadays, we have plenty of tools to skyrocket your development experience (DX).&lt;/p&gt;

&lt;p&gt;Let's check them out 😉&lt;/p&gt;

&lt;h2&gt;
  
  
  😎 IDEs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;PHPStorm (my go-to IDE)&lt;/li&gt;
&lt;li&gt;Visual Studio Code (has plenty of PHP plugins)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🚀 Laravel Herd
&lt;/h2&gt;

&lt;p&gt;A super tool to install &amp;amp; switch PHP versions, nginx included 😎&lt;/p&gt;

&lt;p&gt;The pain of managing the PHP version is no more. Goodbye XAMPP.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqrtxrwxrbhrazfs5dnsu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqrtxrwxrbhrazfs5dnsu.png" alt="Laravel Herd - Seth Phat" width="800" height="904"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Home page: &lt;a href="https://herd.laravel.com/"&gt;https://herd.laravel.com/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🔋 DBNgin
&lt;/h2&gt;

&lt;p&gt;Get your desired database up and running in no time. Including MySQL, PostgreSQL and Redis 🥰&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2nvj24wo8g3x0vu0upe5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2nvj24wo8g3x0vu0upe5.png" alt="DBNgin - Seth Phat" width="800" height="561"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Home page: &lt;a href="https://dbngin.com/"&gt;https://dbngin.com/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ✉️ MailTrap
&lt;/h2&gt;

&lt;p&gt;A simple Email service to help us test the email content, recipients,...&lt;/p&gt;

&lt;p&gt;No installation is required, we only need to sign up, get the SMTP credentials, and rock your development 🔥&lt;/p&gt;

&lt;p&gt;Home page: &lt;a href="https://mailtrap.io/"&gt;https://mailtrap.io/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💼 TablePlus
&lt;/h2&gt;

&lt;p&gt;An elegant database management tool, super easy to use, has super high UX, and multiple helpers as well.&lt;/p&gt;

&lt;p&gt;We can use it free but limited to 2 tabs. However, the premium version is great and worth the investment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frdwo8hhew8nu1qrijeg5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frdwo8hhew8nu1qrijeg5.png" alt="TablePlus - Seth Phat" width="800" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Home page: &lt;a href="https://tableplus.com/"&gt;https://tableplus.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(the author of DBNgin)&lt;/p&gt;

&lt;h2&gt;
  
  
  (Optional) 🌹 DevToolz
&lt;/h2&gt;

&lt;p&gt;An opinionated development toolz made for developers.&lt;/p&gt;

&lt;p&gt;I crafted from my experience. Super useful in your development process.&lt;/p&gt;

&lt;p&gt;I hope you'll like it, free to use &amp;amp; open-sourced: &lt;a href="https://tools.sethphat.dev/"&gt;https://tools.sethphat.dev/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There will be more tools to come, stays tuned ❤️!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Well, those are the basic tools that you'll need to install &amp;amp; use to achieve the best DX.&lt;/p&gt;

&lt;p&gt;Those are the tools I am using every day, and totally satisfied ⭐️&lt;/p&gt;

&lt;p&gt;Have fun coding 😉!&lt;/p&gt;

&lt;p&gt;P/s: Check out my blog for other topics related to Backend, Scalable &amp;amp; High-perf: &lt;a href="https://sethphat.dev"&gt;https://sethphat.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>⭐️ Optimizes your response using Laravel Resource Reducer</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Sun, 24 Sep 2023 02:34:40 +0000</pubDate>
      <link>https://dev.to/sethsandaru/optimizes-your-response-using-laravel-resource-reducer-49ni</link>
      <guid>https://dev.to/sethsandaru/optimizes-your-response-using-laravel-resource-reducer-49ni</guid>
      <description>&lt;p&gt;Hey guys,&lt;/p&gt;

&lt;p&gt;I'm delighted to share my latest work on the performance of your Laravel API endpoints 😉.&lt;/p&gt;

&lt;p&gt;Check out: &lt;a href="https://github.com/shipsaas/laravel-resource-reducer"&gt;Laravel Resource Reducer&lt;/a&gt; 😎&lt;/p&gt;

&lt;p&gt;Before delving into Laravel Resource Reducer, it's essential to understand the drawbacks of the existing Laravel Resource 👀.&lt;/p&gt;

&lt;h2&gt;
  
  
  Laravel Resource
&lt;/h2&gt;

&lt;p&gt;I assume that you all are already familiar with Laravel Resource, aren't you? If not, you can explore it here: &lt;a href="https://laravel.com/docs/10.x/eloquent-resources"&gt;https://laravel.com/docs/10.x/eloquent-resources&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Simplest tl;dr:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Laravel Resource is a layer to compute your Eloquents into the Responses&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Problems
&lt;/h3&gt;

&lt;p&gt;Let's say, we have an endpoint &lt;code&gt;v1/users&lt;/code&gt; which returns an array of users:&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="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'data'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'id'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Seth Phat'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'email'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'me@sethphat.com'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'created_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'2023-01-01'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'role'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'ADMIN'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'avatar_url'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'...'&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="c1"&gt;// ... user 2,&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="c1"&gt;// ... more&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;Everything is suitable for the listing page, such as rendering users in the table.&lt;/p&gt;

&lt;p&gt;However, if we want to use a dropdown of users on another page (for example, to assign a user as a reviewer), then, you won't need all the returned fields, you only need: id &amp;amp; name (or additionally, email)&lt;/p&gt;

&lt;p&gt;=&amp;gt; The CONs while reusing the above endpoint:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Redundant fields returned 🥲&lt;/li&gt;
&lt;li&gt;Slower response 🥲&lt;/li&gt;
&lt;li&gt;You will end up creating a new endpoint just for the dropdown 🥲 Development takes more time &amp;amp; the team has to maintain more 🥲&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Moreover, if you have relationship(s) defined in your &lt;code&gt;UserResource&lt;/code&gt; and you wish to bulk them up in the response, then you will need to do eager-loading before transforming &lt;code&gt;UserResource&lt;/code&gt;, thus you'll have these CONs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Always need to do the eager-loading in the outer layer 🥲

&lt;ul&gt;
&lt;li&gt;And maintain that 🥲&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;n*n&lt;/strong&gt; response size because it bulked up with enormous data 🥲&lt;/li&gt;
&lt;li&gt;Definitely: slower response 🥲&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that you know the current problems. Let's jump into the super solution 😎&lt;/p&gt;

&lt;h2&gt;
  
  
  Meets Laravel Resource Reducer
&lt;/h2&gt;

&lt;p&gt;Laravel Resource Reducer helps you to optimize every API request by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduce the response's size, get what you need ⭐️&lt;/li&gt;
&lt;li&gt;Responses to API consumers faster 🚀&lt;/li&gt;
&lt;li&gt;Computation only starts when required, save CPU &amp;amp; memory 😎&lt;/li&gt;
&lt;li&gt;Built-in relationship access by using dot notation 👀&lt;/li&gt;
&lt;li&gt;Eager-loading on steroids (automated eager-loading, no more N+1 pain) 🔋&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A simple yet super effective method to skyrocketing your API responding times 🥰&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you know about GraphQL, To query for data, we need to define which fields we want to retrieve. Laravel Resource Reducer is heavily inspired from GraphQL approach. ❤️&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Usage (from API Consumer)
&lt;/h3&gt;

&lt;p&gt;Let's say, we have this endpoint: &lt;code&gt;v1/users&lt;/code&gt; which returns &lt;code&gt;User[]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;User&lt;/code&gt; has these fields: id, name, email, avatar_url, created_at, role (relationship)&lt;/p&gt;

&lt;p&gt;Simply add &lt;code&gt;_f[]&lt;/code&gt; or &lt;code&gt;_fields[]&lt;/code&gt; query param&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;name&lt;/code&gt;:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://my-api.com/v1/users?_fields%5B%5D=id&amp;amp;_fields%5B%5D=name"&gt;https://my-api.com/v1/users?_fields[]=id&amp;amp;_fields[]=name&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Get &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;email&lt;/code&gt;, and the role name (relationship)

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://my-api.com/v1/users?_f=id,email,role.name"&gt;https://my-api.com/v1/users?_f=id,email,role.name&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Isn't it awesome? 😎&lt;/p&gt;

&lt;h3&gt;
  
  
  Implementation
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Resource Reducer
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserResource&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;JsonReducerResource&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;definitions&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="kt"&gt;array&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'id'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'email'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'created_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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;created_at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'role'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;RoleResource&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;makeRelation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'role'&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember to wrap your fields with in closures, to defer execution 😎&lt;/p&gt;

&lt;h4&gt;
  
  
  Return responses
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// UserController@index&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;UserResource&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// UserController@show&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;UserResource&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="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The usage is as same as Laravel Resource 😉&lt;/p&gt;

&lt;h2&gt;
  
  
  Final words
&lt;/h2&gt;

&lt;p&gt;If this package is helpful, please give it a ⭐️⭐️⭐️.&lt;/p&gt;

&lt;p&gt;Consider using Laravel Resource Reducer to optimize &amp;amp; skyrocket your API endpoints 💪&lt;/p&gt;

&lt;p&gt;Thank you and have a great day!&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>opensource</category>
      <category>api</category>
    </item>
    <item>
      <title>🔋 Laravel Resource Reducer: optimizes your API responses</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Fri, 08 Sep 2023 03:59:24 +0000</pubDate>
      <link>https://dev.to/sethsandaru/laravel-resource-reducer-optimizes-your-api-responses-1g5l</link>
      <guid>https://dev.to/sethsandaru/laravel-resource-reducer-optimizes-your-api-responses-1g5l</guid>
      <description>&lt;p&gt;If this package is helpful, please give it a ⭐️⭐️⭐️. Thank you!&lt;/p&gt;

&lt;p&gt;GitHub Repository: &lt;a href="https://github.com/shipsaas/laravel-resource-reducer"&gt;https://github.com/shipsaas/laravel-resource-reducer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Documentation: &lt;a href="https://reducer.shipsaas.tech/"&gt;https://reducer.shipsaas.tech/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ever thinking about how to speed up your application by optimizing the response? 👀&lt;/p&gt;

&lt;p&gt;Laravel Resource Reducer helps you to optimize every API request by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduce the response's size, get what you need ⭐️

&lt;ul&gt;
&lt;li&gt;Defer execution and allow on-demand data&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Responses to consumers faster 🚀

&lt;ul&gt;
&lt;li&gt;No more BIG FAT JSON every item/request&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Computation only starts when requires, save CPU &amp;amp; memory 😎&lt;/li&gt;
&lt;li&gt;Built-in relationship access by using dot notation 👀&lt;/li&gt;
&lt;li&gt;Eager-loading on steroids (automated eager-loading, no more N+1 pain) 🔋&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A simple yet super effective method to skyrocketing your API responding times 🥰&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you know about GraphQL, To query for data, we need to define which &lt;em&gt;fields&lt;/em&gt; we want to retrieve.&lt;br&gt;
Laravel Resource Reducer is heavily inspired from GraphQL approach. ❤️&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Supports
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Laravel 10+&lt;/li&gt;
&lt;li&gt;PHP 8.2+&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Compatibility
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Single Eloquent Model ✅&lt;/li&gt;
&lt;li&gt;Collection of Eloquent Models ✅&lt;/li&gt;
&lt;li&gt;Pagination ✅ (🟡 we have to use &lt;code&gt;Resource::collection&lt;/code&gt; for the time being)&lt;/li&gt;
&lt;li&gt;(Planned) Collection of Arrays&lt;/li&gt;
&lt;li&gt;(Planned) Collection of Objects&lt;/li&gt;
&lt;/ul&gt;

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



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require shipsaas/laravel-resource-reducer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  API Consumer Usage
&lt;/h2&gt;

&lt;p&gt;Use the query &lt;code&gt;_f&lt;/code&gt; or &lt;code&gt;_fields&lt;/code&gt;, Reducer supports both ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;http://api/users?_f=id,name,role.name,created_at&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://api/users?_fields[]=id,_fields[]=email&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No more unnecessary fields and faster response TODAY 😎&lt;/p&gt;

&lt;h2&gt;
  
  
  Backend Implementation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Resource Class
&lt;/h3&gt;

&lt;p&gt;Same as Laravel Resource, using our &lt;code&gt;JsonReducerResource&lt;/code&gt; as the parent class.&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserResource&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;JsonReducerResource&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;definitions&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="kt"&gt;array&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'id'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'email'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'created_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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;created_at&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember to wrap your accessor in a Closure/Callable. &lt;br&gt;
This ensures computation won't start (wait for the right time 😉). &lt;/p&gt;
&lt;h3&gt;
  
  
  Return the data
&lt;/h3&gt;

&lt;p&gt;Same as today as how we are using Laravel Resource:&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="c1"&gt;// UserController@index&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;UserResource&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// UserController@show&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;UserResource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$users&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;()))&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;If this package is helpful, please give it a ⭐️⭐️⭐️. Thank you!&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
    <item>
      <title>📃 😎 DocKing: manage document templates &amp; render PDFs microservice</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Wed, 26 Jul 2023 04:35:52 +0000</pubDate>
      <link>https://dev.to/sethsandaru/docking-manage-document-templates-render-pdfs-microservice-1apc</link>
      <guid>https://dev.to/sethsandaru/docking-manage-document-templates-render-pdfs-microservice-1apc</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Mr-YP_av--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://raw.githubusercontent.com/shipsaas/docking/main/docs/img/logo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Mr-YP_av--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://raw.githubusercontent.com/shipsaas/docking/main/docs/img/logo.png" alt="DocKing's Logo" width="200" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DocKing is a document management service/microservice that handles templates and renders them in PDF format, all in one place.&lt;/p&gt;

&lt;p&gt;You can utilize DocKing as a shared microservice, which can be integrated &amp;amp; used in any services from your big product.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Documentation: &lt;a href="https://docking.shipsaas.tech/"&gt;DocKing's doc&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub Repo: &lt;a href="https://github.com/shipsaas/docking"&gt;https://github.com/shipsaas/docking&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DocKing is well-tested &amp;amp; production-ready 😉🏎️🚀&lt;/p&gt;

&lt;h2&gt;
  
  
  LIVE DEMO 🔥
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;URL: &lt;a href="https://docking-demo.shipsaas.tech/"&gt;https://docking-demo.shipsaas.tech/&lt;/a&gt; (feel free to hit the APIs)&lt;/li&gt;
&lt;li&gt;Console: &lt;a href="https://docking-demo.shipsaas.tech/console#/"&gt;https://docking-demo.shipsaas.tech/console#/&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;Password: None&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Features 🚀
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Manage your document templates 📰🧾.&lt;/li&gt;
&lt;li&gt;Render HTML based on your desired data for a specific template, then export it as PDF 🏃‍.&lt;/li&gt;
&lt;li&gt;Supports multiple state-of-the-art PDF Engines 🍻.&lt;/li&gt;
&lt;li&gt;Webhook notification after PDF rendered (for async flow) 🚀&lt;/li&gt;
&lt;li&gt;Built-in UI-console to manage the templates &amp;amp; files (for internal use) 🔋.&lt;/li&gt;
&lt;li&gt;DocKing can perfectly fit for the horizontal scaling based on your needs 😉.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Diagram of how it works
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wRFlKZkL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://github.com/shipsaas/docking/blob/main/docs/img/full-picture.png%3Fraw%3Dtrue%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wRFlKZkL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://github.com/shipsaas/docking/blob/main/docs/img/full-picture.png%3Fraw%3Dtrue%3Fraw%3Dtrue" alt="DocKing's Diagram" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the diagram above, DocKing is standing as a "shared-microservice".&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Billing Service can manage their bill templates and render the PDFs.&lt;/li&gt;
&lt;li&gt;Order Service can manage their order templates and render the PDFs.&lt;/li&gt;
&lt;li&gt;Contract Service can manage their contract templates and render the PDFs.&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Give it a ⭐️⭐️⭐️ if it's helpful, many thanks 🥹&lt;/p&gt;

</description>
      <category>microservices</category>
      <category>opensource</category>
      <category>vue</category>
      <category>php</category>
    </item>
    <item>
      <title>PHP CurrencyFX Library</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Sat, 27 May 2023 09:18:30 +0000</pubDate>
      <link>https://dev.to/sethsandaru/php-currencyfx-library-3l08</link>
      <guid>https://dev.to/sethsandaru/php-currencyfx-library-3l08</guid>
      <description>&lt;p&gt;Hi all,&lt;/p&gt;

&lt;p&gt;I'm happy to share the latest library I've been working on.&lt;/p&gt;

&lt;p&gt;It is called CurrencyFX.&lt;/p&gt;

&lt;p&gt;Let's check it out 😆&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;CurrencyFX is a PHP Library that helps you retrieve FX Rates from multiple online services, batteries-included 🔋🔋🔋&lt;/p&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/shipsaas/currency-fx"&gt;https://github.com/shipsaas/currency-fx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Requirement: PHP 8.1+&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Additionally, Laravel 10 (for Laravel auto integration)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;100% tested and covered under Unit, Integration &amp;amp; E2E tests (assert against the real services)&lt;/p&gt;

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



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require shipsaas/currency-fx

&lt;span class="c"&gt;# (Optional) For Laravel users&lt;/span&gt;
php artisan vendor:publish &lt;span class="nt"&gt;--tag&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;currency-fx-configs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Supporting Services / Batteries
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://exchangeratesapi.io/"&gt;https://exchangeratesapi.io/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://exchangerate.host/"&gt;https://exchangerate.host/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fixer.io/"&gt;https://fixer.io/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://currencylayer.com/"&gt;https://currencylayer.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.currencycloud.com/"&gt;https://www.currencycloud.com/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;Simply initialize the class with the required parameters (which are the API Key, Credentials). And it is ready to use in no time.&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="nv"&gt;$service&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;CurrencyCloudService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$host&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$loginId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$apiKey&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$rateResponse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$service&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getRates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'USD'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'SGD'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nv"&gt;$rateResponse&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;isOk&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// failed to get the rate from third party service&lt;/span&gt;
    &lt;span class="c1"&gt;// do something here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nv"&gt;$rate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$rateResponse&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getOkResult&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// float (1.4xxx)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Laravel Usage
&lt;/h2&gt;

&lt;p&gt;(Please add the needful ENVs before using, check out the &lt;code&gt;currency-fx.php&lt;/code&gt; for more info)&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;use&lt;/span&gt; &lt;span class="nc"&gt;CurrencyFX\Services\CurrencyLayerService&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;CurrencyFX\Services\ExchangerRatesApiIoService&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// use the global "app"&lt;/span&gt;
&lt;span class="nf"&gt;app&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;CurrencyLayerService&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getRates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'USD'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'EUR'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// DI&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TransferService&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;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;ExchangerRatesApiIoService&lt;/span&gt; &lt;span class="nv"&gt;$rateService&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;transfer&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;TransferResult&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$rateRes&lt;/span&gt; &lt;span class="o"&gt;=&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;rateService&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getRates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'EUR'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'GBP'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$rateRes&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;isError&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;TransferResult&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;...&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="nv"&gt;$rate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$rateRes&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getOkResult&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;rate&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;h2&gt;
  
  
  Final Words
&lt;/h2&gt;

&lt;p&gt;Thank you, please give it a ⭐️⭐️⭐️ to support the project.&lt;/p&gt;

&lt;p&gt;Don't forget to share with your friends &amp;amp; colleagues, so they can also build their own SaaS products as well 🚀&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>webdev</category>
      <category>library</category>
    </item>
    <item>
      <title>Reasons why you should do pet projects</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Sat, 10 Sep 2022 06:14:48 +0000</pubDate>
      <link>https://dev.to/sethsandaru/reasons-why-you-should-do-pet-projects-d7h</link>
      <guid>https://dev.to/sethsandaru/reasons-why-you-should-do-pet-projects-d7h</guid>
      <description>&lt;p&gt;Hi guys,&lt;/p&gt;

&lt;p&gt;As a Software Engineer who works in Web Development. I want to share to you guys the "why" &amp;amp; benefits of doing pet projects, based on my experience and achievements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: improve hard skills (from code to server), enrich CV and could be your new Startup.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Pet Projects?
&lt;/h2&gt;

&lt;p&gt;Put it simply, they are your own projects to solve any problems that you wanted to solve. &lt;/p&gt;

&lt;p&gt;You can do anything that you want, that's your own world. Nobody tells you to do so, it's just you, based on your ideas.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reasons &amp;amp; Benefits
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Improve your hard skills
&lt;/h3&gt;

&lt;p&gt;In real life, not everything you wanted to do, you get to do it on your daily work. Eg: my company is using Java, I want to use Go but there is no way to use it.&lt;/p&gt;

&lt;p&gt;By working on pet projects, you can use anything that you want, any languages, any tools, create your best structure, patterns,...&lt;/p&gt;

&lt;p&gt;Hands-on experience is always better.&lt;/p&gt;

&lt;p&gt;During the time you work on your pet projects, problems will come, obstacles will block your way. But once you solved them, it'll become valuable experience.&lt;/p&gt;

&lt;p&gt;Once your projects grow, you'll grow with it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn about Deployment / Cloud
&lt;/h3&gt;

&lt;p&gt;Once your project is done, let's deploy it ONLINE so you can share it to everybody about your work, ask for suggestions,...&lt;/p&gt;

&lt;p&gt;Within this phase, you will learn a lot of valuable things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Domain: how it works, DNS,...&lt;/li&gt;
&lt;li&gt;Server:

&lt;ul&gt;
&lt;li&gt;Setup necessary software(s) for your app&lt;/li&gt;
&lt;li&gt;Deploy

&lt;ul&gt;
&lt;li&gt;Manual deploy&lt;/li&gt;
&lt;li&gt;Automate deploy - CI/CD&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Securities&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Yes, it's gonna cost some bucks, some advice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can always find for a cheap domain to buy, just Googling it.&lt;/li&gt;
&lt;li&gt;There are a lot of providers that selling cheap VPS (Virtual Private Server), starting from $5 USD&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Learn about SEO - Search Engine Optimization
&lt;/h3&gt;

&lt;p&gt;After your app is up and LIVE. In order to have visitors, you need to learn about SEO - Search Engine Optimization.&lt;/p&gt;

&lt;p&gt;Some basic stuff will be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Register your website to all the popular Search Engines, eg: Google, Bing, DuckDuckGo,...&lt;/li&gt;
&lt;li&gt;Prepare sitemap.xml for the Search Engines&lt;/li&gt;
&lt;li&gt;Optimizing your page render speed&lt;/li&gt;
&lt;li&gt;Render your HTML content SEO-friendly&lt;/li&gt;
&lt;li&gt;Prepare good meta tags&lt;/li&gt;
&lt;li&gt;Readable URL (slug)&lt;/li&gt;
&lt;li&gt;Share your website on Social Media publicly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Website or web-app won't get many visitors at first. Let's wait and keep it running, at least 6 or 12 months. &lt;/p&gt;

&lt;h3&gt;
  
  
  Enrich your CV
&lt;/h3&gt;

&lt;p&gt;You can list your project(s) in your CV and share the achievements. &lt;/p&gt;

&lt;p&gt;It could be an additional point to the interviewer. To prove that you have the particular experience on these kinds of Technies. &lt;/p&gt;

&lt;h3&gt;
  
  
  It could become your own Startup
&lt;/h3&gt;

&lt;p&gt;What if my project solves problems/pain of a lot of people? &lt;/p&gt;

&lt;p&gt;What if there are more and more people going to use my web app. &lt;/p&gt;

&lt;p&gt;What if....?&lt;/p&gt;

&lt;p&gt;OMG congrats, that's a great starting point to invest more and make it become your own Startup. At this point, you can think and plan to monetize your app.&lt;/p&gt;

&lt;p&gt;That's a big achievement, isn't it? &lt;/p&gt;

&lt;p&gt;If not, well, we can try another idea next time. At least I improved my hard skills 😉 &lt;/p&gt;

&lt;h2&gt;
  
  
  My Achievements so far
&lt;/h2&gt;

&lt;p&gt;I have 2 pet projects, they are up and running. And yes, it is monetized. Both are running more than 2 years. Yes, achievements come little and little, let's wait for the magic happen slowly 🌷 no need to push hard or anything.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1st is having around 15k visitors per day, monetized via Ads ⭐.&lt;/li&gt;
&lt;li&gt;2nd is having 100+ paid subscribers 🐱‍🏍.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now I'm doing the 3rd project with cool idea and really looking forward to publishing it in the next 2 months 😝&lt;/p&gt;

&lt;p&gt;Thanks and I hope this topic helps and motivates you guys! &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>career</category>
    </item>
    <item>
      <title>Laravel: Generate phpDoc properties for your Eloquent models</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Sat, 03 Sep 2022 09:24:52 +0000</pubDate>
      <link>https://dev.to/sethsandaru/laravel-generate-phpdoc-properties-for-your-eloquent-models-4k78</link>
      <guid>https://dev.to/sethsandaru/laravel-generate-phpdoc-properties-for-your-eloquent-models-4k78</guid>
      <description>&lt;p&gt;Hi guys,&lt;/p&gt;

&lt;p&gt;We all know that Laravel's Eloquent is using PHP's magic methods (&lt;code&gt;__get&lt;/code&gt; &amp;amp; &lt;code&gt;__set&lt;/code&gt;) for the columns, accessors, relationships,... and much more.&lt;/p&gt;

&lt;p&gt;When the development happens, it hards for us to know which "properties" that we can use for a particular Eloquent models. We have to remember the columns' names, the relationship names,... It is a big pain, IKR?&lt;/p&gt;

&lt;p&gt;An alternative that we got - is using the phpDoc block and add the properties, eg:&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="cd"&gt;/**
* @property-read int $id // column
* @property string $name // column
* @property-read Country|null $country // relationship
* ...
*/&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Model&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this way, it is super &lt;strong&gt;IDE-friendly&lt;/strong&gt; (eg PHPStorm) and increase your productivity a lot.&lt;/p&gt;

&lt;p&gt;Butttt, doing the manually work is not so fun, is it? So here am I with the EloquentDocs generator.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/sethsandaru/eloquent-docs"&gt;https://github.com/sethsandaru/eloquent-docs&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Simply hit this to install, dev only:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require sethphat/eloquent-docs &lt;span class="nt"&gt;--dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel auto-discovery will automatically do the magic 😉&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;h3&gt;
  
  
  View properties of your model
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan eloquent:phpdoc App&lt;span class="se"&gt;\M&lt;/span&gt;odels&lt;span class="se"&gt;\U&lt;/span&gt;ser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It will show up all the properties (columns, relationships,...) for you to preview, before performing the write&lt;/p&gt;

&lt;h3&gt;
  
  
  Write properties to your model
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan eloquent:phpdoc App&lt;span class="se"&gt;\M&lt;/span&gt;odels&lt;span class="se"&gt;\U&lt;/span&gt;ser &lt;span class="nt"&gt;--write&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It will write the phpDoc block to your model (overwrite if your model already has a phpDoc block)&lt;/p&gt;

&lt;h3&gt;
  
  
  Optionally, use short class names
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan eloquent:phpdoc App&lt;span class="se"&gt;\M&lt;/span&gt;odels&lt;span class="se"&gt;\U&lt;/span&gt;ser &lt;span class="nt"&gt;--short-class&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From &lt;code&gt;* @property-read App\Models\Country|null $country&lt;/code&gt; to &lt;code&gt;* @property-read Country|null $country&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Goals
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ability to scan a whole folders and replace the phpDoc blocks automatically.&lt;/li&gt;
&lt;li&gt;Add more helper/suggestion methods for Eloquent models&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks guys, have a great productive works with Laravel!&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>[Laravel/Eloquent] Why you should avoid using Accessors?</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Sat, 20 Aug 2022 08:13:02 +0000</pubDate>
      <link>https://dev.to/sethsandaru/laraveleloquent-why-you-should-avoid-using-accessors-nk</link>
      <guid>https://dev.to/sethsandaru/laraveleloquent-why-you-should-avoid-using-accessors-nk</guid>
      <description>&lt;p&gt;Hi Laravel developers,&lt;/p&gt;

&lt;p&gt;As you may know, Laravel's Eloquent provides you a fancy way to create a "getter" and transform/access the data as how you want. Example:&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="c1"&gt;// App/Models/User &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;getFullNameAttribute&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'%s %s'&lt;/span&gt;&lt;span class="p"&gt;,&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;first_name&lt;/span&gt;&lt;span class="p"&gt;,&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;last_name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Seth Phat&lt;/span&gt;
&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;full_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looks cool, isn't it? &lt;/p&gt;

&lt;p&gt;But, you have to avoid it as soon as you can, here are the reasons.&lt;/p&gt;

&lt;h3&gt;
  
  
  1/ Conflicts between the table's columns
&lt;/h3&gt;

&lt;p&gt;As the example above, we can't tell the different between an accessor and a table's column. It is too similar how we access the data.&lt;/p&gt;

&lt;p&gt;When your projects grow, more and more features come to join, overusing the accessors will create a big pain in your codebase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can't tell the different between the columns and the accessors in your code. &lt;/li&gt;
&lt;li&gt;Maintenance and tech debt will rise high.&lt;/li&gt;
&lt;li&gt;Confuse new people when they're reading the code, logic,...&lt;/li&gt;
&lt;li&gt;You have to open a SQL Manager (eg TablePlus) all the time to see what is it.&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2/ Maintain phpDoc manually
&lt;/h3&gt;

&lt;p&gt;The more accessors you have, the higher time to maintain the phpDoc of your Model class.&lt;/p&gt;

&lt;p&gt;To make it IDE-friendly, code suggestions,... you have to add  your accessors into the phpDoc of your class, example:&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="cd"&gt;/**
* @property-read string $full_name // Accessor
* @property-read string $sex // Accessor
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Imagine you created 10 accessors, you have to add it 10 times. Or when you don't need it anymore, you need remove both the accessor and the doc attribute. &lt;/p&gt;

&lt;p&gt;Not so fun, IKR? &lt;/p&gt;

&lt;h3&gt;
  
  
  3/ Hard to mock
&lt;/h3&gt;

&lt;p&gt;When TDD comes to play, you want to write test. You want to mock your Eloquent model. The mocking process itself is a big pain.&lt;/p&gt;

&lt;p&gt;Eloquent will check what attribute wanna access then return the data via &lt;code&gt;__get()&lt;/code&gt; magic method. And to mock:&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="nv"&gt;$user&lt;/span&gt; &lt;span class="o"&gt;=&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="nf"&gt;createMock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;expects&lt;/span&gt;&lt;span class="p"&gt;(&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="nf"&gt;exactly&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;method&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'__get'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;willReturnOnConsecutiveCalls&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s1"&gt;'Seth Phat'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// full_name&lt;/span&gt;
        &lt;span class="s1"&gt;'Male'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// sex&lt;/span&gt;
        &lt;span class="c1"&gt;// ... more and more&lt;/span&gt;
     &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And I believe nobody would like that mocking process above. It is super hard to maintain.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what should I use?
&lt;/h2&gt;

&lt;p&gt;A good'ol getter method is simply perfect. IDE-friendly, no need to maintain phpDoc, super easy to mock:&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="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;getFullName&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'%s %s'&lt;/span&gt;&lt;span class="p"&gt;,&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;first_name&lt;/span&gt;&lt;span class="p"&gt;,&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;last_name&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;Mock:&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="nv"&gt;$user&lt;/span&gt; &lt;span class="o"&gt;=&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="nf"&gt;createMock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;expects&lt;/span&gt;&lt;span class="p"&gt;(&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="nf"&gt;once&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;method&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'getFullName'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;willReturn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Seth Phat'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// mock more...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With that mocking process, write test is totally enjoyable and easy to maintain.&lt;/p&gt;

&lt;h3&gt;
  
  
  Limitation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Can't use  &lt;code&gt;appends&lt;/code&gt; &amp;amp; &lt;code&gt;hidden&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;Alternatively: you can use &lt;a href="https://laravel.com/docs/9.x/eloquent-resources#main-content"&gt;Laravel's Resource&lt;/a&gt; response and preferred to use this way instead of return a whole Eloquent Model&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final
&lt;/h2&gt;

&lt;p&gt;That's my experience for this one. How about you guys?&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>eloque</category>
      <category>php</category>
      <category>accessor</category>
    </item>
    <item>
      <title>Go Gin&amp;Gorm: Route Model Binding</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Sat, 14 May 2022 15:02:46 +0000</pubDate>
      <link>https://dev.to/sethsandaru/go-gingorm-route-model-binding-3fpp</link>
      <guid>https://dev.to/sethsandaru/go-gingorm-route-model-binding-3fpp</guid>
      <description>&lt;p&gt;Howdy guys,&lt;/p&gt;

&lt;p&gt;From my daily work, I'm using PHP &amp;amp; Laravel. One of the feature that I really like &amp;amp; helpful is "Route Model Binding". &lt;/p&gt;

&lt;p&gt;Basically, you just need to define your routes and add the &lt;code&gt;Model&lt;/code&gt; into the path, magic happens, you'll:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get the Model instance and ready-to-use in the Controllers/Middlewares/Requests.&lt;/li&gt;
&lt;li&gt;Receive 404 not found if the record didn't exists.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With Go, we have to build things for our needs, indeed.&lt;/p&gt;

&lt;p&gt;Inspired by Laravel Route Model Binding, I built a Middleware for Gin which will help me to achieve that and I don't have to do &lt;code&gt;Find&lt;/code&gt; then return &lt;code&gt;error&lt;/code&gt; if not exists from the Controller. Extracted that to another layer.&lt;/p&gt;

&lt;p&gt;Repo for the &lt;a href="https://github.com/sethsandaru/go-route-model-binding"&gt;Middleware - sethsandaru/go-route-model-binding&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please give it a ⭐ if you actually like/going to use it 💖&lt;/p&gt;

&lt;h2&gt;
  
  
  Feature
&lt;/h2&gt;

&lt;p&gt;Eg: &lt;code&gt;users/:user&lt;/code&gt; =&amp;gt; Find the &lt;code&gt;User&lt;/code&gt; model instance&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If exists: bind it to the Gin's context via &lt;code&gt;c.Set&lt;/code&gt; so you can retrieve it &lt;/li&gt;
&lt;li&gt;If not: return 404 resource not found&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It definitely makes our life easier, doesn't it? I hate to do like: "find record, not exists/error =&amp;gt; return 404" in the controller, cuz it's not fun and make my controller's methods a bit longer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Q: Does it support multiple params eg: "users/:user/update-categories/:category"?&lt;/li&gt;
&lt;li&gt;A: Yes&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Mapping - Explicit Binding
&lt;/h2&gt;

&lt;p&gt;Since it won't be as smart as Laravel's way. We need to define a map in order to map your route params with a gORM model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;routeModelMapping&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="n"&gt;modelMapping&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"entity"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;makeModelMapping&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Entity&lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt; &lt;span class="s"&gt;"uuid"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="s"&gt;"user"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;makeModelMapping&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt; &lt;span class="s"&gt;"uuid"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="c"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Access from Controllers
&lt;/h2&gt;

&lt;p&gt;I love the term Controller and always using MVC in all of my applications.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;controller&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;entityController&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Show&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;gin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"entity"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;respondOk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entity&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;controller&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;userController&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Show&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;gin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;respondOk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&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;In order to get the correct type, we have to do typeAssertion - guide &lt;a href="https://golangcode.com/convert-interface-to-number/"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;PROs:

&lt;ul&gt;
&lt;li&gt;Automatically retrieve Model instances using gORM&lt;/li&gt;
&lt;li&gt;404 not found will be returned if instance not found&lt;/li&gt;
&lt;li&gt;Extracted the &lt;code&gt;find&lt;/code&gt; and &lt;code&gt;check exists&lt;/code&gt; out of the Controller&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;CONs:

&lt;ul&gt;
&lt;li&gt;Have to do typeAssertion in order to get the real type&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hopefully you'll like this, just like me hehee. &lt;/p&gt;

&lt;p&gt;Once again, here is the repo &lt;a href="https://github.com/sethsandaru/go-route-model-binding"&gt;Middleware - sethsandaru/go-route-model-binding&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please give it a ⭐ if you actually like/going to use it 💖&lt;/p&gt;

&lt;p&gt;I'm using that Middleware from my open-source project &lt;a href="https://github.com/sethsandaru/pheasant"&gt;(WIP) Pheasant - Dynamic CRUD Management&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have a nice weekend and happy go-coding!&lt;/p&gt;

</description>
      <category>go</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>TDD/Unit Testing with Laravel from a Real-life Project</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Sat, 04 Sep 2021 03:26:02 +0000</pubDate>
      <link>https://dev.to/sethsandaru/tdd-unit-testing-with-laravel-with-real-life-project-2oi2</link>
      <guid>https://dev.to/sethsandaru/tdd-unit-testing-with-laravel-with-real-life-project-2oi2</guid>
      <description>&lt;p&gt;Hey guys,&lt;/p&gt;

&lt;p&gt;I know for many developers out there, everybody always want to learn how to write unit testing, working with TDD (is basically code, write test, code, write test,....).&lt;/p&gt;

&lt;p&gt;But the thing is, every time you Google "how to write unit test", you'll get a bunch of articles. But most of them are just telling you the "definition" with some BS examples, that's all, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to write this test, that test,...&lt;/li&gt;
&lt;li&gt;Write a func &lt;code&gt;a + b = c&lt;/code&gt; then write test for the func &lt;code&gt;assertEquals(2, plus(1,1))&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Right? As a newbie (in term of unit testing), how I suppose to write a freaking test with that?&lt;/p&gt;

&lt;p&gt;We're living in the world where we write code that interacting with many things eg: Database, Services,... and &lt;code&gt;a+b=c&lt;/code&gt; is not gonna help you anything.&lt;/p&gt;

&lt;p&gt;To learn more about unit test (especially from scratch), the best way should be: Learning from a &lt;strong&gt;Real-life Project&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;So, I did prepare a simple Real-life Project using &lt;strong&gt;Laravel&lt;/strong&gt; to help you guys learn unit testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Meet KivaNote
&lt;/h2&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/sethsandaru/kiva-laravel-tdd"&gt;https://github.com/sethsandaru/kiva-laravel-tdd&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A simple application which provides APIs for Simple Note app.&lt;/p&gt;

&lt;h3&gt;
  
  
  Test definition in KivaNote
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Unit Test

&lt;ul&gt;
&lt;li&gt;Where we're going to test methods of the Class&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Quick Test

&lt;ul&gt;
&lt;li&gt;Same as Unit, but this test won't involve database, all we need to do is mocking then testing.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Feature Test

&lt;ul&gt;
&lt;li&gt;HTTP Test to test the endpoints, checking the results,...&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What did I cover?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;All endpoints&lt;/li&gt;
&lt;li&gt;Mostly all methods that the application is gonna use&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Coverage is &lt;strong&gt;87%&lt;/strong&gt;, which is absolutely high and would give us a lot of confident.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where should I start?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;First let's have a overall look at the project

&lt;ul&gt;
&lt;li&gt;Routes&lt;/li&gt;
&lt;li&gt;Controllers&lt;/li&gt;
&lt;li&gt;Requests&lt;/li&gt;
&lt;li&gt;Services&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Second, let's read the test cases, you would know what you need to test and how to write tests&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Future improvements
&lt;/h3&gt;

&lt;p&gt;Yes of course, I'm going to find more external services to integrate with the project so I can write more tests (testing external services)&lt;/p&gt;

&lt;p&gt;KivaNote has integrated with ImgBB, but seems like it's too easy haha. But it'll help.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final words
&lt;/h2&gt;

&lt;p&gt;Thanks, hope you guys enjoy it and give it a ⭐ on GitHub if it helps.&lt;/p&gt;

&lt;p&gt;Nice day guys!!&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>phpunit</category>
      <category>unittesting</category>
    </item>
    <item>
      <title>Laravel Mail Switcher</title>
      <dc:creator>Seth Phat</dc:creator>
      <pubDate>Sat, 08 May 2021 04:30:28 +0000</pubDate>
      <link>https://dev.to/sethsandaru/laravel-mail-switcher-197f</link>
      <guid>https://dev.to/sethsandaru/laravel-mail-switcher-197f</guid>
      <description>&lt;p&gt;Hi guys,&lt;/p&gt;

&lt;p&gt;Today I want to share a simple Library that I made for Laravel Application. It called &lt;strong&gt;Laravel Mail Switcher&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Github Repository: &lt;a href="https://github.com/sethsandaru/laravel-mail-switcher"&gt;https://github.com/sethsandaru/laravel-mail-switcher&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Use-case
&lt;/h2&gt;

&lt;p&gt;You have a personal Laravel Application (small or medium) or even you're a Startup. Of course, you have a tight budget.&lt;/p&gt;

&lt;p&gt;So you probably can't spend much money on Email Provider Services to send out your email to your Users/Customers.&lt;/p&gt;

&lt;p&gt;There are a lot of Email Provider Services out there that actually give you a &lt;strong&gt;specific amount per month (for free)&lt;/strong&gt; to send out emails.&lt;/p&gt;

&lt;p&gt;So, with Laravel Mail Switcher, you will have a big advantage to achieve that. It will automatically &lt;strong&gt;switch&lt;/strong&gt; to another email credential once the old one is out of usage for the current week/month.&lt;/p&gt;

&lt;p&gt;You don't have to change the &lt;strong&gt;ENV&lt;/strong&gt; every time one of the services is running out of usage.&lt;/p&gt;

&lt;p&gt;You don't need to manually check to see if the email is running out.&lt;/p&gt;

&lt;p&gt;All you need to do is prepare the credential/information and let Laravel Mail Switcher will do that for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Email Services with Free Usage
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Mailgun: 5000 emails for 3-month (about 1666/month)&lt;/li&gt;
&lt;li&gt;Mailjet: 6000 emails per month (but 200 per day)&lt;/li&gt;
&lt;li&gt;Sendgrid: 100 emails per day (3000/month)&lt;/li&gt;
&lt;li&gt;Socketlabs: 2000/month (first month: 40000)&lt;/li&gt;
&lt;li&gt;Sendinblue: 300 per day (9000/month)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And many more... With Laravel Mail Switcher, you can manage the credentials and use all of them until the free usage ran out! Your applications would save a lot of money for emails!!&lt;/p&gt;

&lt;h2&gt;
  
  
  How to install?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Requirement
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Laravel 8.x&lt;/li&gt;
&lt;li&gt;PHP 7.4 or later&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer require sethsandaru/laravel-mail-switcher
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Visit this: &lt;a href="https://github.com/sethsandaru/laravel-mail-switcher#how-to-use"&gt;Setting Guide&lt;/a&gt; to complete the installation!&lt;/p&gt;

&lt;h2&gt;
  
  
  In Conclusions
&lt;/h2&gt;

&lt;p&gt;Personally, I got some personal projects and with this opportunity, I don't have to worry about emails anymore (Really budget projects 🤣)&lt;/p&gt;

&lt;p&gt;Thanks for reading! Give it a ⭐ if you find out it's useful!&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>mail</category>
      <category>cool</category>
    </item>
  </channel>
</rss>
