Search Results For: class
Showing 1 to 5 of 18 blog articles.
1354 views · 45 days ago

![Securing PHP RESTful APIs using Firebase JWT Library](

Hello Guys,

In our [Last Blog Post](, we have created restful apis,But not worked on its security and authentication. Login api can be public but after login apis should be authenticate using any secure token. one of them is JWT, So i am providing the Steps for Create and use JWT Token in our already created API.

Now its time To Implement JWT Authentication IN our Api, So these are the steps to implement it in our already created Apis

### Step 1:Install and include Firebase JWT(JSON WEB TOKEN) in our project with following composer command        

``` composer require firebase/php-jwt ```

include the composer insta...

1261 views · 53 days ago

![Implement Web Push Notification in PHP using W3C provided Notification API](

Hi Guys,

I am sharing you the simple steps by which you can broadcast the web push notifications to your subscriber. In this tutorial we are making a subscriber form and saving information using Ajax and PHP and then through a server side code returning response to current logged in user and showing notification to that user.

**Following are the steps to build this system**

#### 1. Create a database, I am creating db with name 'web_notifications'

Creating subscribers and notifications tables using following sql statements



`id` int(11) NOT NULL,

`name` varchar(255) NOT NULL,

`email` varchar(255) NOT NULL,


1529 views · 58 days ago

![Laravel Eloquent Relationship Part 1](

Laravel introduces eloquent relationships from laravel 5.0 onwards. We all know, while we creating an application we all have foreign keys. Each table will be connected to some other. Eloquent make easy to connect each tables easily. Here we will One to one, one to many and many to many relationships. Here we will see three types of relationships,

1. One to one relationships

2. One to many relationships

3. Many to many relationships

## Why Eloquent Relationships

Here we have 2 tables, students and marks, so for join each table,


$student = student::join(‘marks’,’marks.student_id,’=’,’)->where(‘’,’1’)->get();



the above query is to l...

2088 views · 96 days ago

![Standalone PHP Class for Managing Session Based Multiple Cart](

Hi Guys,

I am sharing you a standalone class for managing a session based cart system. In this class I have provided multiple methods for adding, updating and deleting the products. and By using this class you may manage multiple cart objects with different data only you need to pass a different key in constructor of that class.

### Let me share you the How can we use that Class:

#### Include The cart class


require 'PhpKart.class.php';



#### Create a Cart Object initializing the Cart base key name, by using different keys we can manage multiple cart data in a same proj...

2960 views · 116 days ago

![Create Simple RESTful APIs using PHP & MySQL](

Hi Guys,

I am sharing you the way to create simple resful apis using php and mysql. We are creating 2 apis here

First is to Loggin a existing user and second is to get list of written blogs by logged in user.

#### Create any database, i am taking ```news``` as the database name here, After it create following 2 tables inside it.


CREATE TABLE `users` (


`name` varchar(100),

`email` varchar(100),

`password` varchar(100),

`createdAt` datetime NOT NULL,



CREATE TABLE `blogs` (


`user_id` int(11),

`title` varchar(2...