PHPackages                             mhndev/hal - 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. mhndev/hal

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

mhndev/hal
==========

0.6.0(8y ago)112MITPHPPHP &gt;=7.1

Since Nov 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mhndev/hal)[ Packagist](https://packagist.org/packages/mhndev/hal)[ RSS](/packages/mhndev-hal/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (10)Used By (0)

[![Build Status](https://camo.githubusercontent.com/faa22ccc6e10b0f1393635eccdb073335f04801db0ac952263080d630d0e2aae/68747470733a2f2f7472617669732d63692e6f72672f6d686e6465762f68616c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mhndev/hal)[![Latest Stable Version](https://camo.githubusercontent.com/553a0decdaa6c9e942c10660d5504812b7dcd17d73db2eadf6686b4c1aae8de5/68747470733a2f2f706f7365722e707567782e6f72672f6d686e6465762f68616c2f762f737461626c65)](https://packagist.org/packages/mhndev/hal)[![Total Downloads](https://camo.githubusercontent.com/fd2dd2bc3cc1139bf79b1afcbc99fcb0b7be9a783b95109c6501df78fbbd0afd/68747470733a2f2f706f7365722e707567782e6f72672f6d686e6465762f68616c2f646f776e6c6f616473)](https://packagist.org/packages/mhndev/hal)[![Latest Unstable Version](https://camo.githubusercontent.com/b7e231c56528c6a18ac8193b3dcc37975cc1b13eca801f6f8477992e28ba1de6/68747470733a2f2f706f7365722e707567782e6f72672f6d686e6465762f68616c2f762f756e737461626c65)](https://packagist.org/packages/mhndev/hal)[![License](https://camo.githubusercontent.com/785f4a45af894a6d1087d2315333f411b8884a6c81b5d7ad543a06e6c08b8d18/68747470733a2f2f706f7365722e707567782e6f72672f6d686e6465762f68616c2f6c6963656e7365)](https://packagist.org/packages/mhndev/hal)[![composer.lock](https://camo.githubusercontent.com/84d64ee40d7737bddc15a64ad2dbc4b1e89e39affdba48acdabd77d5efb608f6/68747470733a2f2f706f7365722e707567782e6f72672f6d686e6465762f68616c2f636f6d706f7365726c6f636b)](https://packagist.org/packages/mhndev/hal)

### Php Hal Object

[](#php-hal-object)

generating php hal object from array data

this package currently just supports json and not xml

#### Sample usage:

[](#sample-usage)

```
$post = [
    'title' => 'sample post title',
    'text' => 'post body goes here ...',
];

$user = [
    'username' => 'mhndev',
    'mobile' => '09124917706',
    'email' => 'majid8911303@gmail.com'
];

$comments = [
    [
        'text' => 'Hi',
        'uid'  => 12
    ],
    [
        'text' => 'OK',
        'uid'  => 14
    ],
    [
        'text' => 'NOK',
        'uid'  => 10
    ]
];

$tags = [
    'tag1', 'tag2', 'tag3'
];

$profile = [
    'avatar' => 'http://google.com/inja.jpeg',
    'name' => 'majid',
    'username' => 'mhndev',
    'bio' => 'user biography goes here ...'
];

$self_link = new \mhndev\hal\Link('self', 'http://google.com');
$next_link = new \mhndev\hal\Link('next', 'http://google.com');

$postResource = new \mhndev\hal\Resource($post);

$profileResource = new \mhndev\hal\Resource($profile);
$profileResource->addLink($self_link);

$userResource = new \mhndev\hal\Resource($user);

$userResource->addEmbeddedResource($profileResource, 'profile');

$tagsResource = new \mhndev\hal\Resource($tags);

$request = \Slim\Http\Request::createFromGlobals([]);

$commentsResource = new \mhndev\hal\Paginated($comments, 5 , 10, $request);

$postResource->addEmbeddedResource($userResource, 'user');
$postResource->addEmbeddedResource($tagsResource, 'tags');
$postResource->addEmbeddedResource($commentsResource, 'comments');

$postResource->addLink($next_link);
$postResource->addLink($self_link);

header('Content-Type: application/json');

$presenter = new \mhndev\hal\Presenter($postResource);

var_dump((new \mhndev\hal\Presenter($postResource))->asArray());die();

echo $presenter->asJson();
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Total

9

Last Release

3098d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c3e5d182214e2e6b989a2230bcae80b2107b088da1c6dbea6f6f8d28702e272?d=identicon)[majidphpdeveloper](/maintainers/majidphpdeveloper)

---

Top Contributors

[![mhndev](https://avatars.githubusercontent.com/u/5164182?v=4)](https://github.com/mhndev "mhndev (12 commits)")

---

Tags

halhttpphphal objecthal http response

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mhndev-hal/health.svg)

```
[![Health](https://phpackages.com/badges/mhndev-hal/health.svg)](https://phpackages.com/packages/mhndev-hal)
```

###  Alternatives

[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

538204.9M23](/packages/league-uri-interfaces)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[http-interop/response-sender

A function to convert PSR-7 Response to HTTP output

46711.5k40](/packages/http-interop-response-sender)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)

PHPackages © 2026

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