PHPackages                             codivores/laravel-modular-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. codivores/laravel-modular-api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

codivores/laravel-modular-api
=============================

A Laravel package for creating JSON:API-compliant REST APIs, with support for versioning and multiple sub-APIs, organized into standalone, modular services.

v0.1.1(1y ago)052proprietaryPHPPHP ^8.2

Since Aug 20Pushed 1mo agoCompare

[ Source](https://github.com/Codivores/Laravel-Modular-API)[ Packagist](https://packagist.org/packages/codivores/laravel-modular-api)[ Docs](https://github.com/codivores/laravel-modular-api)[ RSS](/packages/codivores-laravel-modular-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Laravel Modular API
===================

[](#laravel-modular-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1c1728fa0dc66df8f3b166066d233d867c859b623be251d59f01d42df39a2265/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6469766f7265732f6c61726176656c2d6d6f64756c61722d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codivores/laravel-modular-api)[![Total Downloads](https://camo.githubusercontent.com/7a1c51f71ba45928d9bdfc405ea3ce5e568344bfd3532bd2847d7edae29b20bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6469766f7265732f6c61726176656c2d6d6f64756c61722d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codivores/laravel-modular-api)

Simplify the creation of Laravel REST APIs that adhere to the [JSON:API](https://jsonapi.org) specification. The package organizes the code into standalone services, promoting a modular, maintainable, and easily testable architecture.

### Key Features:

[](#key-features)

- **JSON:API Compliance:** Generate API responses that fully comply with the JSON:API specification, ensuring data consistency and interoperability (based on [timacdonald/json-api](https://github.com/timacdonald/json-api) package)
- **Autonomous Services:** Structure your business logic into independent services, facilitating code reuse and clear separation of concerns.
- **API Versioning:** Easily version your API to manage changes and ensure backward compatibility.
- **Sub-APIs:** Create multiple sub-APIs (e.g., `public`, `protected`, `private`, ...) to handle different access levels and use cases.
- **Localization:** Serve multi-language content by processing a request header that automatically sets the locale for the entire request.

### Version support

[](#version-support)

- **PHP:** `8.2`, `8.3`
- **Laravel:** `11.0`

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require codivores/laravel-modular-api
```

If you want to use Hashids (short unique string identifiers from numbers) for your resources, you can install the required package via composer:

```
composer require hashids/hashids
```

If you want to customize the configuration, you can publish the config file:

```
php artisan vendor:publish --tag="modular-api-config"
```

This is the contents of the published config file:

```
return [

    /*
    |--------------------------------------------------------------------------
    | API configuration
    |--------------------------------------------------------------------------
    */

    'api' => [

        'routing' => [
            'url' => env('MODULAR_API_ROUTING_URL', env('APP_URL', 'http://localhost')),
            'url_prefix' => env('MODULAR_API_ROUTING_URL_PREFIX', '/'),
            'route_prefix' => env('MODULAR_API_ROUTING_ROUTE_PREFIX', 'api'),
            'enable_version_prefix' => env('MODULAR_API_ROUTING_ENABLE_VERSION_PREFIX', true),
            'enable_type_prefix' => env('MODULAR_API_ROUTING_ENABLE_TYPE_PREFIX', true),
        ],

        'resource' => [
            'custom_type_resolver' => env('MODULAR_API_RESOURCE_CUSTOM_TYPE_RESOLVER', false),
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Web configuration
    |--------------------------------------------------------------------------
    */

    'web' => [

        'routing' => [
            'url' => env('MODULAR_API_WEB_ROUTING_URL', env('APP_URL', 'http://localhost')),
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Modular code configuration
    |--------------------------------------------------------------------------
    */

    'services' => [

        'root_path' => env('MODULAR_API_SERVICES_ROOT_PATH', 'Services'),

    ],

    /*
    |--------------------------------------------------------------------------
    | Features configuration
    |--------------------------------------------------------------------------
    */

    'features' => [

        'rate_limiting' => [
            'enabled' => env('MODULAR_API_FEATURE_RATE_LIMITING_ENABLED', false),
            'attempts' => env('MODULAR_API_FEATURE_RATE_LIMITING_ATTEMPTS_PER_MIN', 30),
            'expires' => env('MODULAR_API_FEATURE_RATE_LIMITING_EXPIRES_IN_MIN', 1),
        ],

        'localization' => [
            'enabled' => env('MODULAR_API_FEATURE_LOCALIZATION_ENABLED', false),
            'request_header' => env('MODULAR_API_FEATURE_LOCALIZATION_REQUEST_HEADER', 'Accept-Language'),
            'locales' => env('MODULAR_API_FEATURE_LOCALIZATION_LOCALES', env('APP_LOCALE', 'en')),
        ],

        'hash_ids' => [
            'enabled' => env('MODULAR_API_FEATURE_HASH_IDS_ENABLED', false),
            'salt' => env('MODULAR_API_FEATURE_HASH_IDS_KEY', env('APP_KEY')),
            'length' => env('MODULAR_API_FEATURE_HASH_IDS_LENGTH', 20),
            'alphabet' => env('MODULAR_API_FEATURE_HASH_IDS_ALPHABET',
                'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'),
        ],

    ],

];
```

Getting started
---------------

[](#getting-started)

Services directory structure:

```
App/
    Services/
        DomainA/
            Service1/
                Config/
                Data/
                    Migrations/
                Http/
                    Controllers/
                    Endpoints/
                    Requests/
                    WebEndpoints/
                Mails/
                    Templates/
                Models/
                Resources/
                Providers/
                    MainServiceProvider.php
                Views/
            Service2/
                ...
        DomainB/
            Service1/
                ...
            Service2/
                ...
```

License
-------

[](#license)

The DBAD License (DBAD). Please see [License File](LICENSE.md) for more information.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance65

Regular maintenance activity

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Total

2

Last Release

619d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d3ca30a01c7e7f8d91f7a9dae3c87acf2511861648d9d92c78fb70dbbac53854?d=identicon)[Codivores](/maintainers/Codivores)

---

Top Contributors

[![agnonym](https://avatars.githubusercontent.com/u/36710878?v=4)](https://github.com/agnonym "agnonym (76 commits)")

---

Tags

jsonapilaravelrestJSON-APIlaravel-modular-api

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/codivores-laravel-modular-api/health.svg)

```
[![Health](https://phpackages.com/badges/codivores-laravel-modular-api/health.svg)](https://phpackages.com/packages/codivores-laravel-modular-api)
```

###  Alternatives

[givebutter/laravel-keyable

Add API keys to your Laravel models

187144.5k2](/packages/givebutter-laravel-keyable)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[guanguans/laravel-api-response

Normalize and standardize Laravel API response data structure. - 规范化和标准化 Laravel API 响应数据结构。

485.6k](/packages/guanguans-laravel-api-response)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
