Skip to content

AdxStackDev/event-booking

Repository files navigation

Laravel 9 Event-Booking API

A simple RESTful API built with Laravel 9 using JSON Web Tokens (JWT) for Event -Booking.

🔧 Features

  • User registration
  • User login with JWT
  • Token-based authentication
  • Secure route access using middleware
  • Laravel 9 and Tymon JWTAuth integration

🛠️ Requirements

  • PHP >= 8.0
  • Composer
  • Laravel 9
  • MySQL or any supported DB
  • WAMP/XAMPP/Laragon (or your preferred local server)

🚀 Installation

  1. Clone the repository:
git clone https://github.com/yourusername/event-booking
cd event-booking
  1. Install dependencies:
composer install
  1. Copy .env file:
cp .env.example .env
  1. Generate application key:
php artisan key:generate
  1. Configure your database in .env:
DB_DATABASE=your_db
DB_USERNAME=root
DB_PASSWORD=
  1. Run migrations:
php artisan migrate
  1. Install JWT package:
composer require tymon/jwt-auth
  1. Publish JWT config:
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
  1. Generate JWT secret:
php artisan jwt:secret
  1. Serve the app:
php artisan serve

📬 API Endpoints

Method Endpoint Description
POST /api/register Register a new user
POST /api/login Login and get token
GET /api/user Get authenticated user (requires token)

🛡️ Secure Routes

Add auth:api middleware to protect routes:

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

📂 Folder Structure

app/Http/Controllers/API/AuthController.php
config/auth.php
routes/api.php

📖 License

This project is open-sourced software licensed under the MIT license.

About

A Laravel 9 Event Booking REST API with JWT Authentication for secure user registration, login, logout, and profile access.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages