Skip to content

Laravel 10 : APIs Using JWT token Authentication | Category CRUD APIs | Blog CRUD APIs | Multi Language API

License

Notifications You must be signed in to change notification settings

VikrantParmar/laravel-jwt-api-crudX

Repository files navigation

Laravel Laravel 10 JWT Authentication REST API 🚀

This project is a backend application built with the PHP Laravel framework, MySQL, and JWT (JSON Web Tokens) authentication. It provides a robust REST API for managing user authentication, category, and blog features, with multi-language support for English (EN), French (FR), and German (DE).


This is a login system with two types of users:

  • Admin
  • User

⭐ Features

🔒 Authentication APIs

  • Login: Secure login using JWT tokens.
  • Register: New user registration. Sends email notifications to the user and the system admin.
  • Forgot Password: Sends an email to the registered user with a password reset link.
  • Reset Password: Allows users to securely reset their password.
  • Profile: Fetch, update, and manage user profile data.

📧 Email Notifications

  • User Registration: Email notifications are sent to both the newly registered user and the system admin.
  • Forgot Password Request: Email with a reset link is sent to the registered user.

📂 Category APIs [Only Access By Admin Role]

  • List Categories: Retrieve a list of all categories.
  • Add Category: Add a new category to the system.
  • Update Category: Update an existing category.
  • Category Details: Fetch details of a specific category.
  • Delete Category: Delete a category.

📝 Blog APIs

  • List Blogs: Retrieve a list of all blogs.
  • Add Blog: Add a new blog post to the system.
  • Update Blog: Update an existing blog post.
  • Blog Details: Fetch details of a specific blog post.
  • Delete Blog: Delete a blog post.

🌐 Multi-Language Support

  • Supports three languages: English (EN), French (FR), and German (DE).
  • Language selection can be done via API headers.

⚙ Installation and Setup Instructions

Follow these steps to set up the Laravel application:

  1. Clone the Repository
    git clone https://github.com/VikrantParmar/laravel-jwt-api-crudX.git
    cd laravel-jwt-api-crudX
    
  2. Install Dependencies
    composer install
    
  3. Create Environment File
    cp .env.example .env
    - Update the .env file with your database credentials and email configuration.
    
  4. Generate Application Key
    php artisan key:generate
    
  5. Run Database Migrations
    php artisan migrate
    
  6. Run Seeders
    php artisan db:seed
    
  7. Run the Application
    php artisan serve
    
  8. Access the Application Open your browser and navigate to
    http://127.0.0.1:8000
    

Default Credentials for Testing

Role Username Password
Admin vikrant-admin@example.com 123456789
User vikrant-user@example.com 123456789
User-Inactive vikrant-inactive@example.com 123456789

📋 API Documentation

🔗 Visit the Postman Docs for more details Postman Docs

Endpoints Overview

🔒 Authentication

  • POST /api/v1/login - User login.
  • POST /api/v1/register - User registration.
  • POST /api/v1/forgot-password - Request password reset.
  • POST /api/v1/reset-password - Reset password.
  • GET /api/v1/profile - Get user profile.

Category Management

  • GET /api/v1/categories - List categories.
  • POST /api/v1/categories - Add a new category.
  • PUT /api/v1/categories/{id} - Update a category.
  • GET /api/v1/categories/{id} - Get category details.
  • DELETE /api/v1/categories/{id} - Delete a category.

Blog Management

  • GET /api/v1/blogs - List blogs.
  • POST /api/v1/blogs - Add a new blog post.
  • PUT /api/v1/blogs/{id} - Update a blog post.
  • GET /api/v1/blogs/{id} - Get blog details.
  • DELETE /api/v1/blogs/{id} - Delete a blog post.

🌐 Multi-Language Support

Set the Accept-Language header in your API requests to one of the following values:

  • en for English
  • fr for French
  • de for German

Note

Include additional setup instructions if you use third-party services (e.g., mail providers or APIs).
Multi-Language for only api reponse msg like success and error.

🌎 Contact

For questions, feedback, or collaboration inquiries, please contact:

Name: Vikrant Parmar
Email: vikrant.parmar91@gmail.com

Thank you for using this application! 😊

Releases

No releases published

Packages

No packages published

Languages