This project is for testing my skills in RESTFul API
& Auth JWT
with Laravel .
SoleeLab
is a RESTful API Project with 3 APIs for mobile app to help to get all countries with thier area in KM2
- xampp
- php v 7.*
- composer
- Postman ( https://www.getpostman.com/apps ) or you can use your prefer extension to your browser for example RestMan for opera
- clone Repo
git clone https://github.com/Eslam-Ayman/SoleekLab-JWT.git
- cd into your project
- Install Composer Dependencies
composer install
- Create a copy of your .env file
cp .env.example .env
- Generate an app encryption key
php artisan key:generate
- If the application key is not set, your user sessions and other encrypted data will not be secure!
- Create an empty database for our application
- In the .env file, add database information to allow Laravel to connect to the database
- Migrate the database
php artisian migrate
- if you don't need to migrate so import
soleeklab.sql
in your DB - and after that you must run
php artisian migrate
- Run the following command to publish the package config file:
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
- You should now have a
config/jwt.php
file that allows you to configure the basics of this package.
- you have to generate a key for JWT:
php artisan jwt:secret
- This will update your .env file with something like JWT_SECRET=foobar
- It is the key that will be used to sign your tokens. How that happens exactly will depend on the algorithm that you choose to use.
- run this command
php artisan serve
- open your browser on this link http://127.0.0.1:8000
Name | Method | URL | Header | Body ( RAW ) not (form-data) |
---|---|---|---|---|
Login | POST | http://127.0.0.1:8000/api/login | Content-Type : application/json Accept : application/json |
Required Data : (email, password) Optional Data : (null) |
Register | POST | http://127.0.0.1:8000/api/register | Content-Type : application/json Accept : application/json |
Required Data : (name, email, password, password_confirmation) Optional Data : (null) |
Area | GET | http://127.0.0.1:8000/api/area | Content-Type : application/json Accept : application/json Authorization : Bearer |
null |
Note: if you want to send data in Body Format (form-data) so you must remove
Content-Type
from Header
JWT-Auth Documentation of jwt-auth && Repo of jwt-auth
Unirest is a set of lightweight HTTP libraries available in multiple languages. i used this library to get json data from another Public API witch is list of all countries in the world unirest php library
to install it using composer composer require mashape/unirest-php
GNU GPL License
Author : Eslam Ayman