aedart / athenaeum-http-api
Json based API utilities
Installs: 1 157
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/aedart/athenaeum-http-api
Requires
- php: ^8.3
 - aedart/athenaeum-contracts: ^9.15
 - aedart/athenaeum-etags: ^9.15
 - aedart/athenaeum-support: ^9.15
 - aedart/athenaeum-validation: ^9.15
 - illuminate/http: ^v12.35.1
 - shrikeh/teapot: ^3.0.0
 
Suggests
- laravel/framework: Required if you want to make use of API Request abstractions
 
- dev-main
 - 9.15.0
 - 9.14.0
 - 9.13.0
 - 9.12.0
 - 9.11.0
 - 9.10.0
 - 9.9.0
 - 9.8.0
 - 9.7.0
 - 9.6.0
 - 9.5.0
 - 9.4.0
 - 9.3.0
 - 9.2.0
 - 9.1.0
 - 9.0.0
 - 8.22.0
 - 8.21.0
 - 8.20.0
 - 8.19.0
 - 8.18.0
 - 8.17.0
 - 8.16.0
 - 8.15.0
 - 8.14.0
 - 8.13.0
 - 8.12.0
 - 8.11.0
 - 8.10.0
 - 8.9.0
 - 8.8.0
 - 8.7.0
 - 8.6.0
 - 8.5.0
 - 8.4.0
 - 8.3.0
 - 8.2.0
 - 8.1.0
 - 8.0.0
 - 7.33.0
 - 7.32.0
 - 7.31.0
 - 7.30.1
 - 7.30.0
 - 7.29.0
 - 7.28.0
 - 7.27.0
 - 7.26.0
 - 7.25.0
 - 7.24.0
 - 7.23.0
 - 7.22.1
 - 7.22.0
 - 7.21.0
 - 7.20.0
 - 7.19.0
 - 7.18.1
 - 7.18.0
 - 7.17.0
 - 7.16.0
 - 7.15.0
 - 7.14.0
 - 7.13.0
 - 7.12.0
 - 7.11.3
 - 7.11.2
 - 7.11.1
 - 7.11.0
 - 7.10.1
 - 7.10.0
 - 7.9.1
 - 7.9.0
 - 7.8.0
 - 7.7.2
 - 7.7.1
 - 7.7.0
 - 7.6.0
 - 7.5.0
 - 7.4.0
 - 7.3.0
 - 7.2.0
 - 7.1.0
 - 7.0.1
 - 7.0.0
 - 7.0.0-alpha.1
 - 6.8.1
 - 6.8.0
 - 6.7.0
 - 6.6.0
 - 6.5.2
 - 6.5.1
 - 6.5.0
 
This package is auto-updated.
Last update: 2025-10-24 07:03:19 UTC
README
Opinionated utilities to help shape and format your API, using Laravel's API Resources.
Example
The following example shows an "API Resource", for an Eloquent User model.
use Aedart\Http\Api\Resources\ApiResource; use Illuminate\Http\Request; class UserResource extends ApiResource { public function formatPayload(Request $request): array { return $this->withTimestamps([ 'id' => $this->getResourceKey(), 'name' => $this->name, 'roles' => $this->belongsToManyReference('roles') ->withLabel('name') ->withSelfLink() ->withResourceType(); ]); } public function type(): string { return 'user'; } }
When a response is returned for a single user, the following JSON will be output:
{
    "data": {
        "id": 34,
        "name": "Retta Altenwerth Jr.",
        "created_at": "2022-10-21T14:51:43+00:00",
        "updated_at": "2022-10-21T14:51:43+00:00",
        "roles": [
            {
                "id": 23,
                "name": "Machine Operator",
                "type": "role",
                "self": "http://localhost/roles/23"
            },
            {
                "id": 56,
                "name": "File Clerk",
                "type": "role",
                "self": "http://localhost/roles/56"
            }
        ]
    },
    "meta": {
        "type": "user",
        "self": "http://localhost/users/34"
    }
}
Documentation
Please read the official documentation for additional information.
Repository
The mono repository is located at github.com/aedart/athenaeum
Versioning
This package follows Semantic Versioning 2.0.0
License
BSD-3-Clause, Read the LICENSE file included in this package