PHPackages                             beck24/elgg\_scalarmd - 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. beck24/elgg\_scalarmd

ActiveElgg-plugin[Utility &amp; Helpers](/categories/utility)

beck24/elgg\_scalarmd
=====================

Provide a global function for ensuring metadata output is a string, and potentially fixing it if not

1.0.1(9y ago)1281GPL-2.0JavaScriptPHP &gt;=5.5

Since Feb 16Pushed 9y ago1 watchersCompare

[ Source](https://github.com/beck24/elgg_scalarmd)[ Packagist](https://packagist.org/packages/beck24/elgg_scalarmd)[ Docs](http://arckinteractive.com)[ RSS](/packages/beck24-elgg-scalarmd/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

elgg\_scalarmd
==============

[](#elgg_scalarmd)

Provide a global function for ensuring metadata output is a string, and potentially fixing it if not.

This is useful for situations where you are expecting a string, and only a string, and an accidental array return would break things. An example might be a webservices response that requires a string.

This is a workaround for [Elgg/Elgg#4268](https://github.com/Elgg/Elgg/issues/4268) where frequently updated metadata can accidentally duplicate into an array. This function ensures a scalar return for the metadata value and will reset the entity metadata to a scalar value by default.

Caveats
=======

[](#caveats)

This works for metadata that does not depend on access or ownership, as a simple key/value pair (eg. most metadata usage) If the metadata *does* depend on access or ownership do not use this function on it or you will surely lose data.

Usage
=====

[](#usage)

Scenario:

```
$entity->country = [
    'canada',
    'canada
];

```

$entity-&gt;country is now:

```
Array
(
    [0] => canada
    [1] => canada
)

```

Without fixing: \\Beck24\\scalarmd($entity, 'country', false)

```
canada

```

$entity-&gt;country is still:

```
Array
(
    [0] => canada
    [1] => canada
)

```

Now with fixing: \\Beck24\\scalarmd($entity, 'country')

```
canada

```

$entity-&gt;country is now:

```
canada

```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3417d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/738363?v=4)[Matt Beckett](/maintainers/beck24)[@beck24](https://github.com/beck24)

---

Top Contributors

[![beck24](https://avatars.githubusercontent.com/u/738363?v=4)](https://github.com/beck24 "beck24 (7 commits)")

---

Tags

pluginutilityelggworkaroundbugfix

### Embed Badge

![Health badge](/badges/beck24-elgg-scalarmd/health.svg)

```
[![Health](https://phpackages.com/badges/beck24-elgg-scalarmd/health.svg)](https://phpackages.com/packages/beck24-elgg-scalarmd)
```

###  Alternatives

[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.3k10](/packages/helsingborg-stad-municipio)

PHPackages © 2026

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