<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Neeraj Saini</title>
    <description>The latest articles on DEV Community by Neeraj Saini (@hax-neeraj).</description>
    <link>https://dev.to/hax-neeraj</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%2F1733842%2Ff325e240-38f1-4bd9-a0b8-5c02abfc0e83.png</url>
      <title>DEV Community: Neeraj Saini</title>
      <link>https://dev.to/hax-neeraj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hax-neeraj"/>
    <language>en</language>
    <item>
      <title>🚀 Clean Laravel URLs &amp; Force HTTPS (Apache + Nginx Guide) — By HaxNeeraj</title>
      <dc:creator>Neeraj Saini</dc:creator>
      <pubDate>Sat, 06 Dec 2025 07:13:54 +0000</pubDate>
      <link>https://dev.to/hax-neeraj/clean-laravel-urls-force-https-apache-nginx-guide-by-haxneeraj-23i1</link>
      <guid>https://dev.to/hax-neeraj/clean-laravel-urls-force-https-apache-nginx-guide-by-haxneeraj-23i1</guid>
      <description>&lt;p&gt;When you deploy a fresh Laravel project, it serves your application through the &lt;strong&gt;/public&lt;/strong&gt; directory. This leads to URLs like:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://yourdomain.com/public/login&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Such URLs don’t look professional, can negatively impact SEO, and may reduce user confidence.&lt;/p&gt;

&lt;p&gt;In this revised guide, you’ll learn how to &lt;strong&gt;hide the public directory&lt;/strong&gt; and &lt;strong&gt;enforce HTTPS redirection&lt;/strong&gt; on both &lt;strong&gt;Apache&lt;/strong&gt; and &lt;strong&gt;Nginx&lt;/strong&gt; servers.&lt;br&gt;
To simplify everything, I’ve also prepared a full configuration repository you can directly use:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;GitHub Repository:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/haxneeraj/how-to-remove-public-from-laravel-urls-and-redirect-to-https-using-htaccess" rel="noopener noreferrer"&gt;https://github.com/haxneeraj/how-to-remove-public-from-laravel-urls-and-redirect-to-https-using-htaccess&lt;/a&gt;&lt;/p&gt;


&lt;h1&gt;
  
  
  ⭐ Advantages of Removing “public” From Laravel URLs
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;More polished and professional-looking URLs&lt;/li&gt;
&lt;li&gt;Better SEO visibility&lt;/li&gt;
&lt;li&gt;Enhanced trust and credibility&lt;/li&gt;
&lt;li&gt;Prevents exposing internal directory structure&lt;/li&gt;
&lt;li&gt;Helps avoid asset and routing issues&lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;
  
  
  🔐 Why Enforce HTTPS Redirection?
&lt;/h1&gt;

&lt;p&gt;Running a production-grade application without HTTPS is not recommended. Here’s why HTTPS is important:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Protects user data using encryption&lt;/li&gt;
&lt;li&gt;Improves Google search ranking&lt;/li&gt;
&lt;li&gt;Required by many modern APIs&lt;/li&gt;
&lt;li&gt;Ensures browser compatibility&lt;/li&gt;
&lt;li&gt;Builds trust and reliability&lt;/li&gt;
&lt;/ul&gt;


&lt;h1&gt;
  
  
  🏗️ Apache Setup: Remove /public &amp;amp; Enable HTTPS
&lt;/h1&gt;
&lt;h3&gt;
  
  
  ✔️ Step 1: Add &lt;code&gt;.htaccess&lt;/code&gt; in the Laravel Root Directory
&lt;/h3&gt;

&lt;p&gt;Paste the following rules in the &lt;code&gt;.htaccess&lt;/code&gt; file located in Laravel’s main folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apache"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nl"&gt;IfModule&lt;/span&gt;&lt;span class="sr"&gt; mod_rewrite.c&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="nc"&gt;RewriteEngine&lt;/span&gt; &lt;span class="ss"&gt;On&lt;/span&gt;

    &lt;span class="c"&gt;# Redirect all HTTP requests to HTTPS&lt;/span&gt;
    &lt;span class="nc"&gt;RewriteCond&lt;/span&gt; %{HTTPS} !=on
    &lt;span class="nc"&gt;RewriteRule&lt;/span&gt; ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    &lt;span class="c"&gt;# Route requests to public folder without showing it in the URL&lt;/span&gt;
    &lt;span class="nc"&gt;RewriteCond&lt;/span&gt; %{REQUEST_URI} !^/public/
    &lt;span class="nc"&gt;RewriteRule&lt;/span&gt; ^(.*)$ /public/$1 [L]
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nl"&gt;IfModule&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ✔️ Step 2: Allow Overrides in Apache Config
&lt;/h3&gt;

&lt;p&gt;Open your virtual host file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/etc/apache2/sites-available/000-default.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the directory block, enable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apache"&gt;&lt;code&gt;&lt;span class="nc"&gt;AllowOverride&lt;/span&gt; &lt;span class="ss"&gt;All&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then activate &lt;code&gt;mod_rewrite&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo a2enmod rewrite
sudo systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  🚀 Nginx Setup: Redirect to HTTPS &amp;amp; Hide /public
&lt;/h1&gt;

&lt;p&gt;Nginx doesn’t use &lt;code&gt;.htaccess&lt;/code&gt;, so everything is configured inside the server block.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✔️ Step 1: Set Document Root to Laravel’s Public Folder
&lt;/h3&gt;

&lt;p&gt;Edit your Nginx site config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/nginx/sites-available/your-site.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the following configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;example.com&lt;/span&gt; &lt;span class="s"&gt;www.example.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;# Redirect all HTTP traffic to HTTPS&lt;/span&gt;
    &lt;span class="kn"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;301&lt;/span&gt; &lt;span class="s"&gt;https://&lt;/span&gt;&lt;span class="nv"&gt;$host$request_uri&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="s"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;example.com&lt;/span&gt; &lt;span class="s"&gt;www.example.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kn"&gt;root&lt;/span&gt; &lt;span class="n"&gt;/var/www/your-project/public&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;index&lt;/span&gt; &lt;span class="s"&gt;index.php&lt;/span&gt; &lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;# Laravel routes&lt;/span&gt;
    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;try_files&lt;/span&gt; &lt;span class="nv"&gt;$uri&lt;/span&gt; &lt;span class="nv"&gt;$uri&lt;/span&gt;&lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="n"&gt;/index.php?&lt;/span&gt;&lt;span class="nv"&gt;$query_string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;# PHP processing&lt;/span&gt;
    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="p"&gt;~&lt;/span&gt; &lt;span class="sr"&gt;\.php$&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;fastcgi_pass&lt;/span&gt; &lt;span class="s"&gt;unix:/var/run/php/php8.2-fpm.sock&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;fastcgi_index&lt;/span&gt; &lt;span class="s"&gt;index.php&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;include&lt;/span&gt; &lt;span class="s"&gt;fastcgi_params&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;fastcgi_param&lt;/span&gt; &lt;span class="s"&gt;SCRIPT_FILENAME&lt;/span&gt; &lt;span class="nv"&gt;$realpath_root$fastcgi_script_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;# Prevent access to hidden files&lt;/span&gt;
    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="p"&gt;~&lt;/span&gt; &lt;span class="sr"&gt;/\.(?!well-known).*&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;deny&lt;/span&gt; &lt;span class="s"&gt;all&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ✔️ Step 2: Apply &amp;amp; Reload
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nginx -t
sudo systemctl reload nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your Laravel app will now run without &lt;code&gt;/public&lt;/code&gt; and will automatically switch to HTTPS.&lt;/p&gt;




&lt;h1&gt;
  
  
  🎯 Apache vs Nginx — Quick Comparison
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Apache&lt;/th&gt;
&lt;th&gt;Nginx&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Supports &lt;code&gt;.htaccess&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;✔️&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Per-directory config&lt;/td&gt;
&lt;td&gt;✔️&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;High performance&lt;/td&gt;
&lt;td&gt;Good&lt;/td&gt;
&lt;td&gt;Excellent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lightweight&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✔️&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Laravel compatible&lt;/td&gt;
&lt;td&gt;✔️&lt;/td&gt;
&lt;td&gt;✔️&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h1&gt;
  
  
  📈 SEO &amp;amp; Performance Improvements
&lt;/h1&gt;

&lt;p&gt;After applying these configurations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;URLs become cleaner and more indexable&lt;/li&gt;
&lt;li&gt;HTTPS helps boost rankings&lt;/li&gt;
&lt;li&gt;Faster routing and asset delivery&lt;/li&gt;
&lt;li&gt;Better overall user experience&lt;/li&gt;
&lt;li&gt;A more secure and optimized environment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Track improvements using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Google Search Console&lt;/li&gt;
&lt;li&gt;PageSpeed Insights&lt;/li&gt;
&lt;li&gt;Ahrefs / Semrush&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Target keywords such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Laravel remove public directory&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Laravel Nginx HTTPS redirect&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Laravel deployment best practices&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  📁 Download the Ready-Made Files
&lt;/h1&gt;

&lt;p&gt;Grab all configuration files directly from my GitHub repository:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://github.com/haxneeraj/how-to-remove-public-from-laravel-urls-and-redirect-to-https-using-htaccess" rel="noopener noreferrer"&gt;https://github.com/haxneeraj/how-to-remove-public-from-laravel-urls-and-redirect-to-https-using-htaccess&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Don’t forget to ⭐ star the repo if it saves you time — it motivates me to create more developer tools and guides.&lt;/p&gt;




&lt;h1&gt;
  
  
  🚀 Final Words
&lt;/h1&gt;

&lt;p&gt;Hiding Laravel’s &lt;code&gt;/public&lt;/code&gt; directory and enforcing HTTPS are essential steps when deploying your application on any production server. These small tweaks greatly improve SEO, security, and overall professionalism.&lt;/p&gt;

&lt;p&gt;Use this guide for both &lt;strong&gt;Apache and Nginx&lt;/strong&gt;, or simply download the ready-made configs from the GitHub repo:&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://github.com/haxneeraj/how-to-remove-public-from-laravel-urls-and-redirect-to-https-using-htaccess" rel="noopener noreferrer"&gt;https://github.com/haxneeraj/how-to-remove-public-from-laravel-urls-and-redirect-to-https-using-htaccess&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy coding &amp;amp; smooth deployments! ⚡🔥&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How I Built a Laravel Virtual Wallet (And Why You Might Need One Too)</title>
      <dc:creator>Neeraj Saini</dc:creator>
      <pubDate>Thu, 24 Apr 2025 06:59:57 +0000</pubDate>
      <link>https://dev.to/hax-neeraj/how-i-built-a-laravel-virtual-wallet-and-why-you-might-need-one-too-4go0</link>
      <guid>https://dev.to/hax-neeraj/how-i-built-a-laravel-virtual-wallet-and-why-you-might-need-one-too-4go0</guid>
      <description>&lt;p&gt;How I Built a Laravel Virtual Wallet (And Why You Might Need One Too)&lt;/p&gt;

&lt;p&gt;Managing user balances, transactions, and wallets can get messy — especially if you're building products where users deal with digital assets, in-app credits, rewards, or any kind of financial flow.&lt;/p&gt;

&lt;p&gt;In this post, I want to share the story behind building the Laravel Virtual Wallet, how it evolved from a small use case into a flexible package, and why it might be the tool you're missing in your Laravel stack.&lt;/p&gt;




&lt;p&gt;🔥 The Real-World Frustration&lt;br&gt;
While working on a foreign project, I had to implement a wallet system where each user needed more than one wallet. There were additional needs like locking transactions temporarily, tracking wallet history, and ensuring the system was both extendable and secure.&lt;/p&gt;

&lt;p&gt;That challenge sparked the idea — but the more I talked to devs, the more I realized this was a &lt;strong&gt;common problem&lt;/strong&gt; across many apps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fintech apps needing wallet logs and multi-currency&lt;/li&gt;
&lt;li&gt;SaaS tools with customer credits or bonuses&lt;/li&gt;
&lt;li&gt;Gaming and reward platforms with custom wallet logic&lt;/li&gt;
&lt;li&gt;Marketplaces with internal balances&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;💡 From Idea to Package&lt;br&gt;
I didn’t want to just solve one use case. I wanted a &lt;strong&gt;developer-friendly wallet system&lt;/strong&gt; that could adapt to any project. So I designed a package with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;⚙️ Multiple wallets per user (or any model)&lt;/li&gt;
&lt;li&gt;💸 Simple credit/debit API&lt;/li&gt;
&lt;li&gt;🔐 Support for freezing transactions&lt;/li&gt;
&lt;li&gt;🧠 Metadata on transactions for logging &amp;amp; audit&lt;/li&gt;
&lt;li&gt;🚀 Clean architecture using Laravel standards&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's called: &lt;a href="https://github.com/haxneeraj/laravel-virtual-wallet" rel="noopener noreferrer"&gt;&lt;code&gt;haxneeraj/laravel-virtual-wallet&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;📦 Installation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require haxneeraj/laravel-virtual-wallet
php artisan vendor:publish &lt;span class="nt"&gt;--provider&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Haxneeraj&lt;/span&gt;&lt;span class="se"&gt;\L&lt;/span&gt;&lt;span class="s2"&gt;aravelVirtualWallet&lt;/span&gt;&lt;span class="se"&gt;\L&lt;/span&gt;&lt;span class="s2"&gt;aravelVirtualWalletServiceProvider"&lt;/span&gt;
php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;🔧 Configuration&lt;/p&gt;

&lt;p&gt;After publishing the config file, you can modify &lt;code&gt;config/laravel-virtual-wallet.php&lt;/code&gt; to override models, table names, and enums if needed.&lt;/p&gt;




&lt;p&gt;📥 Setup in Your Model&lt;/p&gt;

&lt;p&gt;Add the trait and implement the interface in your &lt;code&gt;User&lt;/code&gt; (or any Eloquent model):&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;Haxneeraj\LaravelVirtualWallet\Interfaces\WalletInterface&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;Haxneeraj\LaravelVirtualWallet\Traits\HasVirtualWallet&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;User&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Authenticatable&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;WalletInterface&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;HasVirtualWallet&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;💡 Usage&lt;/p&gt;

&lt;p&gt;Create Wallets&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;wallets&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;create&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'wallet_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'main'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Type of wallet (e.g., 'main', 'bonus', 'savings'). Define these in your WalletType enum.&lt;/span&gt;
    &lt;span class="s1"&gt;'currency'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'usd'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// ISO currency code. Ensure 'usd' or your required currencies are defined in your Currency enum.&lt;/span&gt;
    &lt;span class="s1"&gt;'balance'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Initial wallet balance. Usually set to 0 or default starting value.&lt;/span&gt;
    &lt;span class="s1"&gt;'currency_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'fiat_currency'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Define whether the currency is fiat, crypto, token, etc. Set values in CurrencyType enum.&lt;/span&gt;
    &lt;span class="s1"&gt;'status'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'active'&lt;/span&gt; &lt;span class="c1"&gt;// Current status of wallet (e.g., 'active', 'frozen', 'closed'). Defined in WalletStatus enum.&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deposit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$paymentData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PaymentData&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'owner_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'owner_id'&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;user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'txid'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'test-txid'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'amount'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'description'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Test deposit'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'wallet_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'wallet1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'method'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'automatic'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'transaction_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'deposit'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'status'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'approved'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'currency'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'usd'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'currency_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'fiat_currency'&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;deposit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$paymentData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Withdraw&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$paymentData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PaymentData&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'owner_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'owner_id'&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;user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'txid'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'test-txid-withdraw1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'amount'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'description'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Test withdrawal'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'wallet_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'wallet1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'method'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'automatic'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'transaction_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'withdraw'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'status'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'approved'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'currency'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'usd'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'currency_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'fiat_currency'&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;pay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$paymentData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Get Balance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$balance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getBalance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'main'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check Balance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;hasSufficientBalance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'main'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Available Methods&lt;/p&gt;

&lt;p&gt;Wallet Management&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Parameters&lt;/th&gt;
&lt;th&gt;Returns&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;wallets()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;string $walletType = null&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;MorphMany&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Get all wallets or filter by type&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;getBalance()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;string $walletType = null&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;`int&lt;/td&gt;
&lt;td&gt;float`&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hasBalance()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;string $walletType = null&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Check if wallet has positive balance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hasSufficientBalance()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;`int&lt;/td&gt;
&lt;td&gt;float $amount, string $walletType = null`&lt;/td&gt;
&lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Payment Processing&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Parameters&lt;/th&gt;
&lt;th&gt;Returns&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;pay()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;PaymentData $paymentData&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;void&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Process payment from wallet(s)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Deposit Handling&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Parameters&lt;/th&gt;
&lt;th&gt;Returns&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;deposit()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;PaymentData $paymentData&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;void&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Deposit funds into wallet&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;Data Objects&lt;/p&gt;

&lt;p&gt;PaymentData&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;PaymentData&lt;/code&gt; object is used for both payments and deposits. It accepts the following parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;owner_type&lt;/code&gt;: Owner model type&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;owner_id&lt;/code&gt;: Owner model ID&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;amount&lt;/code&gt;: The amount to process&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;wallet_type&lt;/code&gt;: Type of wallet (optional)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;description&lt;/code&gt;: Transaction description&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;status&lt;/code&gt;: Transaction status&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;method&lt;/code&gt;: Payment method&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transaction_type&lt;/code&gt;: Type of transaction&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;txid&lt;/code&gt;: Transaction ID&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Exceptions&lt;/p&gt;

&lt;p&gt;The package throws the following exceptions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;InvalidWalletException&lt;/code&gt;: When wallet type is invalid or wallet not found&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;InsufficientBalanceException&lt;/code&gt;: When wallet balance is insufficient&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;⚙️ Testing&lt;/p&gt;

&lt;p&gt;This package comes with feature and unit tests to ensure everything works smoothly.&lt;/p&gt;

&lt;p&gt;🏃 Run Tests&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;📦 Key Features&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create any number of wallets per user&lt;/li&gt;
&lt;li&gt;Multi-currency wallet support&lt;/li&gt;
&lt;li&gt;Clean API for deposits, withdrawals, locking&lt;/li&gt;
&lt;li&gt;Track wallet history &amp;amp; transaction metadata&lt;/li&gt;
&lt;li&gt;Built with Laravel Service Container for flexibility&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;🚀 What’s Next?&lt;br&gt;
I'm working on a &lt;strong&gt;Pro version&lt;/strong&gt; of the package with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🪙 Cryptocurrency support&lt;/li&gt;
&lt;li&gt;🔐 Transaction-level 2FA&lt;/li&gt;
&lt;li&gt;❄️ Transaction freezing/unfreezing&lt;/li&gt;
&lt;li&gt;🧾 Admin panel (via Nova/Filament integration)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;💬 Final Thoughts&lt;br&gt;
This project started from a small need but grew into something powerful because the developer community kept asking for more. Whether you’re building a small cashback app or a full-on financial platform, a good wallet system is essential.&lt;/p&gt;

&lt;p&gt;I hope this package saves you time and gives your users the reliability they deserve. If it helps you — give it a ⭐ on GitHub and let me know how you're using it!&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/haxneeraj/laravel-virtual-wallet" rel="noopener noreferrer"&gt;github.com/haxneeraj/laravel-virtual-wallet&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading — and happy coding! 🚀&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>laravel</category>
      <category>virtualwallet</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
