Friday, 23 March 2018

Send Push Notification to Users Using Firebase Messaging Service in PHP

Send Push Notification to Users Browser Using Firebase Messaging Service in PHP   To Day I am Explain about how to send Push notifications using Firebase Cloud Messaging (FCM) in web application FCM service is free of charge with some limitations. The size is limited to 2KB or 4KB depending on the type of data, and the message will be kept for default duration of 4 weeks before it gets deleted.
Browser Support:
Chrome: 50+
Firefox: 44+
Opera Mobile: 37+

Wednesday, 13 September 2017

How to get closest date compared to an array of dates in PHP

Here Explain about how to find nearest date from any array of dates
Let's say I have an array as follows:

    [0] => 2017-09-14
    [1] => 2017-09-15
    [2] => 2017-09-16
    [3] => 2017-09-17
    [4] => 2017-09-18
    [5] => 2017-09-19

Thursday, 24 August 2017

File Size MB/KB/GB Conversion

The File size conversion as per The size is less than 1 MB, show the size in KB, if it's between 1 MB - 1 GB show it in MB, if it's larger - in GB
    function fileSizeConversion($bytes)
        if ($bytes >= 1073741824)
            $bytes = number_format($bytes / 1073741824, 2) . ' GB';
        elseif ($bytes >= 1048576)
            $bytes = number_format($bytes / 1048576, 2) . ' MB';
        elseif ($bytes >= 1024)
            $bytes = number_format($bytes / 1024, 2) . ' KB';
        elseif ($bytes > 1)
            $bytes = $bytes . ' bytes';
        elseif ($bytes == 1)
            $bytes = $bytes . ' byte';
            $bytes = '0 bytes';

        return $bytes;


Thursday, 10 September 2015

Get profile picture from facebook, twitter and gravatar

An useful resource for developer that requires profile images from various social network website. In this article you will learn how to get profile picture URL from Facebook, Twitter and Gravatar.

Get profile picture from facebook
Use following url to get facebook profile image. You have to replace with user id or uname of facebook user, Get facebook ID from here FB Id<ID>/picture?type=<small|normal|album|large|square>

Monday, 24 August 2015

Detecting Browser Geolocation Info

One interesting aspect of web development is geolocation; where is your user viewing your website from? You can base your language locale on that data or show certain products in your store based on the user's location. Let's examine how you can use the geolocation API to get location details!

Feature detection is the best way to confirm the Geolocation API is avilable.
if("geolocation" in navigator) {
 }else {
         alert("No soup for you!  Your browser does not support this feature");

Wednesday, 19 August 2015

Get address from Latitude and Longitude Coordinates in php

Get address from Latitude and Longitude Coordinates in php Get Address from given Latitude and Longitude Coordinates using google map api called Reverse Geocoding. It is the process of converting geographic coordinates (Latitude and Longitude) into addresses. Here is a little php function to get address from latitude and longitude.

previously explain about getting latitude and longitude values from Google Maps API, based on the town, city or country location.