<?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: Samuel Osho</title>
    <description>The latest articles on DEV Community by Samuel Osho (@version_control_dev).</description>
    <link>https://dev.to/version_control_dev</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%2F3572132%2F1c8e3eed-1c74-4c6f-b6c8-a7005e4dfdbb.jpeg</url>
      <title>DEV Community: Samuel Osho</title>
      <link>https://dev.to/version_control_dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/version_control_dev"/>
    <language>en</language>
    <item>
      <title>How to Deploy a Laravel API Easily Using Render</title>
      <dc:creator>Samuel Osho</dc:creator>
      <pubDate>Sat, 18 Oct 2025 09:44:24 +0000</pubDate>
      <link>https://dev.to/version_control_dev/how-to-deploy-a-laravel-api-easily-using-render-59lh</link>
      <guid>https://dev.to/version_control_dev/how-to-deploy-a-laravel-api-easily-using-render-59lh</guid>
      <description>&lt;h1&gt;
  
  
  🚀 How to Deploy a Laravel API Easily Using Render
&lt;/h1&gt;

&lt;p&gt;Hey fellow developers 👋&lt;/p&gt;

&lt;p&gt;I recently completed &lt;strong&gt;Stage 0 of the HNG i13 Backend Track&lt;/strong&gt;, where I built a &lt;strong&gt;dynamic Laravel API endpoint&lt;/strong&gt; that returns my profile info along with a random cat fact. During this process, I explored &lt;strong&gt;different ways to deploy Laravel apps on Render&lt;/strong&gt;, and I wanted to share my experience so others can learn and experiment.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 The Goal
&lt;/h2&gt;

&lt;p&gt;Create a simple API endpoint:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/api/me&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That returns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Email, name, and backend stack&lt;/li&gt;
&lt;li&gt;Current UTC timestamp (ISO 8601)&lt;/li&gt;
&lt;li&gt;A dynamic cat fact fetched from &lt;a href="https://catfact.ninja/fact" rel="noopener noreferrer"&gt;Cat Facts API&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⚙️ Tools &amp;amp; Technologies
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Laravel 11&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PHP HTTP Client&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Carbon&lt;/strong&gt; for timestamps&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Render.com&lt;/strong&gt; for hosting (Docker support)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🛠️ Two Ways to Deploy Laravel on Render
&lt;/h2&gt;

&lt;p&gt;During my deployment process, I learned there are &lt;strong&gt;two main approaches&lt;/strong&gt;:&lt;/p&gt;

&lt;h3&gt;
  
  
  1️⃣ Fork Render’s Example Laravel Docker Repo (Recommended for beginners)
&lt;/h3&gt;

&lt;p&gt;Render provides a &lt;strong&gt;ready-made Laravel + Docker example repo&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Steps I followed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fork the repo: &lt;a href="https://github.com/render-examples/php-laravel-docker" rel="noopener noreferrer"&gt;https://github.com/render-examples/php-laravel-docker&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Add my &lt;code&gt;/api/me&lt;/code&gt; route directly in &lt;code&gt;routes/api.php&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Update &lt;code&gt;AppServiceProvider&lt;/code&gt; to force HTTPS in production:
&lt;/li&gt;
&lt;/ol&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;boot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;UrlGenerator&lt;/span&gt; &lt;span class="nv"&gt;$url&lt;/span&gt;&lt;span class="p"&gt;)&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="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'APP_ENV'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'production'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$url&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;forceScheme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'https'&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;ol&gt;
&lt;li&gt;Generate an &lt;code&gt;APP_KEY&lt;/code&gt; locally:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan key:generate &lt;span class="nt"&gt;--show&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Push changes to GitHub and connect the repo to Render&lt;/li&gt;
&lt;li&gt;Add environment variables (&lt;code&gt;APP_KEY&lt;/code&gt;, &lt;code&gt;APP_ENV=production&lt;/code&gt;, &lt;code&gt;APP_DEBUG=false&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Render builds and deploys automatically 🚀&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;✅ Pros: Quick, minimal setup, ideal for small projects or testing APIs&lt;br&gt;
❌ Cons: Less control over Docker customization&lt;/p&gt;

&lt;h3&gt;
  
  
  2️⃣ Deploy Your Own Laravel App Using Docker From Scratch
&lt;/h3&gt;

&lt;p&gt;For developers comfortable with Docker:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a &lt;strong&gt;Dockerfile&lt;/strong&gt; for PHP + Nginx&lt;/li&gt;
&lt;li&gt;Configure &lt;code&gt;.dockerignore&lt;/code&gt; to skip unnecessary files&lt;/li&gt;
&lt;li&gt;Add a &lt;strong&gt;startup script&lt;/strong&gt; to run:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--no-dev&lt;/span&gt;
php artisan config:cache
php artisan route:cache
php artisan migrate &lt;span class="nt"&gt;--force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Connect your GitHub repo to Render with Docker runtime&lt;/li&gt;
&lt;li&gt;Add environment variables as needed&lt;/li&gt;
&lt;li&gt;Render builds and deploys&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;✅ Pros: Full control, production-ready setup, scalable&lt;br&gt;
❌ Cons: Slightly more setup, more technical knowledge needed&lt;/p&gt;

&lt;h2&gt;
  
  
  📝 Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Even small API tasks teach &lt;strong&gt;good practices&lt;/strong&gt;: structured JSON, dynamic responses, error handling.&lt;/li&gt;
&lt;li&gt;Render makes deployment easy for both beginners and experienced devs.&lt;/li&gt;
&lt;li&gt;Using &lt;strong&gt;existing examples&lt;/strong&gt; can save time and reduce friction.&lt;/li&gt;
&lt;li&gt;Experimenting with both approaches helps you understand &lt;strong&gt;Dockerized vs. pre-configured hosting&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔗 References &amp;amp; Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live API Example&lt;/strong&gt;: &lt;a href="https://hng-13-stage0.onrender.com/api/me" rel="noopener noreferrer"&gt;https://hng-13-stage0.onrender.com/api/me&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repo&lt;/strong&gt;: &lt;a href="https://github.com/samthatcode/php-laravel-docker" rel="noopener noreferrer"&gt;https://github.com/samthatcode/php-laravel-docker&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://render.com/docs/deploy-php-laravel-docker" rel="noopener noreferrer"&gt;Render Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://catfact.ninja/fact" rel="noopener noreferrer"&gt;Cat Facts API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sharing this to help other Laravel devs &lt;strong&gt;deploy quickly, experiment, and learn&lt;/strong&gt;. Even small, fun APIs are a great way to &lt;strong&gt;practice dynamic data handling and deployment skills&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#Laravel #PHP #WebDevelopment #API #HNGi13 #Docker #Render #DevTips #LearningByDoing&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Dynamic Profile API</title>
      <dc:creator>Samuel Osho</dc:creator>
      <pubDate>Sat, 18 Oct 2025 07:53:55 +0000</pubDate>
      <link>https://dev.to/version_control_dev/dynamic-profile-api-1b6n</link>
      <guid>https://dev.to/version_control_dev/dynamic-profile-api-1b6n</guid>
      <description>&lt;h1&gt;
  
  
  HNG i13 Backend — Stage 0 Task: Dynamic Profile API
&lt;/h1&gt;

&lt;p&gt;Hey everyone 👋&lt;/p&gt;

&lt;p&gt;I just completed &lt;strong&gt;Stage 0&lt;/strong&gt; of the &lt;strong&gt;HNG i13 Backend Track&lt;/strong&gt;, where we were tasked with building a &lt;strong&gt;dynamic REST API&lt;/strong&gt; that returns our profile information along with a &lt;strong&gt;random cat fact&lt;/strong&gt; fetched from the &lt;a href="https://catfact.ninja/fact" rel="noopener noreferrer"&gt;Cat Facts API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Even as a Laravel developer, I love using these small tasks to experiment with &lt;strong&gt;different hosting setups and third-party integrations&lt;/strong&gt;, and I’m sharing this so others can learn and grow alongside me.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 What I Built
&lt;/h2&gt;

&lt;p&gt;I created a &lt;strong&gt;simple Laravel API endpoint&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/api/me&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The endpoint returns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;My &lt;strong&gt;email, name, and backend stack&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;timestamp&lt;/strong&gt; in ISO 8601 UTC format&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;dynamic cat fact&lt;/strong&gt; (fetched fresh on every request)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example response:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"success"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"version.control.dev@gmail.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Samuel Osho"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"stack"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Laravel/PHP"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2025-10-18T12:45:32.567Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"fact"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Cats sleep 70% of their lives."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


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

&lt;/div&gt;



&lt;h2&gt;
  
  
  ⚙️ Tools &amp;amp; Technologies
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Laravel 11&lt;/strong&gt; – my go-to PHP framework&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PHP HTTP Client&lt;/strong&gt; – for consuming the Cat Facts API&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Carbon&lt;/strong&gt; – for UTC timestamp formatting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Render.com&lt;/strong&gt; – experimenting with Docker-based deployment&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧠 What I Learned / Tips for Others
&lt;/h2&gt;

&lt;p&gt;Even as someone familiar with Laravel, this small project reinforced some key practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to &lt;strong&gt;integrate external APIs&lt;/strong&gt; cleanly within a Laravel route&lt;/li&gt;
&lt;li&gt;Handling API failures gracefully using &lt;strong&gt;try/catch and fallback messages&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Returning &lt;strong&gt;well-structured JSON responses&lt;/strong&gt; following strict schema requirements&lt;/li&gt;
&lt;li&gt;Deploying Laravel projects quickly using &lt;strong&gt;Render’s Docker hosting&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re new to backend APIs, these are simple steps that can help you &lt;strong&gt;practice API consumption, JSON formatting, and dynamic data handling&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔗 Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Endpoint:&lt;/strong&gt; &lt;a href="https://hng-13-stage0.onrender.com/api/me" rel="noopener noreferrer"&gt;https://hng-13-stage0.onrender.com/api/me&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repo:&lt;/strong&gt; &lt;a href="https://github.com/samthatcode/php-laravel-docker" rel="noopener noreferrer"&gt;https://github.com/samthatcode/php-laravel-docker&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧭 Next Steps
&lt;/h2&gt;

&lt;p&gt;I’m excited for the upcoming stages!&lt;br&gt;
Even small tasks like this remind us that &lt;strong&gt;good practices in API design, error handling, and dynamic responses&lt;/strong&gt; are what separate simple code from robust, production-ready systems.&lt;/p&gt;

&lt;p&gt;Sharing this to help others &lt;strong&gt;experiment, learn, and grow&lt;/strong&gt; — because the best way to improve is to &lt;strong&gt;build, break, and iterate together&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#HNGi13 #BackendDevelopment #Laravel #PHP #WebDevelopment #LearningByDoing #API #HNGInternship #RESTAPI #DevTips&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>laravel</category>
      <category>api</category>
      <category>backend</category>
    </item>
  </channel>
</rss>
