Blog; Sign up for our newsletter to get our latest blog updates delivered to your inbox weekly. PHP Firebase Firebase Examples PHP Firebase Firebase - 6 examples found. These are the top rated real world PHP examples of FirebaseFirebase extracted from open source projects. You can rate examples to help us improve the quality of examples.
In this project tutorial we will create a new Php project and will use Firebase/Php-JWT package to generate JSON Web Tokens.
In the introduction tutorial we learned about JWT. Feel free to check that out.
We will need the following for this project.
- Local PHP development environment. Try MAMP/XAMPP/WAMP.
- Composer the package manager.
- firebase/php-jwt package to generate JWT and validate it.
You can find the code of this project in my GitHub repository jwt-php-project.
Lets get started.
Create a new project
Open your favourite text editor or IDE and create a new PHP project folder.
For this tutorial I am naming my project jwt-php-project.
Get firebase/php-jwt package
Get firebase/php-jwt package using composer and typing the following command
composer require firebase/php-jwt.
At the time of writing this tutorial I am using firebase/php-jwt version 5.0.0.
The above command will create the
vendor directory and will download firebase/php-jwt package inside it.
Create index.php file
Create an index.php file in the project folder.
In this file we will create a login form.
Create a login form
Inside the index.php file create a login form.
This form contains an email field and a password field and a login button.
On successful login it will generate a JWT for the user which we will later use to fetch the user detail.
Create a script.js file
Include this file in the index.php file.
Our index page will look like the following.
By now our project index.php page will look like the following.
Php Jwt Decode
For this demo project I am using Twitter Bootstrap v4.0 to style the page.
This brings us to the end of this introduction tutorial. In the next tutorial we will work on the PHP script to generate JWT for the users.
Firebase Phone Number Authentication In Php
See you in the next tutorial.