Skip to content

Pog-Frog/Laravel-RESTful-APIs

Repository files navigation

Laravel RESTful APIs With Sanctum Authentication

A Full CRUD API using Laravel V.12 along with Sanctum for authentication

Key Features

  • Design Pattern: Follows the Repository Pattern for data access.
  • RESTful Architecture: Follows standard REST principles for API design.
  • Authentication: Basic setup for API authentication (e.g., Sanctum or Passport - specify if implemented).
  • API Resources: Transforming models into JSON responses.
  • CRUD Operations: Example endpoints for Create, Read, Update, Delete operations on resources.
  • Request Validation: Input validation to ensure data integrity.
  • Error Handling: Consistent error responses.

Prerequisites

  • PHP (version specified in composer.json >= 8.1)
  • Composer
  • A database supported by Laravel (e.g., MySQL, PostgreSQL, SQLite)

Getting Started

  1. Clone the repository:

    git clone https://github.com/Pog-Frog/Laravel-RESTful-APIs.git
    
    cd Laravel-RESTful-APIs
  2. Install PHP Dependencies:

    composer install
  3. Environment Setup:

    • Copy the example environment file:
      cp .env.example .env
    • Generate the application key:
      php artisan key:generate
    • Configure your database connection and other environment variables in the .env file (DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD, etc.).
  4. Database Migrations:

    • Run the database migrations to create the necessary tables:
      php artisan migrate
    • (Optional) Seed the database with initial data:
      php artisan db:seed

Running the Application

  • Development Server: Start the local development server:

    php artisan serve

    The API will typically be available at http://127.0.0.1:8000 or http://localhost:8000.

  • API Endpoints: Refer to the API documentation or route definitions (routes/api.php) for available endpoints.

About

CRUD APIs with Sanctum Authentication

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages