{"id":20331585,"url":"https://github.com/holiq/api-boilerplate","last_synced_at":"2026-05-11T15:09:15.080Z","repository":{"id":254706589,"uuid":"846458596","full_name":"holiq/api-boilerplate","owner":"holiq","description":"Boilerplate rest api on Laravel with Actions DTOs and clean code ","archived":false,"fork":false,"pushed_at":"2024-12-01T12:34:56.000Z","size":111,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T15:28:26.309Z","etag":null,"topics":["api","backend","boilerplate","laravel","rest-api","template"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/holiq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-23T08:54:26.000Z","updated_at":"2024-12-01T12:35:00.000Z","dependencies_parsed_at":"2024-11-12T14:43:46.795Z","dependency_job_id":null,"html_url":"https://github.com/holiq/api-boilerplate","commit_stats":null,"previous_names":["holiq/api-boilerplate"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holiq%2Fapi-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holiq%2Fapi-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holiq%2Fapi-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holiq%2Fapi-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holiq","download_url":"https://codeload.github.com/holiq/api-boilerplate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241846845,"owners_count":20030149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","backend","boilerplate","laravel","rest-api","template"],"created_at":"2024-11-14T20:22:10.996Z","updated_at":"2026-05-11T15:09:15.074Z","avatar_url":"https://github.com/holiq.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel API Boilerplate\n\n![Laravel Version](https://img.shields.io/badge/Laravel-12.x-red)\n![PHP Version](https://img.shields.io/badge/PHP-8.2-blue)\n![License](https://img.shields.io/badge/license-MIT-green)\n![Tests](https://img.shields.io/badge/tests-Pest-green)\n![Code Quality](https://img.shields.io/badge/analysis-PHPStan-blue)\n\nThis repository provides a production-ready boilerplate for creating RESTful APIs using Laravel 12, with a focus on clean, maintainable code. It leverages Actions, Data Transfer Objects (DTOs), API Resources, and modern best practices to ensure a scalable and well-documented architecture.\n\n## Table of Contents\n\n-   [Features](#features)\n-   [Getting Started](#getting-started)\n    -   [Prerequisites](#prerequisites)\n    -   [Installation](#installation)\n    -   [Running the API](#running-the-api)\n    -   [API Documentation](#api-documentation)\n-   [API Endpoints](#api-endpoints)\n-   [Usage](#usage)\n    -   [Architecture Overview](#architecture-overview)\n    -   [Creating New Features](#creating-new-features)\n    -   [Authentication](#authentication)\n    -   [Response Format](#response-format)\n-   [Testing](#testing)\n-   [Code Quality](#code-quality)\n-   [Contributing](#contributing)\n-   [License](#license)\n-   [Security](#security)\n\n## Features\n\n-   **RESTful API**: Preconfigured routes and controllers for building APIs\n-   **Authentication System**: Complete auth implementation with JWT tokens using Laravel Sanctum\n-   **Email Verification**: Secure email verification workflow\n-   **Password Reset**: Robust password reset functionality\n-   **Actions**: Separate business logic into single-responsibility classes\n-   **DTOs**: Manage data flow between layers of the application\n-   **API Resources**: Transform models into consistent JSON responses\n-   **API Documentation**: Auto-generated API docs with Scramble\n-   **Clean Code**: Emphasis on readability, reusability, and performance\n-   **Testing Suite**: Comprehensive test coverage using Pest\n-   **Code Quality**: Static analysis with PHPStan and code formatting with Pint\n-   **Laravel 12**: Leverage the latest features and enhancements in Laravel\n\n## Getting Started\n\n### Prerequisites\n\n-   PHP 8.2 or higher\n-   Composer\n-   Laravel 12.x\n-   MySQL or any other supported database\n\n### Installation\n\n1. **Clone the repository:**\n\n    ```bash\n    git clone https://github.com/holiq/api-boilerplate.git\n    ```\n\n2. **Navigate to the project directory:**\n\n    ```bash\n    cd api-boilerplate\n    ```\n\n3. **Install dependencies:**\n\n    ```bash\n    composer install --prefer-dist\n    ```\n\n4. **Set up environment variables:**\n\n    Copy the `.env.example` file to `.env` and configure your database settings.\n\n    ```bash\n    cp .env.example .env\n    ```\n\n5. **Generate application key:**\n\n    ```bash\n    php artisan key:generate\n    ```\n\n6. **Run migrations:**\n\n    ```bash\n    php artisan migrate\n    ```\n\n7. **Seed the database (optional):**\n\n    ```bash\n    php artisan db:seed\n    ```\n\n### Running the API\n\nStart the development server:\n\n```bash\nphp artisan serve\n```\n\nThe API will be accessible at `http://localhost:8000/api`.\n\n### API Documentation\n\nThis boilerplate includes auto-generated API documentation using Scramble. Once your server is running, you can access the interactive API documentation at:\n\n```\nhttp://localhost:8000/docs/api\n```\n\nThe OpenAPI specification is available at:\n\n```\nhttp://localhost:8000/docs/api.json\n```\n\n## API Endpoints\n\n### Authentication\n\n| Method | Endpoint                             | Description               | Authentication |\n| ------ | ------------------------------------ | ------------------------- | -------------- |\n| POST   | `/api/auth/register`                 | Register a new user       | No             |\n| POST   | `/api/auth/login`                    | Login user                | No             |\n| POST   | `/api/auth/logout`                   | Logout user               | Required       |\n| POST   | `/api/auth/forgot-password`          | Send password reset link  | No             |\n| POST   | `/api/auth/reset-password`           | Reset password with token | No             |\n| GET    | `/api/auth/verify-email/{id}/{hash}` | Verify email address      | Required       |\n| POST   | `/api/auth/resend-email`             | Resend verification email | Required       |\n\n### API Information\n\n| Method | Endpoint | Description          | Authentication |\n| ------ | -------- | -------------------- | -------------- |\n| GET    | `/api/`  | Get API version info | No             |\n\n## Usage\n\n### Architecture Overview\n\nThis boilerplate follows a clean architecture pattern with the following components:\n\n-   **Routes**: Define your API routes in `routes/api.php` and `routes/auth.php`\n-   **Controllers**: Implement your API logic using controllers located in `app/Http/Controllers`\n-   **Actions**: Organize business logic in `app/Actions` using the custom `make:action {name}` command\n-   **DTOs**: Use Data Transfer Objects in `app/DataTransferObjects` with `make:dto {name}` command\n-   **Resources**: Transform model data using API Resources in `app/Http/Resources`\n-   **Requests**: Validate incoming data using Form Requests in `app/Http/Requests`\n\n### Creating New Features\n\n1. **Generate an Action:**\n\n    ```bash\n    php artisan make:action Auth/CustomAction\n    ```\n\n2. **Generate a DTO:**\n\n    ```bash\n    php artisan make:dto Auth/CustomData\n    ```\n\n3. **Generate a Resource:**\n\n    ```bash\n    php artisan make:resource Api/CustomResource\n    ```\n\n4. **Generate a Request:**\n    ```bash\n    php artisan make:request Api/CustomRequest\n    ```\n\n### Authentication\n\nThe API uses Laravel Sanctum for authentication. After successful login, you'll receive a token that should be included in subsequent requests:\n\n```bash\nAuthorization: Bearer {your-token-here}\n```\n\n### Response Format\n\nAll API responses follow a consistent format:\n\n**Success Response:**\n\n```json\n{\n  \"status\": \"success\",\n  \"message\": \"Operation completed successfully\",\n  \"data\": {...}\n}\n```\n\n**Error Response:**\n\n```json\n{\n  \"status\": \"error\",\n  \"message\": \"Something went wrong\",\n  \"errors\": {...}\n}\n```\n\n## Testing\n\nRun the test suite using Pest:\n\n```bash\n# Run all tests\nphp artisan test\n\n# Run specific test file\nphp artisan test tests/Feature/Auth/LoginTest.php\n\n# Run tests with coverage\nphp artisan test --coverage\n```\n\n## Code Quality\n\n### Static Analysis\n\nRun PHPStan for static analysis:\n\n```bash\nvendor/bin/phpstan analyse\n```\n\n### Code Formatting\n\nFormat your code using Laravel Pint:\n\n```bash\nvendor/bin/pint\n```\n\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. Fork this repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Run tests and ensure code quality (`php artisan test \u0026\u0026 vendor/bin/pint \u0026\u0026 vendor/bin/phpstan analyse`)\n5. Push to the branch (`git push origin feature/amazing-feature`)\n6. Open a Pull Request\n\nPlease ensure your code follows the existing style and includes appropriate tests.\n\n## License\n\nThis project is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n\n## Security\n\nIf you discover any security-related issues, please email the maintainer instead of using the issue tracker.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholiq%2Fapi-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholiq%2Fapi-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholiq%2Fapi-boilerplate/lists"}