Skip to main content

Posts

How to Integrate Razorpay with Laravel

How to Integrate Razorpay with Laravel Razorpay is a popular payment gateway in India that supports cards, UPI, net banking, and wallets. Laravel makes Razorpay integration clean and secure using Blade views and controllers. In this tutorial, you’ll learn how to integrate Razorpay with Laravel step by step. Prerequisites A Laravel application A Razorpay account Razorpay Key ID and Key Secret Step 1: Install Razorpay PHP SDK Install the official Razorpay SDK using Composer: composer require razorpay/razorpay Step 2: Configure Razorpay Credentials Add Razorpay keys to your .env file: RAZORPAY_KEY=your_key_id RAZORPAY_SECRET=your_key_secret Tip: Always use Razorpay test keys while developing. Step 3: Add Razorpay Configuration Open config/services.php and add the Razorpay configuration: 'razorpay' => [ 'key' => env('RAZORPAY_KEY'), 'secret' => env('RAZORPAY_SECRET'), ], Step 4: ...
Recent posts

How to Integrate Stripe Payment Gateway in Laravel

How to Integrate Stripe Payment Gateway in Laravel Stripe is one of the most popular and secure payment gateways for handling online payments. Laravel makes Stripe integration easy using its clean syntax and powerful ecosystem. In this tutorial, you’ll learn how to integrate Stripe payments in a Laravel application step by step. Prerequisites A Laravel application A Stripe account Stripe API keys (Test mode) Step 1: Install Stripe PHP Library Install the official Stripe PHP SDK using Composer: composer require stripe/stripe-php Step 2: Configure Stripe API Keys Add your Stripe keys to the .env file: STRIPE_KEY=pk_test_your_public_key STRIPE_SECRET=sk_test_your_secret_key Tip: Always use test keys during development to avoid real charges. Step 3: Update Services Configuration Open config/services.php and add the Stripe configuration: 'stripe' => [ 'key' => env('STRIPE_KEY'), 'secret' =...

How to Upload and Store Files on AWS S3 in Laravel

How to Upload and Store Files on AWS S3 in Laravel Uploading files to AWS S3 is a common requirement in modern Laravel applications. Amazon S3 provides scalable, secure, and cost-effective cloud storage for files such as images, documents, and media assets. Prerequisites A Laravel application An AWS account An S3 bucket created in AWS Step 1: Install AWS S3 Driver Install the Flysystem AWS S3 package using Composer: composer require league/flysystem-aws-s3-v3 "^3.0" Step 2: Configure AWS Credentials Add the following configuration values to your .env file: AWS_ACCESS_KEY_ID=your_access_key AWS_SECRET_ACCESS_KEY=your_secret_key AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET=your_bucket_name AWS_USE_PATH_STYLE_ENDPOINT=false Tip: Always keep your AWS credentials private and never commit them to GitHub. Step 3: Configure the S3 Filesystem Disk Open the config/filesystems.php file and make sure the S3 disk is configured correctly: ...

How to Generate a PDF File in Laravel Using DomPDF

How to Generate a PDF File in Laravel Using DomPDF Generating PDF files is a common requirement in modern web applications. Whether you need invoices, reports, or downloadable documents, Laravel makes this task simple with the help of the DomPDF library. In this tutorial, we will walk through the complete process of generating a PDF file in Laravel using DomPDF. What is DomPDF? DomPDF is a PHP library that converts HTML and CSS into PDF documents. It is lightweight, easy to use, and integrates seamlessly with Laravel. By writing standard HTML and CSS, you can quickly create professional-looking PDFs. Step 1: Install DomPDF in Laravel The easiest way to install DomPDF in Laravel is via Composer. Run the following command in your project directory: composer require barryvdh/laravel-dompdf Laravel will a...

How to Fix MySQL Not Starting in XAMPP Without Losing Your Databases

Sometimes MySQL in XAMPP suddenly stops working and refuses to start. When you click the Start button in the XAMPP Control Panel, it immediately shuts down again, often without any clear error message. This usually happens because of corrupted InnoDB files, especially ibdata1 and ib_logfile files. Many users mistakenly try to delete the ibdata1 file to fix the issue. But this is extremely dangerous — deleting ibdata1 can destroy ALL your MySQL databases permanently. Instead, XAMPP provides a safe method to restore MySQL using its built-in backup folder. Follow the steps below to safely repair MySQL and recover your databases. Safe Solution: Restore MySQL Using XAMPP Backup Folder Important: Do NOT delete the ibdata1 file. Use the following safe steps instead. Rename the existing MySQL data folder Go to xampp/mysql/ and rename the folder data to data_old . This keeps your original database files safe. ...

How to Setup MongoDB with Laravel

How to Setup MongoDB with Laravel (Quick Guide) In modern web applications, developers often look for flexible and scalable database solutions — and that’s where MongoDB shines. Unlike traditional SQL databases, MongoDB stores data in a document-oriented format, making it ideal for projects that handle dynamic, unstructured, or rapidly evolving data. Integrating it with Laravel allows you to enjoy the power of MongoDB’s flexibility while still using Laravel’s elegant and expressive syntax. This step-by-step guide walks you through the complete process of integrating MongoDB with a Laravel application using the official mongodb/laravel-mongodb package. You’ll learn how to install all required dependencies, properly configure your .env and database settings, and seamlessly perform basic CRUD (Create, Read, Update, Delete) operations with MongoDB — all while maintaining Larav...

How Composer Autoloading Works in Laravel (Complete Guide)

How Composer Autoloading Works in Laravel (Complete Guide) When building with Laravel , you rarely need to manually include PHP files. That’s thanks to Composer autoloading — a feature that automatically loads the necessary classes when you need them. In this guide, you’ll learn how Composer autoloading works in Laravel , how PSR-4 fits in, and how to use it effectively in your own code. What is Composer Autoloading? Composer is Laravel’s dependency manager. One of its most powerful features is autoloading — it automatically loads PHP classes so you don’t have to write require or include statements manually. It works by following a standardized naming and directory structure defined by PSR-4 . How PSR-4 Autoloading Works PSR-4 is a PHP standard that defines how to map namespaces to file paths. Composer uses this standard to find and load your classes automatically. In Laravel, you ca...