<?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>Forem: AdriánColom</title>
    <description>The latest articles on Forem by AdriánColom (@adriancolom).</description>
    <link>https://forem.com/adriancolom</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%2F2607500%2Fa8bb9e0a-d541-4bee-be1f-dea9f74360cf.jpg</url>
      <title>Forem: AdriánColom</title>
      <link>https://forem.com/adriancolom</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/adriancolom"/>
    <language>en</language>
    <item>
      <title>⏰ Limited-Time VPS Offers: cheapest high-RAM VPS🚀</title>
      <dc:creator>AdriánColom</dc:creator>
      <pubDate>Sat, 22 Feb 2025 11:46:19 +0000</pubDate>
      <link>https://forem.com/adriancolom/limited-time-vps-offers-cheapest-high-ram-vps-38cj</link>
      <guid>https://forem.com/adriancolom/limited-time-vps-offers-cheapest-high-ram-vps-38cj</guid>
      <description>&lt;p&gt;Deploying your app shouldn’t feel like waiting for paint to dry. If you're a web developer looking for speed without draining your wallet, check out my ultimate guide on launching your app fast and cheap with Coolify, Namecheap, and LuxVPS: &lt;a href="https://dev.to/adriancolom/deploy-your-app-super-fast-and-cheap-with-coolify-8bc"&gt;Deploy Your App Super Fast and Cheap&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But wait—there's more! LuxVPS is offering two killer high-RAM VPS packages that pack a punch:&lt;/p&gt;

&lt;p&gt;⚫ &lt;a href="https://billing.luxvps.net/aff.php?aff=166" rel="noopener noreferrer"&gt;Black Luxury Deal #1 – The Performance Beast&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;26GB DDR4 RAM&lt;/li&gt;
&lt;li&gt;4 vCores (Xeon Gold-powered)&lt;/li&gt;
&lt;li&gt;150GB NVMe Storage&lt;/li&gt;
&lt;li&gt;40TB Traffic&lt;/li&gt;
&lt;li&gt;Only €10/month (PERMANENT PRICE)&lt;/li&gt;
&lt;li&gt;44 LEFT!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚫ &lt;a href="https://billing.luxvps.net/aff.php?aff=166" rel="noopener noreferrer"&gt;Black Luxury Deal #2 – The Smart Choice&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;20GB DDR4 RAM&lt;/li&gt;
&lt;li&gt;4 vCores (Xeon Gold-powered)&lt;/li&gt;
&lt;li&gt;150GB NVMe Storage&lt;/li&gt;
&lt;li&gt;35TB Traffic&lt;/li&gt;
&lt;li&gt;Only €7.99/month (PERMANENT PRICE)&lt;/li&gt;
&lt;li&gt;39 LEFT!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftkdv4ofe7vggnd5ivavo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftkdv4ofe7vggnd5ivavo.png" alt="Go to offer" width="800" height="66"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine your app running at lightning speed with enterprise-grade hardware, premium DDoS protection, and NVMe storage that keeps up with your coding frenzy—all at nearly 50% below market rates!&lt;/p&gt;

&lt;p&gt;Ready to level up your deployment game? Grab your VPS through my affiliate link: &lt;a href="https://billing.luxvps.net/aff.php?aff=166" rel="noopener noreferrer"&gt;Grab Your VPS before these deals vanish!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>devops</category>
      <category>programming</category>
      <category>news</category>
    </item>
    <item>
      <title>Deploy Your App Super Fast and Cheap with Coolify 🤑⚡</title>
      <dc:creator>AdriánColom</dc:creator>
      <pubDate>Tue, 04 Feb 2025 14:30:00 +0000</pubDate>
      <link>https://forem.com/adriancolom/deploy-your-app-super-fast-and-cheap-with-coolify-8bc</link>
      <guid>https://forem.com/adriancolom/deploy-your-app-super-fast-and-cheap-with-coolify-8bc</guid>
      <description>&lt;p&gt;Are you tired of wasting money on clunky deployment services? Want your app deployed faster than you can say “continuous integration”? Look no further — this guide is your one-way ticket to speedy, cost-effective deployments using Coolify on a VPS. With a little help from LuxVPS and NameCheap, you’ll be up and running without emptying your wallet.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note:&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;While I use a Laravel app as an example, you can deploy whatever application you prefer. And when it comes to environment variables, don’t worry about checking sensitive info into your repository — you can easily configure them directly within Coolify.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  1. Get the Right Tools Without Breaking the Bank
&lt;/h3&gt;

&lt;h4&gt;
  
  
  VPS: &lt;a href="https://billing.luxvps.net/aff.php?aff=166" rel="noopener noreferrer"&gt;LuxVPS&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;I recommend &lt;a href="https://billing.luxvps.net/aff.php?aff=166" rel="noopener noreferrer"&gt;LuxVPS&lt;/a&gt; for an affordable, reliable VPS solution. Their monthly pricing is hard to beat if you want performance without a premium price tag. If you want to support me use my link ❤ &lt;a href="https://billing.luxvps.net/aff.php?aff=166" rel="noopener noreferrer"&gt;LINK&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Domain: &lt;a href="https://namecheap.pxf.io/xL2onv" rel="noopener noreferrer"&gt;NameCheap&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;For your domain, NameCheap is the way to go. Their prices are budget-friendly, and setting up DNS is simple. Just create two A records:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;One for &lt;code&gt;@&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;One for &lt;code&gt;*&lt;/code&gt; (the wildcard)&lt;br&gt;&lt;br&gt;
Both should point to the IP of your VPS.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to support me use my link ❤ &lt;a href="https://namecheap.pxf.io/xL2onv" rel="noopener noreferrer"&gt;LINK&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  SSH Access: PuTTY for Windows
&lt;/h4&gt;

&lt;p&gt;If you’re on Windows, I personally rely on PuTTY for SSH access. It’s straightforward and gets you connected without any fuss.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Installing Coolify on Your VPS
&lt;/h3&gt;

&lt;p&gt;With your VPS ready, it’s time to install Coolify — your new deployment best friend. Log in to your VPS via SSH (using PuTTY if you’re on Windows) and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -fsSL https://cdn.coollabs.io/coolify/install.sh | sudo bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command pulls down and installs Coolify in a snap. Once it’s done, open your browser and navigate to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://your-vps-ip:8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Register your account and log in. When prompted, choose the &lt;strong&gt;“install in localhost”&lt;/strong&gt; option. Next, go to the sidebar settings and set your Coolify access domain (for example, &lt;code&gt;coolify.yourdomain.com&lt;/code&gt;). Then, in the server settings, update the domain field with your wildcard domain. And just like that, Coolify is set up and ready to rock!&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Deploying Your App from GitHub
&lt;/h3&gt;

&lt;p&gt;Time to put the “deploy” in “deployment” and get your app live — be it Laravel or any other framework of your choosing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3.1: Create a New Project &amp;amp; Add a Resource
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Log into Coolify:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Head to your Coolify dashboard in your browser.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create a New Project:&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Click on “Projects” and then “Add Resource.”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select &lt;strong&gt;Private Repository&lt;/strong&gt; using the GitHub app integration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on &lt;strong&gt;Register New App&lt;/strong&gt;, then &lt;strong&gt;Register Now&lt;/strong&gt; to authorize Coolify with your GitHub account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once logged in, search for and select your repository.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Configure the Project Settings:&lt;/strong&gt;
A form will appear where you can specify:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The branch to deploy (typically &lt;strong&gt;main&lt;/strong&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The build pack and the port. For instance, if you’re deploying a Laravel app, change the port to &lt;strong&gt;80&lt;/strong&gt; (check out the &lt;a href="https://coolify.io/docs/applications/laravel" rel="noopener noreferrer"&gt;Coolify docs for Laravel&lt;/a&gt; for details).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; You’re not limited to Laravel — deploy what works best for your project!&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3.2: Set Up Your &lt;code&gt;nixpacks.toml&lt;/code&gt; File
&lt;/h3&gt;

&lt;p&gt;Inside your repository, create (or update) a &lt;code&gt;nixpacks.toml&lt;/code&gt; file with your build configuration. Below is an example configuration for a Laravel app that uses Nginx, PHP-FPM, and Supervisord. Feel free to adjust it based on your app’s needs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[phases.setup]
nixPkgs = ["...", "python311Packages.supervisor"]

[phases.build]
cmds = [
    "mkdir -p /etc/supervisor/conf.d/",
    "cp /assets/worker-*.conf /etc/supervisor/conf.d/",
    "cp /assets/supervisord.conf /etc/supervisord.conf",
    "chmod +x /assets/start.sh",
    "..."
]

[start]
cmd = '/assets/start.sh'

[staticAssets]
"start.sh" = '''
#!/bin/bash

# Transform the nginx configuration
node /assets/scripts/prestart.mjs /assets/nginx.template.conf /etc/nginx.conf

# Start supervisor
supervisord -c /etc/supervisord.conf -n
'''

"supervisord.conf" = '''
[unix_http_server]
file=/assets/supervisor.sock

[supervisord]
logfile=/var/log/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/assets/supervisord.pid
nodaemon=false
silent=false
minfds=1024
minprocs=200

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///assets/supervisor.sock

[include]
files = /etc/supervisor/conf.d/*.conf
'''

"worker-nginx.conf" = '''
[program:worker-nginx]
process_name=%(program_name)s_%(process_num)02d
command=nginx -c /etc/nginx.conf
autostart=true
autorestart=true
stdout_logfile=/var/log/worker-nginx.log
stderr_logfile=/var/log/worker-nginx.log
'''

"worker-phpfpm.conf" = '''
[program:worker-phpfpm]
process_name=%(program_name)s_%(process_num)02d
command=php-fpm -y /assets/php-fpm.conf -F
autostart=true
autorestart=true
stdout_logfile=/var/log/worker-phpfpm.log
stderr_logfile=/var/log/worker-phpfpm.log
'''

"worker-laravel.conf" = '''
[program:worker-laravel]
process_name=%(program_name)s_%(process_num)02d
command=bash -c 'exec php /app/artisan queue:work --sleep=3 --tries=3 --max-time=3600'
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
numprocs=12
startsecs=0
stopwaitsecs=3600
stdout_logfile=/var/log/worker-laravel.log
stderr_logfile=/var/log/worker-laravel.log
'''

"php-fpm.conf" = '''
[www]
listen = 127.0.0.1:9000
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 50
pm.min_spare_servers = 4
pm.max_spare_servers = 32
pm.start_servers = 18
clear_env = no
'''

"nginx.template.conf" = '''
user www-data www-data;
worker_processes 5;
daemon off;

worker_rlimit_nofile 8192;

events {
  worker_connections  4096;  # Default: 1024
}

http {
    include    $!{nginx}/conf/mime.types;
    index    index.html index.htm index.php;

    default_type application/octet-stream;
    log_format   main '$remote_addr - $remote_user [$time_local]  $status '
        '"$request" $body_bytes_sent "$http_referer" '
        '"$http_user_agent" "$http_x_forwarded_for"';
    access_log /var/log/nginx-access.log;
    error_log /var/log/nginx-error.log;
    sendfile     on;
    tcp_nopush   on;
    server_names_hash_bucket_size 128; # this seems to be required for some vhosts

    server {
        listen ${PORT};
        listen [::]:${PORT};
        server_name localhost;

        $if(NIXPACKS_PHP_ROOT_DIR) (
            root ${NIXPACKS_PHP_ROOT_DIR};
        ) else (
            root /app;
        )

        add_header X-Content-Type-Options "nosniff";

        client_max_body_size 35M;

        index index.php;

        charset utf-8;

        $if(NIXPACKS_PHP_FALLBACK_PATH) (
            location / {
                try_files $uri $uri/ ${NIXPACKS_PHP_FALLBACK_PATH}?$query_string;
            }
        ) else (
          location / {
                try_files $uri $uri/ /index.php?$query_string;
           }
        )

        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }

        $if(IS_LARAVEL) (
            error_page 404 /index.php;
        ) else ()

        location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
            include $!{nginx}/conf/fastcgi_params;
            include $!{nginx}/conf/fastcgi.conf;

            fastcgi_param PHP_VALUE "upload_max_filesize=30M \n post_max_size=35M";
        }

        location ~ /\.(?!well-known).* {
            deny all;
        }
    }
}
'''
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3.3: Environment Variables
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Do &lt;strong&gt;not&lt;/strong&gt; commit your environment variables into your repository. Instead, add them in the Coolify project configuration. This keeps your sensitive data secure and separate from your codebase.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3.4: Final Domain Tweaks
&lt;/h3&gt;

&lt;p&gt;In your project settings within Coolify, update the domain configuration to your production domain. Once set up, every push to your main branch will trigger an automatic deployment. Sit back and watch the magic happen — deployments so fast you might even beat your coffee break!&lt;/p&gt;




&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;Deploying your app doesn’t have to be expensive or complicated. With &lt;a href="https://billing.luxvps.net/aff.php?aff=166" rel="noopener noreferrer"&gt;LuxVPS&lt;/a&gt; keeping costs low, &lt;a href="https://namecheap.pxf.io/xL2onv" rel="noopener noreferrer"&gt;NameCheap&lt;/a&gt; securing your domain, and Coolify automating the process, you’re ready to roll out updates faster than ever before. Whether you’re deploying a Laravel app or any other project, this setup is designed to be simple, efficient, and incredibly cost-effective.&lt;/p&gt;

&lt;p&gt;Happy coding — and even happier deploying! Remember, every push to your main branch means another set-it-and-forget-it deployment. Enjoy the speed and savings!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Questions? Comments? Drop them below and let’s chat about all things fast, frugal, and full-stack!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>tooling</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>php</category>
    </item>
    <item>
      <title>The Ultimate VPS Showdown: Hetzner, Ionos, and LuxVPS — Who’s Your Budget Buddy? 🎉</title>
      <dc:creator>AdriánColom</dc:creator>
      <pubDate>Tue, 14 Jan 2025 07:00:00 +0000</pubDate>
      <link>https://forem.com/adriancolom/the-ultimate-vps-showdown-hetzner-ionos-and-luxvps-whos-your-budget-buddy-2gmm</link>
      <guid>https://forem.com/adriancolom/the-ultimate-vps-showdown-hetzner-ionos-and-luxvps-whos-your-budget-buddy-2gmm</guid>
      <description>&lt;p&gt;If you’ve ever wondered which VPS provider gives the best bang for your buck, you’ve come to the right corner of the internet. Let’s break down three popular options — &lt;strong&gt;Hetzner&lt;/strong&gt;, &lt;strong&gt;Ionos&lt;/strong&gt;, and &lt;a href="https://billing.luxvps.net/aff.php?aff=166" rel="noopener noreferrer"&gt;&lt;strong&gt;LuxVPS&lt;/strong&gt;&lt;/a&gt; — to find out where your precious euros (or dollars, or whatever) should go. Spoiler alert: It might depend on your project size, future plans, or just how much caffeine you’ve had when reading this.&lt;/p&gt;




&lt;h3&gt;
  
  
  Hetzner: The German Workhorse 🐴
&lt;/h3&gt;

&lt;p&gt;Hetzner is like that overachieving friend who also runs marathons: reliable, robust, and always a good choice for big projects. With a variety of shared and dedicated plans, here’s what you can expect:&lt;/p&gt;

&lt;h3&gt;
  
  
  Shared VPS Highlights:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CX22&lt;/strong&gt;: 2 vCPUs, 4 GB RAM, 40 GB NVMe — €4.59/month&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CX42&lt;/strong&gt;: 8 vCPUs, 16 GB RAM, 160 GB NVMe — €19.84/month&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Perfect if you’re running scalable apps or testing production workloads.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Dedicated VPS Highlights:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CCX13&lt;/strong&gt;: 2 vCPUs, 8 GB RAM, 80 GB NVMe — €15.11/month&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CCX53&lt;/strong&gt;: 32 vCPUs, 128 GB RAM, 600 GB NVMe — €232.91/month&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dedicated servers shine for serious app scaling. Paired with integrations like &lt;strong&gt;Coolify&lt;/strong&gt;, Hetzner makes scaling a breeze.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Verdict&lt;/strong&gt;: For high-performance apps or production environments, Hetzner is a clear winner. But for budget-friendly projects, it’s not the cheapest.&lt;/p&gt;




&lt;h3&gt;
  
  
  Ionos: The Budget-Friendly Newbie 🤑
&lt;/h3&gt;

&lt;p&gt;If you’re just dipping your toes into the VPS world, Ionos feels like the dollar-store option that surprisingly works pretty well.&lt;/p&gt;

&lt;h3&gt;
  
  
  VPS Highlights:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Linux XS&lt;/strong&gt;: 1 vCore, 1 GB RAM, 10 GB NVMe — €1/month (setup fee: €10)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Linux L&lt;/strong&gt;: 4 vCores, 8 GB RAM, 240 GB NVMe — €10/month for six months (then 14€)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prices increase after promotional periods, so read the fine print! 👀&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Verdict&lt;/strong&gt;: Great for small websites or projects on a shoestring budget. If you’re looking for sustained savings, though, you might outgrow it fast.&lt;/p&gt;




&lt;h3&gt;
  
  
  LuxVPS: The Underdog with Killer Deals 🎯
&lt;/h3&gt;

&lt;p&gt;LuxVPS may not have the biggest brand name, but its pricing is unbeatable, especially during deals like &lt;strong&gt;Black Friday&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;VPS Highlights:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tiny Plan&lt;/strong&gt;: 2 vCore, 6GB RAM DDR4, 30 GB NVMe — €5.50/month&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Starter Plan&lt;/strong&gt;: 2 vCores, 8 GB RAM DDR4, 50 GB NVMe — &lt;strong&gt;€7.45/month&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mega Plan&lt;/strong&gt;: 4 vCores, 16 GB RAM DDR4, 150 GB NVMe — &lt;strong&gt;€11.45/month&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Black Friday Magic:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;4 vCores, 26 GB RAM&lt;/strong&gt; — €10/month 🔥(I have this one)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Verdict&lt;/strong&gt;: For budget-conscious users who love a good deal, LuxVPS is a no-brainer. While it lacks Hetzner’s fancy scaling options, the price-performance ratio is stellar for small to mid-sized projects. Bonus: Use my referral link to save a little extra. 😉&lt;/p&gt;

&lt;p&gt;This is my favorite one to use with my clients, because it comes with an administration panel where you can put your brand and give only permission to the client to their server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://billing.luxvps.net/aff.php?aff=166" rel="noopener noreferrer"&gt;REFERAL LINK&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  TL;DR: Which VPS Wins? 🏆
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Big, scalable apps&lt;/strong&gt;? Go with Hetzner. Their dedicated servers and integrations make them the ideal choice for larger projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tight budget or small projects&lt;/strong&gt;? LuxVPS offers unbeatable value and frequent promotions. &lt;a href="https://billing.luxvps.net/aff.php?aff=166" rel="noopener noreferrer"&gt;REFERAL LINK&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Temporary or entry-level projects&lt;/strong&gt;? Ionos’ initial discounts are tempting but come with a setup fee.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Final Thoughts:
&lt;/h3&gt;

&lt;p&gt;When it comes to choosing a VPS, there’s no one-size-fits-all. Think about your project size, future growth, and budget. And hey, if you’re leaning toward LuxVPS, don’t forget that referral link — it might just cover my coffee for the month! ☕&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>startup</category>
      <category>devops</category>
    </item>
    <item>
      <title>Unlock Laravel Code Generation (Part 3): Automating Validation from Your Database Schema 🤯🚀</title>
      <dc:creator>AdriánColom</dc:creator>
      <pubDate>Mon, 06 Jan 2025 07:00:00 +0000</pubDate>
      <link>https://forem.com/adriancolom/unlock-laravel-code-generation-part-3-automating-validation-from-your-database-schema-2fk8</link>
      <guid>https://forem.com/adriancolom/unlock-laravel-code-generation-part-3-automating-validation-from-your-database-schema-2fk8</guid>
      <description>&lt;p&gt;In previous posts, we’ve explored using Laravel stubs to streamline code generation. In this installment, we’ll zoom in on a specific example: &lt;strong&gt;automatically creating validation rules&lt;/strong&gt; for your models by extracting metadata from your database schema.&lt;/p&gt;

&lt;p&gt;Ready to supercharge your Laravel development? Let’s dive in!&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Automate Code Generation?
&lt;/h3&gt;

&lt;p&gt;Building code by hand — especially boilerplate like CRUD and validation — is time-consuming, repetitive, and prone to human error. When you integrate automation into your workflow, you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stay in Sync&lt;/strong&gt;: Whenever you add or remove columns from your database, you can regenerate code with a single command.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Improve Consistency&lt;/strong&gt;: Every generated file follows a uniform structure and coding standard.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reduce Manual Labor&lt;/strong&gt;: Focus on your application’s unique features, not on repetitive tasks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;TIME&lt;/strong&gt;: Reduce repetitive boilerplate when adding or modifying columns.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Extracting Your Database Schema
&lt;/h3&gt;

&lt;p&gt;The first step in this automation journey is extracting your database schema. We want to transform our table definitions into a JSON file — a format that’s easy to read, modify, and feed into a code generation process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Extracting the Schema into JSON
&lt;/h3&gt;

&lt;p&gt;The first step is to pull table information — like columns and indexes — into a JSON file. Below is a minimal snippet (from a larger &lt;code&gt;TableUtils&lt;/code&gt; class that I use in my bigger project, follow me for future projects and updates!) that demonstrates capturing columns for a given table:&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;// TableUtils snippet&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;getTableInfo&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;Collection&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Ensure the table exists&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="nc"&gt;Schema&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;hasTable&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;table&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;\Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Table &lt;/span&gt;&lt;span class="si"&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;table&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; not found"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nv"&gt;$columns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Schema&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;getColumns&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;table&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
        &lt;span class="s1"&gt;'model'&lt;/span&gt;   &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Str&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;studly&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Str&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;singular&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;table&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
        &lt;span class="s1"&gt;'table'&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;table&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'columns'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$columns&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;You then convert this collection to JSON and save it to a file — say, &lt;code&gt;schema/categories.json&lt;/code&gt;. ( For not do the query all the 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="p"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"model"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Category"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"table"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"categories"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"columns"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"bigint(20) unsigned"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;"nullable"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"varchar(255)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;"nullable"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"created_at"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;"nullable"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"updated_at"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;"nullable"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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;h3&gt;
  
  
  Minimal Form Request Stub
&lt;/h3&gt;

&lt;p&gt;Next, we create a &lt;strong&gt;tiny stub&lt;/strong&gt; representing a Form Request in Laravel that we learned to do in the first part:&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Foundation\Http\FormRequest&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Store&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="n"&gt;modelName&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="nc"&gt;Request&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;FormRequest&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;authorize&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="kc"&gt;true&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;rules&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="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="n"&gt;validationRules&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;h3&gt;
  
  
  Generating the Validation Rules Automatically
&lt;/h3&gt;

&lt;p&gt;Here’s a small command that reads the JSON, analyzes each column, and injects an appropriate validation rule into the stub, we learned to combine the stub and the command in the part 2:&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Console\Command&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Support\Facades\File&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GenerateValidation&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$signature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'generate:validation {table}'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Generates a Form Request validation file from a table schema JSON'&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;handle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$table&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;argument&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'table'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nv"&gt;$schemaPath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;base_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"schema/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.json"&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="nc"&gt;File&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$schemaPath&lt;/span&gt;&lt;span class="p"&gt;))&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;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Schema JSON for table [&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;] not found at: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$schemaPath&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&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="p"&gt;}&lt;/span&gt;

        &lt;span class="c1"&gt;// Load the schema&lt;/span&gt;
        &lt;span class="nv"&gt;$schema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;json_decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;File&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$schemaPath&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Load our stub&lt;/span&gt;
        &lt;span class="nv"&gt;$validationStub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;File&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;base_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'stubs/validation.stub'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

        &lt;span class="c1"&gt;// Build rules based on columns&lt;/span&gt;
        &lt;span class="nv"&gt;$rules&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$schema&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'columns'&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;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$column&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nv"&gt;$ruleParts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

            &lt;span class="c1"&gt;// Required or nullable&lt;/span&gt;
            &lt;span class="nv"&gt;$ruleParts&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$column&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'nullable'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s1"&gt;'nullable'&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'required'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

            &lt;span class="c1"&gt;// Quick example for strings&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;preg_match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/varchar\((\d+)\)/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$column&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'type'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nv"&gt;$matches&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nv"&gt;$maxLength&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$matches&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
                &lt;span class="nv"&gt;$ruleParts&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'string'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="nv"&gt;$ruleParts&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"max:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$maxLength&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&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;// Could expand for other types (e.g., integer, date)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$column&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'name'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;' =&amp;gt; '"&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nb"&gt;implode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'|'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$ruleParts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;"'"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;implode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;",&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;            "&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Insert the rules into the stub&lt;/span&gt;
        &lt;span class="nv"&gt;$validationStub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'{{modelName}}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$schema&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'model'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nv"&gt;$validationStub&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nv"&gt;$validationStub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'{{validationRules}}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$rules&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$validationStub&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Save to app/Http/Requests&lt;/span&gt;
        &lt;span class="nv"&gt;$filename&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Store&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$schema&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'model'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;Request.php"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nc"&gt;File&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;app_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Http/Requests/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$filename&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nv"&gt;$validationStub&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;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Validation file for [&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$schema&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'model'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;] created: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$filename&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&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;h3&gt;
  
  
  How It Works:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Load the JSON&lt;/strong&gt;: We retrieve our table’s schema file (e.g., &lt;code&gt;categories.json&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Parse Columns&lt;/strong&gt;: Each column is analyzed to see if it’s nullable or has a &lt;code&gt;varchar(x)&lt;/code&gt; type.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Build a Rule String&lt;/strong&gt;: For instance, a non-nullable &lt;code&gt;varchar(255)&lt;/code&gt; becomes &lt;code&gt;required|string|max:255&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inject into Stub&lt;/strong&gt;: The placeholder &lt;code&gt;{{validationRules}}&lt;/code&gt; is replaced with the built rule strings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Generate a File&lt;/strong&gt;: The final &lt;code&gt;StoreCategoryRequest.php&lt;/code&gt; is written out, ready to use in your Laravel app.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Why This Matters
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Saves Time&lt;/strong&gt;: You never have to manually type out &lt;code&gt;required|string|max:255&lt;/code&gt; again.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Prevents Errors&lt;/strong&gt;: Changes to the database propagate to your validation rules at the push of a button.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Easy to Extend&lt;/strong&gt;: Add logic for integers, dates, or enums — whatever fits your schema.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Looking Ahead
&lt;/h3&gt;

&lt;p&gt;This is just the tip of the iceberg. Once you’re comfortable with automating models, controllers, and validation, you can expand to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;View Generation&lt;/strong&gt;: Use your schema to generate Blade templates for listing, creating, editing, and viewing records.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;API Resources&lt;/strong&gt;: Automatically build out API controllers, routes, and resource classes based on your schema.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Relationships&lt;/strong&gt;: Incorporate foreign key data to automatically generate &lt;code&gt;hasOne&lt;/code&gt;, &lt;code&gt;hasMany&lt;/code&gt;, &lt;code&gt;belongsTo&lt;/code&gt;, etc. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For now, the approach outlined here provides a powerful foundation for automating a large chunk of your Laravel development workflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;By leveraging your database schema to generate validation rules, you take another step toward a fully automated code generation pipeline. You can apply the same principles to build models, controllers, and more—giving you a robust, scalable, and maintainable development process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Takeaways&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Centralize Validation&lt;/strong&gt;: Keep your form requests always aligned with the actual database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Minimize Manual Upkeep&lt;/strong&gt;: Regenerate whenever columns change, letting the script do the heavy lifting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Extend as Needed&lt;/strong&gt;: Add rules for more data types (e.g., integer, decimal, date) as your application grows.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this setup, you’ll never again have to track column changes in multiple places—your database schema becomes the single source of truth. Happy coding, and may all your validations be precise!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;P.S. If you’re as excited as I am about this upcoming tool, be sure to subscribe to my newsletter or follow me on social media for the latest updates. Let’s revolutionize Laravel development together!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Unlock the code generation of Laravel (part 2): Stubs with Laravel Promts 💻🚀</title>
      <dc:creator>AdriánColom</dc:creator>
      <pubDate>Tue, 24 Dec 2024 14:43:56 +0000</pubDate>
      <link>https://forem.com/adriancolom/unlock-the-code-generation-of-laravel-part-2-stubs-with-laravel-promts-24kl</link>
      <guid>https://forem.com/adriancolom/unlock-the-code-generation-of-laravel-part-2-stubs-with-laravel-promts-24kl</guid>
      <description>&lt;p&gt;As developers, we’re always on the lookout for tools and techniques that make our work more efficient, customizable, and user-friendly. If you’re working with &lt;strong&gt;Laravel&lt;/strong&gt;, you’re in luck! Today, I’ll show you how to &lt;strong&gt;combine Laravel stubs&lt;/strong&gt; with the &lt;strong&gt;Laravel Prompts&lt;/strong&gt; package to create a fully customizable and interactive &lt;strong&gt;code generation workflow&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By the end of this guide, you’ll be able to generate code templates dynamically based on user input, all while maintaining the power and flexibility of Laravel’s built-in tools. Ready to supercharge your development process? Let’s dive in! 💪&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What Are Laravel Stubs?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Laravel stubs&lt;/strong&gt; are template files used to generate boilerplate code in Laravel projects. Think of them as skeleton code that Laravel uses for commands like &lt;code&gt;php artisan make:controller&lt;/code&gt; or &lt;code&gt;php artisan make:model&lt;/code&gt;. You can customize these stubs to fit your project's needs, ensuring that your generated code matches your architecture and coding standards.&lt;/p&gt;

&lt;p&gt;For example, by modifying the default &lt;code&gt;controller.stub&lt;/code&gt;, you can automatically include traits, middleware, or other boilerplate code every time you generate a new controller.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;How to Use and Customize Laravel Stubs&lt;/strong&gt;
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Locate and Publish Stubs:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Laravel keeps its default stubs hidden in the &lt;code&gt;vendor&lt;/code&gt; directory. You’ll need to publish them into your project if you want to customize them:&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="n"&gt;php&lt;/span&gt; &lt;span class="n"&gt;artisan&lt;/span&gt; &lt;span class="n"&gt;stub&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;publish&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will generate a &lt;code&gt;stubs&lt;/code&gt; directory in the root of your project where you can modify the available stubs, like &lt;code&gt;controller.stub&lt;/code&gt; or &lt;code&gt;model.stub&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Customize the Stub:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For example, let’s add a custom trait to the controller stub:&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;// controller.stub example&lt;/span&gt;
&lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="p"&gt;}};&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Traits\YourCustomTrait&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Http\Request&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;YourCustomTrait&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Custom methods&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, every time you generate a new controller, it will include the &lt;code&gt;YourCustomTrait&lt;/code&gt; by default.&lt;/p&gt;

&lt;p&gt;To see more about stubs see part 1:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://medium.com/@adriancolomp/unlock-the-magic-of-laravel-stubs-supercharge-your-code-generation-264a9540eb04?source=post_page-----dbd7de8cdbca--------------------------------" rel="noopener noreferrer"&gt;&lt;strong&gt;Unlock the Magic of Laravel Stubs: Supercharge Your Code Generation 🚀&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://medium.com/@adriancolomp/unlock-the-magic-of-laravel-stubs-supercharge-your-code-generation-264a9540eb04?source=post_page-----dbd7de8cdbca--------------------------------" rel="noopener noreferrer"&gt;Hello, Laravel enthusiasts! 🖐️ Welcome to the magical world of Laravel stubs — a powerful tool that can save you…&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://medium.com/@adriancolomp/unlock-the-magic-of-laravel-stubs-supercharge-your-code-generation-264a9540eb04?source=post_page-----dbd7de8cdbca--------------------------------" rel="noopener noreferrer"&gt;medium.com&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What Is Laravel Prompts?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Laravel Prompts&lt;/strong&gt; is an excellent package that adds interactive CLI prompts to your Laravel commands. Whether you need to gather user input or make your commands more dynamic, &lt;strong&gt;Laravel Prompts&lt;/strong&gt; makes it easy.&lt;/p&gt;

&lt;p&gt;Here’s how you can add interactive prompts to your Laravel commands using the package.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Installing Laravel Prompts&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;The latest versions of Laravel already include the Prompts package, so no need to install it separately. However, if you’re using a standalone PHP project, you can install it via Composer:&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="n"&gt;composer&lt;/span&gt; &lt;span class="k"&gt;require&lt;/span&gt; &lt;span class="n"&gt;laravel&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;prompts&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More in &lt;a href="https://laravel.com/docs/11.x/prompts" rel="noopener noreferrer"&gt;https://laravel.com/docs/11.x/prompts&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Combining Laravel Stubs and Prompts for Ultimate Flexibility&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Let’s combine &lt;strong&gt;Laravel stubs&lt;/strong&gt; with &lt;strong&gt;Laravel Prompts&lt;/strong&gt; to create an Artisan command that dynamically generates a controller based on user input!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 1: Create a Custom Artisan Command&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;First, we’ll generate a new Artisan command using Laravel’s &lt;code&gt;make:command&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:command GenerateCustomController
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new command file in &lt;code&gt;app/Console/Commands/GenerateCustomController.php&lt;/code&gt;. Now, let's edit this command to use Laravel Prompts and interact with our stubs.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 2: Add Interactive Prompts to the Command&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In our command, we’ll use the &lt;strong&gt;Laravel Prompts&lt;/strong&gt; package to gather user input. For example, we’ll ask the user for the name of the controller, whether it should be a resource controller, and if it should include any specific traits.&lt;/p&gt;

&lt;p&gt;Here’s the updated command:&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="cp"&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Console\Commands&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Console\Command&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;Laravel\Prompts\text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;Laravel\Prompts\confirm&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GenerateCustomController&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cd"&gt;/**
     * The name and signature of the console command.
     */&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$signature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'make:custom-controller'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="cd"&gt;/**
     * The console command description.
     */&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Generate a custom controller with interactive prompts'&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;handle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Prompt the user for the controller name&lt;/span&gt;
        &lt;span class="nv"&gt;$controllerName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Enter the name of the controller:'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Ask if the controller should be a resource controller&lt;/span&gt;
        &lt;span class="nv"&gt;$isResource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;confirm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Should this be a resource controller?'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;yes&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Yes, make it a resource controller'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;no&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'No, keep it simple'&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Confirm if a custom trait should be included&lt;/span&gt;
        &lt;span class="nv"&gt;$includeTrait&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;confirm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Do you want to include a custom trait?'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;hint&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'You can always add traits later if needed.'&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Create the file using the stub template&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;createController&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$controllerName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$isResource&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$includeTrait&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;createController&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$isResource&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$includeTrait&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Define the stub file to use&lt;/span&gt;
        &lt;span class="nv"&gt;$stubPath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;base_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'stubs/controller.stub'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nv"&gt;$stub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;file_get_contents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$stubPath&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Replace placeholders in the stub&lt;/span&gt;
        &lt;span class="nv"&gt;$stub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'{{ class }}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$stub&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;$isResource&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Modify stub to include resource methods&lt;/span&gt;
            &lt;span class="nv"&gt;$stub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'// Methods'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'public function index() {}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$stub&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="nv"&gt;$includeTrait&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Add trait usage&lt;/span&gt;
            &lt;span class="nv"&gt;$stub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'// Traits'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'use App\\Traits\\YourCustomTrait;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$stub&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nv"&gt;$stub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'// Traits'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$stub&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="c1"&gt;// Save the generated file&lt;/span&gt;
        &lt;span class="nv"&gt;$filePath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;app_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Http/Controllers/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.php"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nb"&gt;file_put_contents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$filePath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$stub&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;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Controller &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; created successfully!"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Prompts&lt;/strong&gt;: We ask the user for input using &lt;code&gt;text&lt;/code&gt; for the controller name and &lt;code&gt;confirm&lt;/code&gt; for yes/no questions. These prompts make the command more interactive and allow the user to customize the generated controller.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Custom Stub&lt;/strong&gt;: We load the controller stub file, replace placeholders (&lt;code&gt;{{ class }}&lt;/code&gt;), and adjust the content based on user input (whether to include a trait or resource methods).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Generating the File&lt;/strong&gt;: The final controller is saved to the &lt;code&gt;app/Http/Controllers&lt;/code&gt; directory.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;See more of commands at &lt;a href="https://laravel.com/docs/11.x/artisan#command-structure" rel="noopener noreferrer"&gt;https://laravel.com/docs/11.x/artisan#command-structure&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 3: Customize the Stub for Dynamic Options&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now, let’s update the &lt;code&gt;controller.stub&lt;/code&gt; file to accommodate the changes based on the user’s input.&lt;/p&gt;

&lt;p&gt;Here’s an example of the updated &lt;code&gt;controller.stub&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="p"&gt;}};&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Http\Request&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Traits&lt;/span&gt;

&lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Traits&lt;/span&gt;

    &lt;span class="c1"&gt;// Methods&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The placeholders like &lt;code&gt;{{ class }}&lt;/code&gt; and &lt;code&gt;// Traits&lt;/code&gt; will be replaced dynamically by the Artisan command based on the user’s selections.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 4: Testing the Command&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;With everything in place, run the command and watch the magic happen:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:custom-controller
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll be prompted for the controller name, whether it should be a resource controller, and if it should include a custom trait. Based on your input, Laravel will generate a fully customized controller for you!&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Advanced Customization&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Once you’ve mastered the basics, feel free to add more prompts to capture even more details for your stubs. For example, you could:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create more complex stubs for models, service classes, migrations, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use validation on your prompts to ensure the user enters valid data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use a more advanced file structure ( A class for stubs, interfaces, etc )&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Laravel Prompts and stubs give you an incredible amount of flexibility. With this setup, you can automate code generation to fit your exact needs — saving time and boosting productivity. 🚀&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;By combining &lt;strong&gt;Laravel stubs&lt;/strong&gt; with the &lt;strong&gt;Laravel Prompts&lt;/strong&gt; package, you can create powerful, interactive command-line tools that streamline your development process. This approach not only saves time but also ensures consistency and customization across your entire codebase.&lt;/p&gt;

&lt;p&gt;Ready to take your Laravel development to the next level? Try integrating Laravel Prompts and stubs in your next project and see the productivity boost for yourself!&lt;/p&gt;

&lt;p&gt;Happy automating! 😄⚙️&lt;/p&gt;

&lt;p&gt;Feel free to share your thoughts, ideas, and projects using this approach in the comments! Let’s grow together as Laravel developers.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Unlock the Magic of Laravel Stubs: Supercharge Your Code Generation 🚀</title>
      <dc:creator>AdriánColom</dc:creator>
      <pubDate>Tue, 24 Dec 2024 14:41:28 +0000</pubDate>
      <link>https://forem.com/adriancolom/unlock-the-magic-of-laravel-stubs-supercharge-your-code-generation-2kbl</link>
      <guid>https://forem.com/adriancolom/unlock-the-magic-of-laravel-stubs-supercharge-your-code-generation-2kbl</guid>
      <description>&lt;p&gt;Hello, Laravel enthusiasts! 🖐️ Welcome to the magical world of Laravel stubs — a powerful tool that can save you countless hours of repetitive coding. If you’ve ever wished for a coding assistant to handle the mundane tasks, your wish is about to come true. In this post, we’ll explore what Laravel stubs are, how to use them, and how they can be customized to fit your needs.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What Are Laravel Stubs? 🛠️&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Think of Laravel stubs as the blueprint for your code. Imagine building a house: you wouldn’t start from scratch each time. Instead, you’d use a blueprint — adjusting it for each project but always starting from a solid foundation. Laravel stubs work the same way. They’re pre-designed templates that let you generate code quickly and consistently, just like laying a foundation for a new building.&lt;/p&gt;

&lt;p&gt;Laravel uses these stubs to create boilerplate code when you run commands like &lt;code&gt;php artisan make:controller&lt;/code&gt;, &lt;code&gt;php artisan make:model&lt;/code&gt;, and others. By customizing these stubs, you can ensure that your generated code fits perfectly with your project’s specific needs, just as an architect customizes blueprints to fit the unique requirements of a building.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Why Should You Care About Stubs? 🧐&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Consistency&lt;/strong&gt;: Keep your codebase consistently clean and uniform across every file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficiency&lt;/strong&gt;: Accelerate your workflow by instantly generating repetitive code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Customization&lt;/strong&gt;: Fine-tune your stubs to precisely match your project’s unique needs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Getting Started with Laravel Stubs&lt;/strong&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 1: Locate the Default Stubs 🗂️&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Laravel’s default stubs are stored in the &lt;code&gt;vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs&lt;/code&gt; directory. Think of this directory as the storage room for all your construction blueprints. Take a moment to browse through it—you’ll find templates for controllers, models, migrations, and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 2: Publish the Stubs 🛠️&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To start customizing stubs, you need to bring them into your project’s root directory. Run the following Artisan command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan stub:publish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a &lt;code&gt;stubs&lt;/code&gt; directory in the root of your Laravel application. It’s like setting up your own blueprint station on-site, ready for customization.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 3: Customize Your Stubs 🎨&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now, the real fun begins — customizing the stubs to suit your needs. Open the &lt;code&gt;stubs&lt;/code&gt; directory and edit the files as you see fit. For example, if you want all your controllers to include a specific trait by default, you can modify the &lt;code&gt;controller.stub&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// controller.stub example&lt;/span&gt;
&lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="p"&gt;}};&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Traits\YourMagicTrait&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Http\Request&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;YourMagicTrait&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Your custom methods&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Step 4: Generate Code Using Customized Stubs ⚡&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Once your custom stubs are in place, generating code becomes a breeze. Use Artisan commands as usual, and Laravel will use your custom stubs:&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="n"&gt;php&lt;/span&gt; &lt;span class="n"&gt;artisan&lt;/span&gt; &lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;controller&lt;/span&gt; &lt;span class="nc"&gt;MagicController&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s like having a construction crew that knows exactly where every beam and wall goes, saving you time and ensuring consistency.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Practical Examples 🎯&lt;/strong&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Example 1: Custom Controller Stub&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let’s say you always use a specific trait in your controllers. Modify &lt;code&gt;controller.stub&lt;/code&gt; like this:&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;App\Traits\YourMagicTrait&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;YourMagicTrait&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Additional methods&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Example 2: Custom Migration Stub&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you want every new database table to include default columns, such as a column whose name is active, edit the &lt;code&gt;migration.stub&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;up&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Schema&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'{{ table }}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Blueprint&lt;/span&gt; &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;timestamps&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'active'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="c1"&gt;// Your default columns&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;
  
  
  &lt;strong&gt;Example 3: Advanced Controller Customization&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Suppose you frequently add specific logic or dependencies to your controllers — like integrating a custom HVAC system into every new building. Customize your &lt;code&gt;controller.stub&lt;/code&gt; to include these by default:&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;// controller.stub example&lt;/span&gt;
&lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="p"&gt;}};&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Services\YourCustomService&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Http\Request&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="kt"&gt;YourCustomService&lt;/span&gt; &lt;span class="nv"&gt;$service&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

    &lt;span class="c1"&gt;// Your custom methods&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Advanced Customization Tips 🧠&lt;/strong&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Using Placeholder Variables&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Laravel stubs use placeholder variables like &lt;code&gt;{{ namespace }}&lt;/code&gt;, &lt;code&gt;{{ class }}&lt;/code&gt;, and more, which are dynamically replaced when files are generated. You can even add custom placeholders, just like marking specific spots on your blueprint for unique features:&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;// custom.stub&lt;/span&gt;
&lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="p"&gt;}};&lt;/span&gt;

&lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="n"&gt;class&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;customMethod&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// {{ customPlaceholder }}&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;
  
  
  &lt;strong&gt;2. Creating Custom Artisan Commands&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you want to take automation to the next level, creating custom Artisan commands can make your workflow even smoother. Laravel makes it easy to create your commands, which can leverage your custom stubs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a New Command&lt;/strong&gt;: Use the Artisan command to generate a new custom command:
&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 make:command CustomMakeCommand
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command generates a new file in &lt;code&gt;app/Console/Commands/CustomMakeCommand.php&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Define the Command Logic&lt;/strong&gt;: Open the generated file and define the logic of your command. Here’s how you might use a custom stub within your new command:&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;// CustomMakeCommand.php&lt;/span&gt;
&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Console\Commands&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Console\Command&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CustomMakeCommand&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$signature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'make:custom {name}'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Create a custom class with a custom stub'&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;handle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$name&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;argument&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'name'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nv"&gt;$stub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;file_get_contents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;base_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'stubs/custom.stub'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
        &lt;span class="nv"&gt;$content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'{{ class }}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$stub&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nb"&gt;file_put_contents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;app_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.php"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nv"&gt;$content&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;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Custom class &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; created successfully!"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Run Your Custom Command&lt;/strong&gt;: You can now use this custom command just like any other Artisan command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:custom MyCustomClass
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will generate a new class file using your custom stub template, saving you time and ensuring consistency.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Conclusion 🎉&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Laravel stubs are a powerful feature that can save you time and ensure consistency across your projects. By customizing these templates, you can streamline your workflow and maintain high coding standards effortlessly. And with a bit of creativity, you could even turn your mastery of Laravel stubs into a profitable venture.&lt;/p&gt;

&lt;p&gt;So, go ahead — unlock the magic of Laravel stubs, and let them work their wonders for you. Remember, with great power comes great responsibility.&lt;/p&gt;

&lt;p&gt;Happy coding, and may the stubs be ever in your favor! 🚀&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>productivity</category>
      <category>webdev</category>
    </item>
    <item>
      <title>CodeFast⚡by Marc Lou: (A Review of a “Learn by Doing” Coding Course for Entrepreneurs Learn to Build a SaaS in Just Two Weeks)</title>
      <dc:creator>AdriánColom</dc:creator>
      <pubDate>Tue, 24 Dec 2024 14:40:25 +0000</pubDate>
      <link>https://forem.com/adriancolom/codefastby-marc-lou-a-review-of-a-learn-by-doing-coding-course-for-entrepreneurs-learn-to-5gcl</link>
      <guid>https://forem.com/adriancolom/codefastby-marc-lou-a-review-of-a-learn-by-doing-coding-course-for-entrepreneurs-learn-to-5gcl</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;As a developer with two years of professional experience in a different tech stack (Laravel, Vue, Inertia, and Tailwind), I was intrigued (and a bit skeptical) when I came across &lt;strong&gt;CodeFast&lt;/strong&gt; — a course promising to help anyone build and launch a SaaS product in just 14 days. I wanted to see how Marc Lou’s “learn by doing” approach could benefit aspiring entrepreneurs, even if they don’t come from a traditional coding background.&lt;/p&gt;

&lt;p&gt;After watching much of the course content and comparing it to my experience, here’s my honest take: &lt;strong&gt;CodeFast&lt;/strong&gt; delivers a fast-paced, no-fluff approach to coding. It’s perfect for those who want to turn ideas into something tangible quickly — but it’s also beneficial to understand that &lt;strong&gt;theory still matters&lt;/strong&gt;, especially if you’re starting from scratch.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codefa.st/?via=adrian" rel="noopener noreferrer"&gt;Link to the course&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;The Promise: Launch a SaaS in 14 Days&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;CodeFast&lt;/strong&gt; is structured around the bold claim that you can ship your first SaaS in two weeks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Day 1&lt;/strong&gt;: Fundamentals of coding&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Day 4&lt;/strong&gt;: Database integration, user logins, and authentication&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Day 9&lt;/strong&gt;: Setting up subscription payments&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Day 14&lt;/strong&gt;: Launching your product&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From a strictly &lt;em&gt;practical&lt;/em&gt; standpoint, this schedule encourages you to &lt;em&gt;focus on what matters most&lt;/em&gt; — building a minimum viable product (MVP) and getting real-world feedback. However, if you’re truly starting at zero (no coding experience at all), you may find yourself lagging behind the 14-day timeline. And that’s okay! The purpose of the course is not to shame you if you don’t make it in two weeks — it’s to &lt;em&gt;motivate you&lt;/em&gt; to move faster than typical theory-heavy courses would suggest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: Even if you don’t finish in 14 days, you’ll have &lt;em&gt;much more&lt;/em&gt; to show for your efforts than if you spent those two weeks passively watching endless hours of coding videos.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;The Rapid “Learn by Doing” Approach&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;What I found refreshing was &lt;strong&gt;CodeFast&lt;/strong&gt;’s emphasis on learning just enough to move forward, rather than covering every possible edge case or advanced theoretical concept. Many courses spend &lt;em&gt;dozens&lt;/em&gt; of hours on abstract data structures or advanced algorithms (like inverting binary trees or memorizing Big O notation) that, in reality, most entrepreneurs rarely use.&lt;/p&gt;

&lt;p&gt;Instead, Marc shows you how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use &lt;strong&gt;AI tools&lt;/strong&gt; (like GitHub Copilot) to write and fix code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build &lt;strong&gt;frontend components&lt;/strong&gt; quickly with React, Next.js, and Tailwind&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Handle &lt;strong&gt;backend authentication&lt;/strong&gt; via magic links, Google OAuth, and a MongoDB database&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integrate &lt;strong&gt;payment systems&lt;/strong&gt; like Stripe or LemonSqueezy&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The result&lt;/strong&gt;: You progress from zero to an online product that can &lt;em&gt;actually&lt;/em&gt; charge users and capture data — without getting stuck in deep theory. &lt;strong&gt;However&lt;/strong&gt;, if you’re aiming to become a &lt;em&gt;well-rounded developer&lt;/em&gt;, you’ll still need to &lt;strong&gt;supplement&lt;/strong&gt; this approach with core computer science or backend theory at some point. That deeper knowledge can help you diagnose and prevent bigger issues down the line.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Expect (and Embrace) the Bugs&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;One realistic aspect I appreciated about &lt;strong&gt;CodeFast&lt;/strong&gt; is the acknowledgment that your first projects &lt;em&gt;will&lt;/em&gt; have errors. Marc’s philosophy is that bugs are inevitable and part of the learning process — especially when you’re trying to move fast. I completely agree. Even with two years of industry experience, I still run into unexpected behavior or deployment issues when spinning up new projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Launching with errors&lt;/strong&gt; can actually be a strategic move if your goal is to validate your business idea as quickly as possible. Early users can provide feedback on what &lt;em&gt;really&lt;/em&gt; matters, and you can fix the high-priority bugs first.&lt;/p&gt;

&lt;p&gt;That said, be prepared to spend &lt;em&gt;a fair amount of time&lt;/em&gt; post-launch polishing up issues you encounter. This “build fast, fix later” approach might not be right for every situation, but for an MVP or a proof of concept, it’s an efficient method to gauge interest before investing too heavily in perfection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codefa.st/?via=adrian" rel="noopener noreferrer"&gt;Link to the course&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;AI as Your Coding Co-Pilot&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;By now, you’ve probably heard that AI can generate code, debug issues, and even suggest design improvements. &lt;strong&gt;CodeFast&lt;/strong&gt; integrates these tools into its lessons, showing you how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Quickly generate &lt;strong&gt;CSS or React components&lt;/strong&gt; without memorizing syntax&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ask AI to &lt;strong&gt;fix error messages&lt;/strong&gt; or refactor code for clarity&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Develop &lt;strong&gt;UI/UX elements&lt;/strong&gt; faster with AI-based prompts&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As someone who’s used Laravel, Vue, and Inertia for quite a while, I can confirm that AI is a game-changer — &lt;em&gt;if&lt;/em&gt; you understand the fundamentals well enough to guide it. AI can produce suboptimal code if you don’t know how to ask the right questions or read the output critically. That’s where theory comes back into play: understanding &lt;em&gt;why&lt;/em&gt; your code works ensures you can spot AI-generated mistakes.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Course Structure &amp;amp; Content&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;CodeFast&lt;/strong&gt; is broken into three core sections, delivered through roughly 12 hours of concise videos:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;The Mindset (15 minutes)&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Why coding as an entrepreneur differs from coding for a big tech job&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to maintain momentum and not get stuck in analysis paralysis&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. The Fundamentals (1 hour 15 minutes)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Basic web dev concepts (HTTP, HTML, CSS, JavaScript)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enough understanding to use AI effectively&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Your First SaaS (10+ hours)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Frontend&lt;/strong&gt;: React, Next.js, Tailwind (and daisyUI)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Backend &amp;amp; Auth&lt;/strong&gt;: MongoDB, user logins, cookies, sessions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Business &amp;amp; Deployment&lt;/strong&gt;: Stripe subscriptions, domain setup, hosting, emails, SEO (soon)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For those of us used to Laravel and Vue, these tech choices might be outside our comfort zone. But the principles still carry over: learn how to structure your project, handle authentication, manage data, and roll out updates quickly. It’s valuable exposure to new tools and frameworks that complement your existing skill set.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;The Importance of Supplementing with Theory&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Though &lt;strong&gt;CodeFast&lt;/strong&gt; focuses on fast execution, don’t overlook the value of diving deeper into theoretical or more advanced topics after (or alongside) the course. Here’s why:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Maintainable Code&lt;/strong&gt;: Proper design patterns help you avoid spaghetti code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability&lt;/strong&gt;: If your SaaS gains real traction, you’ll need to optimize queries, handle concurrency, and more.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;: Basic authentication is great for an MVP, but larger user bases require stronger security measures and best practices.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Treat &lt;strong&gt;CodeFast&lt;/strong&gt; as a &lt;strong&gt;launchpad&lt;/strong&gt; and then shore up your skills with more comprehensive resources once you have a sense of which areas need extra attention.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;My Experience &amp;amp; Final Thoughts&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;While I don’t use the exact stack that &lt;strong&gt;CodeFast&lt;/strong&gt; teaches, I found tremendous value in seeing how Marc applies the “ship fast, learn fast” mindset to coding. For someone with a couple of years of experience, it was a good reminder that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You don’t have to code “perfectly” for your app to be &lt;em&gt;useful&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Launching with &lt;em&gt;some&lt;/em&gt; bugs is often better than never launching at all.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AI can handle a surprising amount of grunt work — if you guide it well.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For complete beginners, &lt;strong&gt;CodeFast&lt;/strong&gt; is an inspiring way to get started. Just remember that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;14 days is ambitious&lt;/strong&gt; if you’re totally new. Don’t be discouraged if it takes longer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your first projects &lt;em&gt;will&lt;/em&gt; have errors — learn from them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Supplement&lt;/strong&gt; with theory over time, especially if you want to grow as a developer.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overall, &lt;strong&gt;CodeFast&lt;/strong&gt; offers a fresh perspective on coding for entrepreneurship — balancing speed, practicality, and modern AI tools to help you launch your ideas into the world. It might not replace a deep dive into computer science fundamentals, but it absolutely works as a &lt;strong&gt;fast-track introduction&lt;/strong&gt; to building a &lt;strong&gt;real&lt;/strong&gt; SaaS product. Whether you use Laravel and Vue or prefer Next.js and Tailwind, you can apply these same principles: &lt;em&gt;start small, launch quickly, and iterate&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;If you’re tired of overly theoretical courses and want to see tangible progress on your first business idea, &lt;strong&gt;CodeFast&lt;/strong&gt; is worth considering. And if you already have some experience? You might just pick up a new mindset — and maybe even a new MVP under your belt.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codefa.st/?via=adrian" rel="noopener noreferrer"&gt;&lt;strong&gt;LINK TO THE COURSE&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>react</category>
    </item>
  </channel>
</rss>
