An open API service indexing awesome lists of open source software.

https://github.com/mrprotocoll/api-boilerplate-laravel

This Laravel 11 API boilerplate provides a structured foundation for building robust backend applications with Laravel, integrating essential features and tools.
https://github.com/mrprotocoll/api-boilerplate-laravel

boilerplate boilerplate-laravel laravel-11 laravel-11-boilerplate laravel-boi

Last synced: 5 months ago
JSON representation

This Laravel 11 API boilerplate provides a structured foundation for building robust backend applications with Laravel, integrating essential features and tools.

Awesome Lists containing this project

README

        


๐Ÿ•น๏ธ๐Ÿ•น๏ธ Laravel API Boilerplate๐Ÿ•น๏ธ๐Ÿ•น๏ธ




# ๐Ÿ“— Table of Contents

- [๐Ÿ“– About the Project](#about-project)
- [๐Ÿ›  Built With](#built-with)
- [Tech Stack](#tech-stack)
- [๐Ÿš€ Links](#api-docs)
- [Features](#features)
- [๐Ÿ’ป Getting Started](#getting-started)
- [Setup](#setup)
- [Prerequisites](#prerequisites)
- [Usage](#usage)
- [๐Ÿค Contributing](#contributing)

# ๐Ÿ“– API Boilerplate

A robust, modular Laravel 11 API boilerplate built using a Domain-Driven Design (DDD) approach. This boilerplate provides a scalable foundation for modern API development with essential features like role-based access, versioning, Google OAuth integration, and more..

### Features

- Domain-Driven Architecture: Organized modules and shared resources for scalability.
- Versioning: Supports multiple API versions with structured routing.
- Role-Based Access Control: Integrated roles and permissions with easy extensibility.
- Google OAuth: Simplified OAuth 2.0 authentication setup.
- Modular Components: Independent modules for Auth, User, and more.
- Enums and Helpers: Centralized, reusable enums and helper methods.
- Custom Middlewares: Pre-configured middlewares for JSON responses, caching, logging, and preventing duplicate requests.
- Optimized Exception Handling: Friendly and consistent error responses.
- Custom Base Model: A UUID-enabled base model for consistency across entities.
- Seeders and Factories: Simplified data seeding with predefined roles.
- Rate Limiting: API throttling to prevent abuse.
- Fully Documented: Swagger/OpenAPI support for API documentation.

### Architecture Overview
#### Domain-Driven Design (DDD)
The project structure is organized to separate concerns:

`src/modules`: Contains feature-specific modules, e.g., Auth and User.
`src/shared`: Shared resources like helpers, enums, and base classes.

#### Versioning
Version-specific modules and routes are located in the `V1` directory for flexibility.

### Tech Stack

- PHP
- Laravel

(back to top)

## ๐Ÿš€ Links

To access the documentation goto the below link

- Link to api routes
```
http://localhost:8000/v1
```
- Link to documentation
```
http://localhost:8000/v1/documentation
```


(back to top)

## ๐Ÿ’ป Getting Started

To get a local copy up and running, follow these steps.

### Prerequisites

In order to run this boilerplate, you need:

1. PHP ^8.2

use the following link to setup `PHP` if you dont have it already installed on your computer

(install PHP)

2. Composer

use the following link to Download `Composer` if you dont have it already installed on your computer

(install Composer)

## Install
clone the repository:
```
git clone [email protected]:mrprotocoll/api-boilerplate-laravel.git
```

Install dependencies:

```
composer install
```

## Setup

create .env file, change using the .env.example file and update the Database, Google Oauth (optional), and Email credentials.
```
cp .env.example .env
```

Generate keys, Run the migration and seed roles:

```
php artisan key:generate
php artisan migrate --seed
```

### Usage

The following command can be used to run the application.

```sh
php artisan serve
```

(back to top)

## Contributing
Feel free to fork the repository, make changes, and submit pull requests. Feedback is always welcome!

## License
This project is licensed under the MIT License.