How Can I Generate a Random Alphanumeric String in PHP?

The need to generate a unique random alphanumeric string of a given length is very common. You may need it for various purpose like creating a random username or a filename. In this article, you will learn about different methods that can be used to generate random alphanumeric string in PHP.

  1. Using str_shuffle() to Generate a Random String
  2. Using md5() and sha1() to Generate a Random String
  3. Using the random_bytes() Function
  4. Quick Summary
Random Alphanumeric
(more…)

Docusign PHP API – Send document to recipient for signature

DocuSign provides many different code examples that demonstrate a variety of scenarios in each supported language (C#, Java, Node.js, PHP, Python, Ruby, and raw API calls using Bash and PowerShell).

Docusign

Using Docusign PHP API’s to send documents for signature.

(more…)

How to Handle CSV with PHP: Read Write, Import Export with Database

CSV is one of the familiar file formats and used widely by programmers for handling data. The simplicity of the format and human readable form made it so popular. CSV stands for Comma-Separated Values. In earlier days, the delimiter was only a comma (,) and so the name CSV. Nowadays, CSV files use tab-demitted row data too. 

To handle CSV with PHP, we must be aware there is excellent support in-built with core PHP. Knowledge about those built-in library and functions will he handy in handling CSV files.

Export Data to CSV
(more…)

Razorpay payment gateway php integration

In this tutorial, I will explain to you how we can integrate the Razorpay payment gateway into our PHP Application.

razorpay

Razorpay is the most user friendly payment gateway that’s provides payment solutions in India . It’s a new entry in payment gateways and getting popular very fast due to its friction less transactions functionality for web and mobile. Razorpay provides clean, fast, secure payments services with hassle free integration with developer friendly APIs. It allows online business to accept and process payments payments modes like Debit Card, Credit Card, Net Banking, UPI and PrePaid Digital Wallets.

(more…)

How to Get the Client User IP Address in PHP

This is fairly a straightforward topic. Just a few lines of PHP code will do the work of getting the client user IP address. Most of the times it is true, it is all about a few lines of PHP script.

Sometimes things get tricky. We shall see about those things and also an other aspect like the privacy issue involved with it.

Following one line PHP code will get you the client user’s IP address. Then why all the fuss? Read through the article and you will know about it.

$_SERVER['REMOTE_ADDR'];

$_SERVER is a PHP array which is set by the server. Depending on this one line PHP code may not yield the best results in many a situation. For example, if a client is behind a proxy server, then this variable will not be suitable. Also be aware that, these headers can be easily spoofed by the users by setting an IP address themselves. (more…)

Bootstrap Contact Form with JavaScript Validation and PHP

Bootstrap is the most popular solution to design an optimum, intuitive, mobile-ready UI components. It is easy to integrate the Bootstrap library for the application interface.

Often, many of my readers ask for a Bootstrap contact form code. So I thought of creating a basic example for a Bootstrap enabled PHP contact form.

Bootstrap provides in-built features to take care of UI responsiveness, form validation, and more. I used its SVG icon library to display the contact form fields with suitable icons.

A Bootstrap contact form looks enriched. UI attracts people and enables them to use it with ease. Also, the developers’ effort is reduced by using the Bootstrap framework. (more…)

How to Make Online Photo Editing Effects like Blur Image, Sepia, Vintage

Photo editing effects will turn graphical elements to be expressive. With suitable effects, you can use a simple image and convey an idea. For example, you can bring logo to the foreground by blurring the background image.

The effects like image blur, transparency, shadowing creates attractive visual effects. There are many different image effects available. In fact, hundreds of them are available.

Online photo editing tools use a variety of methods to apply the effects on a target image. For example, either a CSS filter property or a SVG filter primitive can create an image blur effect.

Most of the visual effects are achievable with HTML5 and CSS3 filter properties. We will see how to make photo editing effects to blur, apply sepia, and vintage effect on a target image.

I created a simple image editing tool to apply blur, sepia, and vintage effect on a target image. Following is a live preview of the tool.

I have added a jQuery slider to allow you to fiddle with the image editing effects between a min-max range.

This example handles blur, sepia and vintage effect on an image element. (more…)

PHP OOP – Constructor

Constructor in PHP is special type of function of a class which is automatically executed as any object of that class is created or instantiated.

PHP – The __construct Function

PHP 5 allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used.

PHP OOP - Constructor

(more…)

PHP OOP – Classes and Objects

A class is a template for objects, and an object is an instance of class.

Object Oriented Concepts

Before we go in detail, lets define important terms related to Object Oriented Programming.

  • Class − This is a programmer-defined data type, which includes local functions as well as local data. You can think of a class as a template for making many instances of the same kind (or class) of object.
  • Object − An individual instance of the data structure defined by a class. You define a class once and then make many objects that belong to it. Objects are also known as instance.

class-object
(more…)

PHP – What is OOP?

Object-Oriented programming is faster and easier to execute. From PHP5, you can also write PHP code in an object-oriented style.

PHP What is OOP?

OOP stands for Object-Oriented Programming.

oop-in-php

(more…)