Posts

Building and Publishing Laravel Packages: A Comprehensive Guide

Image
Building and Publishing Laravel Packages: A Comprehensive Guide Welcome to my blog, where we'll dive into the fascinating world of Laravel packages! Laravel, one of the most popular PHP frameworks, empowers developers to build robust and scalable web applications with ease. While Laravel itself offers a vast array of features and functionalities, there may come a time when you want to extend its capabilities or reuse certain components across multiple projects. That's where Laravel packages come in. In this comprehensive guide, I'll walk you through the step-by-step process of creating your own Laravel package and publishing it for others to use. Whether you're a seasoned Laravel developer looking to share your expertise or a beginner eager to explore the realm of package development, this blog is the perfect starting point. Here's a sneak peek at what we'll cover: U nderstanding Laravel Packages: What are Laravel packages and why do we need them? The advantages

Load balance with NGINX

Image
 Load balance with NGINX In this blog I will explain how to do a load balance using Nginx and how to work with Ansible to connect several nodes and do some operations with it. I did it using the Cent OS which installed into my Windows machine. Creating Virtual Machines First of all you need to install some virtual machine into your pc. In here I suggest the VMWare Workstation. You can install it from  https://www.vmware.com/latam/products/workstation-pro/workstation-pro-evaluation.html . After installing the VMWare Workstation you need to download CentOS 7. You can view the installation guide from  https://phoenixnap.com/kb/how-to-install-centos-7 . After successfully installation the CentOS into your VM you can view as below. Consider this as your main server. Then create another two clones with it and name those as "Webserver1" and "Webserver2". Setting static IP adresses Now you can set static IP addresses for the three servers. This is not mandatory but it will

Send Email through Laravel

Image
  Send Email through Laravel First create a Laravel project           composer create-project laravel/laravel send-email Make configurations in the .env file Create Mail           php artisan make:mail MyTestMail The mail file will create in the app/Mail/MyTestMail.php Update the mail file as below Create a blade file and add the content which you need to send through the email Call the mail inside a controller Create a controller and import following           use App\Mail\MyTestMail;           use Mail; Call the mail and send it to the relevant user Run the project

PayPal Integration with Laravel

Image
  PayPal Integration with Laravel First create a Laravel project           composer create-project laravel/laravel paypal Create a database and connect it with the project Run below command to create payment table           php artisan make:migration create_payments_table Go to migration file and add following fields Run again php artisan migrate Run php artisan make:model Payment Run php artisan make:controller PaymentController Go to web.php and add following routes Go to https://developer.paypal.com/home Create a PayPal developer account. Add the client id and secret key to the .env file Run below code in terminal           composer require league/omnipay omnipay/paypal Add the following code to the PaymentController Create a blade file as payment.blade.php Create a simple form Run the project

Google authentication with Laravel

Image
Google authentication with Laravel First create a Laravel project           composer create-project --prefer-dist laravel/laravel googleLogin Now we have to install Jetstream           composer require laravel/jetstream Now we have to create the authentication. For this you can create basic login, registration and email verification           php artisan jetstream:install livewire Now install the node.js package          npm install Then run          npm run dev Create a database and migrate the tables          php artisan migrate Now, we will install Socialite Package that provide api to connect with google account           composer require laravel/socialite Now you have to create Google App in Google Developer Console First create an app in OAuth Consent Screen Then go to Credentials and click create credentials and select OAuth client ID Choose web application and set the URI as http://localhost:8000. And set the redirecting URI also. This should be same as the redirect value in se

Laravel Socialite Authentication with Facebook using Laravel 8

Image
  Laravel Socialite Authentication with Facebook using Laravel 8 Let us develop a sample web project to integrate Facebook login. First of all create a sample Laravel project using below command. If you want to know how to config Laravel in your PC please refer my blog about "First step to Laravel".          composer create-project laravel/laravel <your project name> Next we should install the Laravel Socialite Package using the composer. Note that you have to include Package in Providers if you are using below version than Laravel 8           composer require laravel/socialite Add below code to config\app.php in providers section           Laravel\Socialite\SocialiteServiceProvider::class, Add below code to in aliases section           'Socialite' => Laravel\Socialite\Facades\Socialite::class, To config\services.php include Facebook service           'facebook' => [         'client_id' => '', //USE FROM FACEBOOK DEVELOPER ACCOUN

Python API with Flask

Image
  Python API with Flask Install python from below link           https://www.python.org/downloads/           You can check if the python installation is success or not by running below command in command prompt          python --version Then you have to set up the environment to run the python application. In command prompt run below command. Note that you have mention the python version           py -2 -m pip install virtualenv Create a python file and name it as app.py Add below code as the first step and first sample API in the app.py file      Now if you are added the environment properly you can see play icon in right side of the vs code. Click that and application will run on port 5000. Browse the url This will return the array as a html type (check network of inspect). If you want to return it as a json you want to change the code as below The result will be like below Now create a sample text file and insert sample json code. Define another route for the new API      CRUD oper