PHPackages                             zpetr/apigility-htmlnegotiation - 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. zpetr/apigility-htmlnegotiation

ActiveLibrary[API Development](/categories/api)

zpetr/apigility-htmlnegotiation
===============================

Apigility HtmlNegotiation module

1.0.0(7y ago)05162BSDPHPPHP &gt;=5.3.23

Since Feb 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/zpetr/apigility-htmlnegotiation)[ Packagist](https://packagist.org/packages/zpetr/apigility-htmlnegotiation)[ Docs](https://github.com/zpetr/apigility-htmlnegotiation)[ RSS](/packages/zpetr-apigility-htmlnegotiation/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

apigility-htmlnegotiation
=========================

[](#apigility-htmlnegotiation)

HtmlNegotiation module for Apigility.

Response type is based on *Accept* header :

- request that specifies **text/html** (or **text/\*+html**) get the content in HTML
- **application/hal+json** (or **application/\*+json**) request get the content in HalJson as usual.

### Installation

[](#installation)

Install composer in your project

```
curl -s http://getcomposer.org/installer | php

```

Define dependencies in your composer.json file

```
{
    "require": {
        "zpetr/apigility-htmlnegotiation" : "1.*"
    }
}
```

Finally install dependencies

```
php composer.phar install

```

or update it

```
php composer.phar update

```

### Usage

[](#usage)

- Add *zPetr\\HtmlNegotiation* to config/modules.config.php:

```
	return array(
    	'modules' => array(
        	...,
            'zPetr\\HtmlNegotiation',
            ....
		)
	)
```

- Go to admin, select your API and change *Content Negotiation Selector* to **HTML-HalJson**
- Add **text/html** to *Accept whitelist* and *Content-Type whitelist*. Add other headers if needed.
- Save configuration

### Templates

[](#templates)

#### Layout

[](#layout)

If you want to personalize custom layout template:

1. Copy default *zpetr/apigility-htmlnegotiation/view/layout.phtml* template to the view folder of your module (why not to Application module)
2. Add this to module config:

```
	...
	'view_manager' => array(
		'template_map' => array(
			'zpetr/htmlnegotiation/layout'	=> __DIR__ . '/../view/layout.phtml',
		),
		'template_path_stack' => array(
			__DIR__ . '/../view',
		),
	),
```

#### API response templates

[](#api-response-templates)

To customize any API template:

1. Create *view* folder in your API directory. For example, if you have API named Foo with REST service named Bar, create:```
    module/Foo/src/Foo/V1/Rest/Bar/view/
    ```
2. Create *get.phtml* for Entity template and *get\_list.phtml* for Collection template. You can use default ones from *zpetr/apigility-htmlnegotiation/view/zf/rest/* folder.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% 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

Unknown

Total

1

Last Release

2689d ago

### Community

Maintainers

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

---

Top Contributors

[![zpetr](https://avatars.githubusercontent.com/u/2429147?v=4)](https://github.com/zpetr "zpetr (13 commits)")[![Eliot-az](https://avatars.githubusercontent.com/u/107464519?v=4)](https://github.com/Eliot-az "Eliot-az (1 commits)")[![pgl-az](https://avatars.githubusercontent.com/u/71706060?v=4)](https://github.com/pgl-az "pgl-az (1 commits)")

---

Tags

apihtmlnegotiationmodulezf2apigility

### Embed Badge

![Health badge](/badges/zpetr-apigility-htmlnegotiation/health.svg)

```
[![Health](https://phpackages.com/badges/zpetr-apigility-htmlnegotiation/health.svg)](https://phpackages.com/packages/zpetr-apigility-htmlnegotiation)
```

###  Alternatives

[pdfcrowd/pdfcrowd

A client library for the Pdfcrowd API. It lets you convert between HTML, PDF and various image formats

621.2M1](/packages/pdfcrowd-pdfcrowd)[evandotpro/edp-github

Github API integration module for Zend Framework 2

242.2k](/packages/evandotpro-edp-github)

PHPackages © 2026

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