PHPackages                             kduma/content-negotiable-responses - 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. [API Development](/categories/api)
4. /
5. kduma/content-negotiable-responses

ActiveLibrary[API Development](/categories/api)

kduma/content-negotiable-responses
==================================

Laravel helpers for creating content-type negotiable responses

v2.0.0(1mo ago)134MITPHPPHP ^8.3

Since May 21Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/kduma-OSS/LV-content-negotiable-responses)[ Packagist](https://packagist.org/packages/kduma/content-negotiable-responses)[ RSS](/packages/kduma-content-negotiable-responses/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (10)Versions (5)Used By (0)

Content Negotiable Responses for Laravel
========================================

[](#content-negotiable-responses-for-laravel)

[![Latest Stable Version](https://camo.githubusercontent.com/703df05d406b8f9b8b8a7f84a66b52c6e93facb3544d587e3fc3778d10f5e472/68747470733a2f2f706f7365722e707567782e6f72672f6b64756d612f636f6e74656e742d6e65676f746961626c652d726573706f6e7365732f762f737461626c652e737667)](https://packagist.org/packages/kduma/content-negotiable-responses)[![Total Downloads](https://camo.githubusercontent.com/f278e1952a795838737ab0dee54b89d06fbf84c19dc4867b7b46b21916b0efcb/68747470733a2f2f706f7365722e707567782e6f72672f6b64756d612f636f6e74656e742d6e65676f746961626c652d726573706f6e7365732f646f776e6c6f6164732e737667)](https://packagist.org/packages/kduma/content-negotiable-responses)[![License](https://camo.githubusercontent.com/1456354356fae138e61c025fe82b115c1d47c27eb6372288de604ce20982497b/68747470733a2f2f706f7365722e707567782e6f72672f6b64756d612f636f6e74656e742d6e65676f746961626c652d726573706f6e7365732f6c6963656e73652e737667)](https://packagist.org/packages/kduma/content-negotiable-responses)

Laravel helpers for creating HTTP responses that automatically negotiate content type based on the client's `Accept` header (JSON, XML, YAML, MsgPack, HTML).

Full documentation: [opensource.duma.sh/libraries/php/laravel-content-negotiable-responses](https://opensource.duma.sh/libraries/php/laravel-content-negotiable-responses)

Requirements
------------

[](#requirements)

- PHP `^8.3`
- Laravel `^12.0 || ^13.0`

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

[](#installation)

```
composer require kduma/content-negotiable-responses
```

Usage
-----

[](#usage)

```
// Returns JSON, XML, YAML or MsgPack depending on the Accept header
Route::get('/api/data', function () {
    return new \KDuma\ContentNegotiableResponses\ArrayResponse([
        'success' => true,
        'timestamp' => time(),
    ]);
});

// Returns HTML in browsers, JSON/XML/YAML in API clients
Route::get('/', function () {
    return new \KDuma\ContentNegotiableResponses\BasicViewResponse('welcome', [
        'user' => auth()->user(),
    ]);
});
```

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance93

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity77

Established project with proven stability

 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 ~1257 days

Total

3

Last Release

35d ago

Major Versions

0.1 → 1.02022-10-20

1.0 → v2.0.02026-04-08

PHP version history (2 changes)1.0PHP ^8.1

v2.0.0PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![kduma](https://avatars.githubusercontent.com/u/1062582?v=4)](https://github.com/kduma "kduma (9 commits)")

---

Tags

laravelphp

### Embed Badge

![Health badge](/badges/kduma-content-negotiable-responses/health.svg)

```
[![Health](https://phpackages.com/badges/kduma-content-negotiable-responses/health.svg)](https://phpackages.com/packages/kduma-content-negotiable-responses)
```

###  Alternatives

[spatie/laravel-query-builder

Easily build Eloquent queries from API requests

4.4k26.9M220](/packages/spatie-laravel-query-builder)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)

PHPackages © 2026

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