PHPackages                             soflomo/common - 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. soflomo/common

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

soflomo/common
==============

Utility module with Soflomo common classes

v0.8.0(11y ago)26461[2 issues](https://github.com/Soflomo/Common/issues)1BSD-3-ClausePHPPHP &gt;=5.3.3.

Since Mar 14Pushed 11y ago4 watchersCompare

[ Source](https://github.com/Soflomo/Common)[ Packagist](https://packagist.org/packages/soflomo/common)[ Docs](https://github.com/Soflomo/Common)[ RSS](/packages/soflomo-common/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (12)Used By (1)

Soflomo\\Common
===============

[](#soflomocommon)

`Soflomo\Common` is a small utility module with a few helper classes. Its purpose is to provide some plugin/helper classes to provide functionalities common for many different projects.

At this moment, it provides the following classes:

- Accept controller plugin, to check specific content types in the request
- Attachment controller plugin, to send a file as attachment in the response
- Version view helper, to load the version of the application from git as a cache buster in public assets

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

[](#installation)

`Soflomo\Common` is available through composer. Add "soflomo/common" to your composer.json list. During development of `Soflomo\Common`, you can specify the latest available version:

```
"soflomo/common": "dev-master"

```

Enable the module in your `config/application.config.php` file. Add an entry `Soflomo\Common` to the list of enabled modules.

Usage
-----

[](#usage)

Example of usage is listed below for every single helper class.

### Accept controller plugin

[](#accept-controller-plugin)

Say you perform a delete request to the uri `/books/123`. An AJAX request might expect a 200 OK with a body message, while for a normal request you want to redirect to `/books` again.

```
// Remove the book with id 123

if ($this->accept('application/json')) {
    return new JsonModel(array(
        'status' => 'success',
        'book'   => array(
            'id' => 123
        )
    ));
}

return $this->redirect()->toRoute('books');

```

### Attachment controller plugin

[](#attachment-controller-plugin)

You have created a pdf file and you want to let the user download that file.

```
return $this->attachment()
            ->fromFile('data/invoice/123.pdf', 'Invoice 123.pdf', 'application/pdf');

```

Available methods are `fromFile($path, $name=null, $type=null, $disposition=null)` and `fromBlob($blob, $name, $type=null, $disposition=null)`. A `fromStream()` method is not implemented yet, but is planned in a future version.

### Version view helper

[](#version-view-helper)

For all styles, images and javascript files, a new deployed version might be changed but is available under the same URI. You want to force a reload as a cache busting mechanism, but you do not want to update the version manually each time.

This view helper loads a version description from git with `git describe --always`. For a tag it will return the tag (e.g. `v.1.0.4`). If no tag is checked out (for example, on your staging environment) it loads a mixed version (e.g. `v1.0.4-14-g2414721` or when nothing has been tagged `g2414721`). The version can be appended as query string: `css/style.css?v1.0.4`:

```

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

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

Recently: every ~138 days

Total

10

Last Release

4213d ago

### Community

Maintainers

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

---

Top Contributors

[![vdtol](https://avatars.githubusercontent.com/u/5173692?v=4)](https://github.com/vdtol "vdtol (1 commits)")

---

Tags

zf2

### Embed Badge

![Health badge](/badges/soflomo-common/health.svg)

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

###  Alternatives

[slm/google-analytics

Google Analytics tracking integration for Zend Framework 2

4180.3k](/packages/slm-google-analytics)[heartsentwined/zf2-cron

ZF2 cron module

596.8k](/packages/heartsentwined-zf2-cron)

PHPackages © 2026

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