General PHP

Whats new in PHP 7.4

PHP core team possibly release PHP 7.4 somewhere on December 2019. Today we take a look at some new upcoming features and improvements.


This feature can resolve performance related issues in PHP. In Short if you are using the framework then it’s file loaded and recompiled on each and every request. Preloading allow us to store files in memory on startup and then available for each and every request. If files are changed then server will be restart.


FFI means Foreign Function Interface, it is allow us to call C code from userland. This means that PHP extensions can be written in pure PHP. This is complex topic and you need C code knowledge to use this feature.

For more information refer the

Null Coalescing Assignment Operator:

// Now
$dateTime = $dateTime ?? new DateTime();

// in PHP 7.4
$dateTime ??= new DateTime();

ext-hash always enable:

This extension is permanently available for all PHP installations.

Password Hashing Registry:

Internal changes to how hashing libraries are used, so that it’s easier for userland to use them.

Type Property:

Class variable can be type hinted.

class Test
    public string $demo;
    public Bar $bar;

Angular Laravel PHP

Instamojo Payment Gateway

 Instamojo is a free Payment Gateway for 5,00,000+ Businesses in India. There is no setup or annual fee for this payment gateway. Just pay a transaction fee of 2% + ₹3 for the transactions. Instamojo accepts Debit Cards, Credit Cards, Net Banking, UPI, Wallets, EMI, NEFT and IMPS. is a digital payments platform bundled with tons of e-commerce features to enable any business or individual to sell, manage & grow effortlessly, securely and cost-effectively.

It was not easy to make it work in India because most of the payments are handled through credit card and PayPal and very few Indians use them. Then after RBI regulations even using PayPal within India was impossible.

Follow the given steps for easy Integration in Laravel,

Instamojo PHP API

Assists you to programmatically create, edit and delete Links on Instamojo in PHP.

Installing via Composer –

$ php composer.phar require instamojo/instamojo-php

Note: If you’re not using Composer then directly include the contents of src directory in your project.

And visit this link for its usage.

Further documentation is available at

Laravel PHP

Laravel Paytm Integration

Paytm is a very popular Indian payment gateway. Pay money via paytm is very easy. They provides easy way for the shopping and manage your money in your paytm wallet. In this post i will explains you, how to integrate Paytm payment gateway in our Laravel application online using Paytm_Web_Sample_Kit_PHP  example available on github.  

How to install the sample kit on a web server:

  1. First, download Paytm_Web_Sample_Kit_PHP  folder available on github..
  2. Copy PaytmKit folder in document root of your server (like /var/www/html)
  3. Open config_paytm.php file from the PaytmKit/lib folder and update the below constant values
    • PAYTM_MERCHANT_KEY – Provided by Paytm
    • PAYTM_MERCHANT_MID – Provided by Paytm
    • PAYTM_MERCHANT_WEBSITE – Provided by Paytm
  4. PaytmKit folder is having following files:
    • TxnTest.php – Testing transaction through Paytm gateway.
    • pgRedirect.php – This file has the logic of checksum generation and passing all required parameters to Paytm PG.
    • pgResponse.php – This file has the logic for processing PG response after the transaction processing.
    • TxnStatus.php – Testing Status Query API

For Offline(Wallet Api) Checksum Utility below are the methods:

  1. getChecksumFromString : For generating the checksum
  2. verifychecksum_eFromStr : For verifing the checksum

To generate refund checksum in PHP :

  1. Create an array with key value pair of following paytm parameters (MID, ORDERID, TXNTYPE, REFUNDAMOUNT, TXNID, REFID)
  2. To generate checksum, call the following method. This function returns the checksum as a string. getRefundChecksumFromArray($arrayList, $key, $sort=1)

Start Building with Paytm

  1. Create account or login using your existing Paytm account.
  2. Generate your staging account credentials from the dashboard. These are required to explore Paytm integration solutions.
  3. When you are ready to go live, activate your account in the dashboard to get production account credentials

Account credentials are available in your dashboard for both staging and production environment. These credentials consist of –

  1. MID (Merchant ID) – This is a unique identifier provided to every merchant by Paytm. MID is part of your account credentials and is different on staging and production environment. Your staging MID is available here and production MID will be available once your activation is complete.
  2. Merchant Key – This is a unique secret key used for secure encryption of every request. This needs to be kept on server side and should not be shared with anyone.

Note : Paytm Payment Gateway provides a secure, PCI-compliant way to accept Debit/Credit card, Net-Banking, UPI and Paytm wallet payments from your customers.

Laravel PHP

Razorpay Payment Gateway Integration for Laravel 5+

Currently several payment gateways are available for online payments like Paypal, Stripe, CCAvenue and many more. For Indian market,  Razorpay is best for make online payment due its simplicity.

Follow the given steps for easy Integration,

Create Razorpay Account

To create Razorpay account , click this link Razorpay Account,and get your razor_key and razor_secret from the account.

 Install package : Razorpay

Next, we need to install razorpay/razorpay laravel package in our application by running following command using composer.

composer require razorpay/razorpay:2.*

And visit this link for its usage.

Laravel PHP

PHP Library to write XLSX files

Excel is used to store large amount of information in the form of a spreadsheet. Which is easy to manage accounts information and other information. Now a day’s we save large amount of information online in database but some times we need to convert that information into excel spreadsheet and provides to user. In this post i will explains you, how to create excel file online using PHP_XLSXWriter library available on github. You can download this from the link :

This library is designed to be lightweight, and have minimal memory usage.

It is designed to output an Excel compatible spreadsheet in (Office 2007+) xlsx format, with just basic features supported:

  • Supports PHP 5.2.1+
  • Takes UTF-8 encoded input
  • Multiple worksheets
  • Supports currency/date/numeric cell formatting and simple formulas
  • Supports basic cell styling
  • Supports writing huge 100K+ row spreadsheets

Below are a few test cases, writing large xlsx spreadsheet files with PHPExcel and PHP_XLSXWriter for comparison.




10 columns, 10,000 rows in 4 sheets (400,000 cells)

File size : 458MB

Execution time : 101.55s

File size : 11MB

Execution time : 7.56s

10 columns, 10,000 rows in 6 sheets (600,000 cells)

File size : 658MB

Execution time : 202.72s

File size : 15MB

Execution time : 11.31s

10 columns, 20,000 rows in 4 sheets (800,000 cells) File size : 912MB

Execution time : 301.31s

File size : 22MB

Execution time : 14.94s


In a few simple tests, PHP_XLSXWriter shows a 98% savings on memory and 95% savings on time when compared to PHP_Excel for writing large files. Though PHP_Excel may have more features, it doesn’t compare with PHP_XLSXWriter when it comes to performance.

Simple PHP CLI example:

$data = array(

$writer = new XLSXWriter();

Note : PHP_XLSXWriter is simple to create lightweight excel spreadsheet using PHP library.

Whats new in PHP 7.3 ?

The PHP team announced the release of the first PHP 7.3 version RC5 with added following features, syntax updates and deprecations.


  • Flexible Heredoc and Nowdoc syntax
  • Allow a Trailing Comma in Function Calls
  • list() reference assignment

New features

  • Option to make json_encode and json_decode throw exceptions on errors
  • Introduced is_countable() function
  • Introduced array_key_first() and array_key_last() functions


  • Deprecated image2wbmp() function
  • Deprecated case-insensitive constants


The next release would be RC6, planned for November 22nd 2018.

Laravel PHP

Generate a PDF in Laravel

Hello, today we are talking about generating PDF. In Laravel generating PDF is pretty easy and simple. There are lots of libraries which is used to generate a PDF, but I think one of the best library for generating PDF is ‘laravel-dompdf’. It’s easy to install and configure. You can use chain methods, change paper size and many more configuration options available here.


Add following line in your ‘composer.json’ file.

composer require barryvdh/laravel-dompdf


After updating composer add following line to your config/app.php file.



If you want to use shorter façade, then add following line to your façade. Its optional.

'PDF' => Barryvdh\DomPDF\Facade::class,



$pdf = App::make('dompdf.wrapper');$pdf->loadHTML('<h1>Test</h1>');return $pdf->stream();


Using Façade.

$pdf = PDF::loadView('pdf.invoice', $data);return $pdf->download('invoice.pdf');


Link  :

Laravel PHP

Laravel Inspector – debugging and profiling tools for Web Artisans

This one is awesome laravel inspect tool for debugging the application,  It helps to the developer to develop a Quality application, Finding errors,  Query log, Request time, Response etc……

#Currently Available Collectors

  • MessageCollector – Handling User’s message & dump.
  • Exception – Exception
  • DBCollector – Queries, including execution time and parameters binding.
  • TimersCollector – Timers and time stamps
  • RoutesCollector – Application routes
  • RequestCollector – Current Request
  • ResponseCollector – Current Response
  • SessionCollector – Session variables
  • ServerCollector – $_SERVER dump

For more information –  Laravel Inspector


Laravel PHP

Laravel API Tester

Awesome package for API Tester, It helps you be more efficient while working with APIs. You can handle complex  HTTP requests quickly. With a lot of features, lightweight handling, Handle CSRF token etc.

Feature :

  • Display routes for your application.
  • Prepare and save requests.
  • Collaborate with your team using firebase.
  • Live search for everything.
  • Filter out routes in config.
  • CSRF token is handled for you.
  • Fill request in JSON editor.
  • Preview response depending on type (html or json).
  • Clean and intuitive interface.
  • Lightweight and no dependencies (except on laravel).


Read more on our GitHub laravel-api-tester

Online Interface – laravel-api-tester


Angular AngularJS General Laravel PHP

DevDocs – combines multiple API documentations in a fast, organized, and searchable interface.

DevDocs contain 100+ tutorial like Angular, Javascript, HTML, CSS etc with latest versions. It aims to make reading and searching reference documentation fast, easy and enjoyable. All the popular languages release versions documentations present in DevDocs.


For more details visit