PHPackages                             monkeyphp/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. monkeyphp/hal

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

monkeyphp/hal
=============

Hal library

07PHP

Since Mar 23Pushed 12y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Hal
===

[](#hal)

A very simple Hal library for creating objects that can be turned into HAL compatible payloads.

Links
-----

[](#links)

-
- [https://api-sandbox.foxycart.com/hal-browser/hal\_browser.html#https://api-sandbox.foxycart.com/stores/8/transactions?zoom=items,payments](https://api-sandbox.foxycart.com/hal-browser/hal_browser.html#https://api-sandbox.foxycart.com/stores/8/transactions?zoom=items,payments)
- [http://stateless.co/hal\_specification.html](http://stateless.co/hal_specification.html)
-
-

Use
---

[](#use)

Create the top level resource of your response. All resources require an instance as Hal\\Link as a constructor parameter and the type of the resource.

```
$resource = new Resource(new Link('self', 'http://example.com/api/book/1'), 'book');

```

Now that we have our resource, we can add additional HAL attributes such as a `_link`

```
$resource->addLink(new Link('publisher', 'http://example.com/api/publisher/56'));

```

Or an `_embedded` resource

```
$resource->addEmbedded(new Resource(
    new Link('self', 'http://exmaple.com/api/author/99'),
    'author',
    null,
    null,
    array(
        'name' => 'George Orwell',
        'born' => '25 June 1903',
        'died' => '21 January 1950'
    )
), 'author');

```

And add some `attributes` to the resource

```
$resource->addAttributes(array(
    'title' => 'Animal Farm',
    'pages' => 112,
    'language' => 'English',
    'country' => 'United Kingdom'
));

```

Once you have created your Resource, you can output an array representation

```
$array = $resource->toArray();

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![monkeyphp](https://avatars.githubusercontent.com/u/1448153?v=4)](https://github.com/monkeyphp "monkeyphp (16 commits)")

### Embed Badge

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

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

###  Alternatives

[ivaynberg/select2

Select2 is a jQuery based replacement for select boxes.

26.0k441.0k5](/packages/ivaynberg-select2)[wyndow/fuzzywuzzy

Fuzzy string matching based on FuzzyWuzzy from Seatgeek

742.0M6](/packages/wyndow-fuzzywuzzy)[charlieuki/receiptprinter

:description

15140.3k](/packages/charlieuki-receiptprinter)[bonecms/laravel-captcha

Captcha integration for Laravel

76138.4k](/packages/bonecms-laravel-captcha)[zaloplatform/zalo-php-sdk

sdk for zalo developers

69119.0k1](/packages/zaloplatform-zalo-php-sdk)[hermawan/codeigniter4-datatables

Serverside Datatables library for CodeIgniter4

10943.0k3](/packages/hermawan-codeigniter4-datatables)

PHPackages © 2026

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