PHPackages                             rexlabs/smokescreen - 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. rexlabs/smokescreen

ActiveLibrary[API Development](/categories/api)

rexlabs/smokescreen
===================

Smokescreen is a PHP library for transforming and serializing data such as API responses.

2.5.0(1y ago)91.3k2[3 issues](https://github.com/rexlabsio/smokescreen-php/issues)1MITPHPPHP &gt;=7.2 &lt;8.5CI failing

Since Mar 5Pushed 1y ago18 watchersCompare

[ Source](https://github.com/rexlabsio/smokescreen-php)[ Packagist](https://packagist.org/packages/rexlabs/smokescreen)[ RSS](/packages/rexlabs-smokescreen/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (8)Dependencies (2)Versions (16)Used By (1)

Smokescreen
===========

[](#smokescreen)

[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://opensource.org/licenses/MIT)[![Packagist](https://camo.githubusercontent.com/e7898bb73b85c1d08da7e6cabbb848ed4d824f78bddafccee2e5a9502454dde9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7265786c6162732f736d6f6b6573637265656e2e737667)](https://packagist.org/packages/rexlabs/smokescreen)[![Build Status](https://camo.githubusercontent.com/03cfcf6a84b37d0a3fe54f782e00fe9ae4fc712fbdf1d3d5df1aa311210cd3c4/68747470733a2f2f7472617669732d63692e6f72672f7265786c616273696f2f736d6f6b6573637265656e2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rexlabsio/smokescreen-php)[![Code Coverage](https://camo.githubusercontent.com/3a867209cd52d4154f776a2ed92d1bd4aacf9a24ecca70ca75e3fc15c3d13a5e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7265786c616273696f2f736d6f6b6573637265656e2d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/rexlabsio/smokescreen-php/?branch=master)[![StyleCI](https://camo.githubusercontent.com/a743fff940abc6e8234f00604bacb99ab2eeb5d03855c6be479f2611add3b219/68747470733a2f2f7374796c6563692e696f2f7265706f732f3131363234393932382f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/116249928)

Overview
--------

[](#overview)

Smokescreen is a PHP library for transforming data. This is ideal for transforming and serializing API responses but can be applied to many scenarios.

See also [Smokescreen Laravel Library](https://github.com/rexlabsio/smokescreen-laravel-php)

Features
--------

[](#features)

- Simple intuitive interface
- Transform any type of data (arrays, models, etc.)
- Embedding of related resources (aka. includes)
- Declarative includes
- Includes auto-wiring
- Declarative fields (including sparse field sets)
- Eager loading
- Flexible transformation and serialization
- Support for lazy loading
- No other dependencies

Usage
-----

[](#usage)

To use Smokescreen, you define transformer for each resource, and then call either the Smokescreen `item()` or `collection()` method to transform the data.

Full documentation is available from:

Requirements and dependencies
-----------------------------

[](#requirements-and-dependencies)

- PHP &gt;= 7.0

So vanilla.

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

[](#installation)

Install package via composer:

`composer require rexlabs/smokescreen`

Laravel package
---------------

[](#laravel-package)

We provide a Laravel wrapper package which provides some nice conveniences for working within the Laravel framework: `rexlabs/laravel-smokescreen`

See the Github repository for more information:

- [Laravel Smokescreen Package](https://packagist.org/packages/rexlabs/laravel-smokescreen)
- [Laravel Smokescreen Repository](https://github.com/rexlabsio/smokescreen-laravel-php)

Tests
-----

[](#tests)

To run phpunit tests:

```
composer run tests
```

Feel free to add more tests.

FAQ
---

[](#faq)

### Why call it "Smokescreen"

[](#why-call-it-smokescreen)

Great question, thanks for asking. Our team racked our brain for several hours to come up with the perfect name for this package. In the end we went with Smokescreen because there is a transformer named smokescreen and it sounds cool.

### Why wouldn't I just use Fractal

[](#why-wouldnt-i-just-use-fractal)

We took all the good ideas from Fractal, and made it more extensible and safer for children.

Contributing
------------

[](#contributing)

Pull-requests are welcome. Please ensure code is PSR compliant. [Smokescreen on Github](http://github.com/rexlabsio/smokescreen-php)

Who do I talk to?
-----------------

[](#who-do-i-talk-to)

Talk to team #phoenix, or one of these people:

- Jodie Dunlop
- Alex Babkov

About
-----

[](#about)

- Author: [Jodie Dunlop](https://github.com/jodiedunlop)
- License: [MIT](LICENSE)
- Copyright (c) 2018 Rex Software Pty Ltd

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 84.8% 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 ~312 days

Recently: every ~454 days

Total

9

Last Release

491d ago

Major Versions

1.1.0 → 2.0.02018-07-05

PHP version history (3 changes)2.2.0PHP &gt;=7.2 &lt;=8.3

2.3.0PHP &gt;=7.2 &lt;8.4

2.5.0PHP &gt;=7.2 &lt;8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/18f5613c1ca6527bdee951ce1ff9dd4a626700ca01a0b787397ad9128a9dfaae?d=identicon)[rexlabsio](/maintainers/rexlabsio)

---

Top Contributors

[![jodiedunlop](https://avatars.githubusercontent.com/u/4055554?v=4)](https://github.com/jodiedunlop "jodiedunlop (89 commits)")[![ababkov](https://avatars.githubusercontent.com/u/478307?v=4)](https://github.com/ababkov "ababkov (10 commits)")[![colemanator](https://avatars.githubusercontent.com/u/9283606?v=4)](https://github.com/colemanator "colemanator (2 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")[![CameronDarragh](https://avatars.githubusercontent.com/u/8373482?v=4)](https://github.com/CameronDarragh "CameronDarragh (1 commits)")[![cpave3](https://avatars.githubusercontent.com/u/14006965?v=4)](https://github.com/cpave3 "cpave3 (1 commits)")

---

Tags

apifractalhypermediajsonjson-apiphpphp-libraryserializersmokescreentransformtransformationsjsonapiserializertransformfractalhypermediawebservicessmokescreen

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rexlabs-smokescreen/health.svg)

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

###  Alternatives

[spatie/laravel-fractal

An easy to use Fractal integration for Laravel applications

1.9k15.1M99](/packages/spatie-laravel-fractal)[spatie/fractalistic

A developer friendly wrapper around Fractal

38715.3M8](/packages/spatie-fractalistic)[ellipsesynergie/api-response

Simple package to handle response properly in your API

3751.4M20](/packages/ellipsesynergie-api-response)[nilportugues/laravel5-json-api

Laravel 5 JSON API Transformer Package

31232.4k1](/packages/nilportugues-laravel5-json-api)[nilportugues/jsonapi-bundle

Symfony 2 &amp; 3 JSON API Transformer Package

11446.0k](/packages/nilportugues-jsonapi-bundle)[nilportugues/json-api

Serializer transformers outputting valid API responses in JSON, JSON API and HAL+JSON API formats.

70106.2k3](/packages/nilportugues-json-api)

PHPackages © 2026

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