{"id":14974866,"url":"https://github.com/wendelladriel/larapi","last_synced_at":"2025-10-27T10:31:38.699Z","repository":{"id":37530316,"uuid":"248578209","full_name":"WendellAdriel/larapi","owner":"WendellAdriel","description":"API Skeleton created with Laravel","archived":false,"fork":false,"pushed_at":"2023-04-19T18:43:47.000Z","size":2869,"stargazers_count":63,"open_issues_count":5,"forks_count":9,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-10-11T11:20:09.065Z","etag":null,"topics":["api","boilerplate","laravel","laravel7","php","php7","skeleton"],"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/WendellAdriel.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}},"created_at":"2020-03-19T18:37:48.000Z","updated_at":"2024-07-24T07:19:15.000Z","dependencies_parsed_at":"2024-01-14T08:06:48.699Z","dependency_job_id":null,"html_url":"https://github.com/WendellAdriel/larapi","commit_stats":{"total_commits":42,"total_committers":5,"mean_commits":8.4,"dds":0.2857142857142857,"last_synced_commit":"242c5e7da4f15947eb33cfd7b8446e887192bdfb"},"previous_names":[],"tags_count":18,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WendellAdriel%2Flarapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WendellAdriel%2Flarapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WendellAdriel%2Flarapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WendellAdriel%2Flarapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WendellAdriel","download_url":"https://codeload.github.com/WendellAdriel/larapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219861468,"owners_count":16555994,"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","boilerplate","laravel","laravel7","php","php7","skeleton"],"created_at":"2024-09-24T13:51:11.636Z","updated_at":"2025-10-27T10:31:36.684Z","avatar_url":"https://github.com/WendellAdriel.png","language":"PHP","readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"/art/socialcard.png\" alt=\"LARAPI Social Card\"\u003e\u003c/p\u003e\n\n# LARAPI\n\nOpinionated API Skeleton created with Laravel\n\n## Configuring the project\n\n```\ncomposer create-project --prefer-dist wendelladriel/larapi my-app \u0026\u0026 cd my-app \u0026\u0026 sh ./tools/configure.sh\n```\n\nThis will:\n- Create the project\n- Install the dependenciesr\n- Copy the `.env.example` to `.env` in the project root;\n- Generate the `APP_KEY`\n- Generate the `JWT_SECRET`\n- Configures the **Git Hooks** for the project;\n\nUpdate your `.env` file as needed;\n\nRun the migrations and the seeders:\n\n```\nphp artisan migrate \u0026\u0026 php artisan db:seed\n```\n\nConfigure your local Virtual Host. After that visit the host URL and you will see a JSON response like below:\n\n```json\n{\n    \"application\": \"LarAPI\",\n    \"environment\": \"local\",\n    \"status\": 200\n}\n```\n\n## App Architecture\n\nInside the `app` folder will live only other folders, no files are allowed in the root. The basic architecture is composed by four main folders:\n\n`Core`: The basic architecture files only are placed here:\n\n- Exception Handler and Custom Exceptions;\n- Kernel files;\n- Providers;\n- Middlewares;\n- Base files like BaseController and BaseRepository;\n\n`Models`: All the application Model classes are placed here, but no classes are allowed in the root of the directory. All models should be put into a namespace depending on its purpose, besides that there are two other folders:\n\n- Traits for model specific Traits;\n- Relations for custom relationship classes;\n\n`Repositories`: All the application Repository classes are placed here, but no classes are allowed in the root of the directory. All repositories should be put into a namespace depending on its purpose, besides that, there is a `Traits` folder for repository specific Traits. If you create a Repository for a specific Model class, use the same namespace you gave to the Model class, per example the `Models\\Auth\\User` repository **MUST** be `Repositories\\Auth\\UserRepository`. **ALWAYS** put the suffix `Repository`. All repositories **MUST** extend `LarAPI\\Core\\Repositories\\BaseRepository`\n\n`Modules`: All modules of the application are placed here, per example **Auth Module**. No classes are allowed in the root of the directory.\n\n`Common Module`: This is a **Module Folder** (all module folders **MUST HAVE** the same folder and file structure). This module was created to have **ONLY** common and general purpose classes:\n\n- **Commands:** Command files for this module;\n- **Controllers:** Controller files for this module. **DON'T** use the name in the plural form and **ALWAYS** put the suffix `Controller`. Example: `UserController`, `ProductController`. All controllers **MUST** extend `LarAPI\\Core\\Http\\BaseController`;\n- **Events:** Event files for this module. Try to use verbs for the name and **ALWAYS** put the suffix `Event`. Example: `ActivateUserEvent`;\n- **Listeners:** Listener files for this module. Try to use nouns for the name and **ALWAYS** put the suffix `Listener`. Example: for the `ActivateUserEvent` use `UserActivatedListener`;\n- **Requests:** Custom request files for this module.Try to use verbs for the name and **ALWAYS** put the suffix `Request`. Example: `ActivateUserRequest`. All requests **MUST** extend `LarAPI\\Core\\Http\\BaseRequest`;\n- **Responses:** Custom response files for this module. Try to use nouns for the name and **ALWAYS** put the suffix `Response`. Example: `UserActivatedResponse`;\n- **Routing:** Route files for this module. Each file is a version of the API. Follow the format: `v1.php`, `v2.php`, etc;\n- **Services:** Service files for this module. **ALWAYS** put the suffix `Service`;\n- **Support:** Helper files for this module;\n- **Traits:** Trait files for this module;\n\nWhen you create a new **Module** in the `app/Modules` folder, add the module name to the `config/modules.php` file. This configuration file is also used to enable and disable modules in your API. The modules listed there will be the enabled ones.\n\n## Creating Scheduled Commands\n\nAll commands that will be scheduled on `Console/Kernel` **MUST** extends from `LarAPI\\Core\\Console\\ApiTaskCommand`;\n\nWhen scheduling the commands, all commands **MUST** be scheduled with the `-\u003erunInBackground();` method;\n\n## Features\n\n### API Documentation\n\n**LarAPI** provides API documentation for your API using **Swagger**. You can check the API docs accessing: `HOST_URL/swagger`.\n\n### Auth\n\n**LarAPI** provides you **JWT Authentication**, **User Settings** and **User Roles** out-of-the-box. You can check the default authentication endpoints on the **Swagger Docs of the API**.\n\n### Controllers\n\nThe `LarAPI\\Core\\Http\\BaseController` class provides three helper methods for returning data from the API:\n\n- `apiSimpleSuccessResponse(int $code = Response::HTTP_CREATED): JsonResponse`\n\n- `apiSuccessResponse($data, int $code = Response::HTTP_OK): JsonResponse`\n\n- `apiErrorResponse(string $message, Throwable $exception = null, $code = Response::HTTP_INTERNAL_SERVER_ERROR): JsonResponse`\n\n### DTOs\n\n**LarAPI** provides you two generic DTOs classes that can be useful for requests of datatables.Check out `LarAPI\\Modules\\Common\\Support\\DTOs\\CommonTableDTO` and `LarAPI\\Modules\\Common\\Support\\DTOs\\DateRangeDTO`\n\n### Exceptions\n\n**LarAPI** provides a configured Exception Handler that will return only JSON responses and also a base interface for you to identify your custom exceptions that will be handled by the custom exception handler provided. It also provides a custom exception example.\n\n### Formatter\n\nThe `LarAPI\\Modules\\Common\\Support\\Formatter` class provides a lot of functions to format data and helper constants to use within your code.\n\n### Git Hooks\n\nThe project has some Git Hooks to update the API documentation using **Swagger**, to lint the PHP code using **PHP-CS-FIXER** and to run the tests using **PHPUnit**.\n\n### Health-Check Route\n\n**LarAPI** provides a health-check route if you need to check if your API is up.\n\n### Module Management\n\nYou can use the following command to create a new module in your API:\n\n```\nphp artisan make:module test\n```\n\nUsing the `config/modules.php` file you can enable and disable modules of your API.\n\n### Requests\n\n**LarAPI** provides you two generic Request classes that can be useful for requests of datatables. Check out `LarAPI\\Modules\\Common\\Requests\\CommonTableRequest` and `LarAPI\\Modules\\Common\\Requests\\DateRangeRequest`\n\n### Repositories\n\nThe `LarAPI\\Core\\Repositories\\BaseRepository` class offers a lot of generic purposes util functions, so you don't need to waste time creating functions for simple queries:\n\n### Scheduled Commands Manager\n\n**LarAPI** provides you a custom manager for scheduled commands that will help you to prevent overlapping runs and also will make it easier to debug your scheduled commands. Check out the classes: `LarAPI\\Core\\Console\\ApiTaskCommand`, `LarAPI\\Models\\Common\\ApiTask` and `LarAPI\\Repositories\\Common\\ApiTaskRepository`.\n\n### Slack Integration\n\nThe `LarAPI\\Modules\\Common\\Services\\SlackClient` class provides you a simple way to send notifications to **Slack**. To enable this integration you need to provide the `SLACK_NOTIFICATIONS_WEBHOOK` ENV variable.\n\n### Credits\n\n- [Wendell Adriel](https://github.com/WendellAdriel)\n- [All Contributors](../../contributors)\n\nAnd a special thanks to [Caneco](https://twitter.com/caneco) for the logo ✨\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwendelladriel%2Flarapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwendelladriel%2Flarapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwendelladriel%2Flarapi/lists"}