PHPackages                             kevbradwick/drift - 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. kevbradwick/drift

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

kevbradwick/drift
=================

A lightweight PHP library for mapping data to PHP classes

1.2.0(9y ago)122MITPHPPHP &gt;=5.6

Since Feb 20Pushed 9y agoCompare

[ Source](https://github.com/kevbradwick/drift)[ Packagist](https://packagist.org/packages/kevbradwick/drift)[ Docs](https://github.com/kevbradwick/drift)[ RSS](/packages/kevbradwick-drift/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Drift
=====

[](#drift)

[![Build Status](https://camo.githubusercontent.com/78b8c228dcce31157973eb6a661c30e8514ad2bb6b56cd863279793d30e2e5f5/68747470733a2f2f7472617669732d63692e6f72672f6b6576627261647769636b2f64726966742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kevbradwick/drift)

---

Drift is a PHP library for mapping arbitrary data to PHP classes.

### Installation

[](#installation)

Drift is available on [Packagist](https://packagist.org/packages/kevbradwick/drift), so you can use composer;

```
composer require kevbradwick/drift

```

### Usage

[](#usage)

Say you have a class with private member variables like this;

```
namespace Application;

class Actor
{
    /**
     * @Drift\String()
     */
    private $name;

    /**
     * @Drift\Int()
     */
    private $age;

    /**
     * @Drift\Date(field="date_of_birth")
     */
    private $dateOfBirth;
}
```

And you have some data, possibly consumed from an API, that looks like this;

```
$data = [
    'name' => 'Arnold Schwarzenegger',
    'age' => 68,
    'date_of_birth' => 'July 30, 1947'
]
```

You can then use `Drift\Mapper` to create a new instance of the class, initialised with the data.

```
use Drift\Mapper;
use Drift\Reader\AnnotationReader;
use Application\Actor;

$mapper = new Mapper(new AnnotationReader());
$mapper->setData($data);

$actor = $mapper->instantiate(Actor::class);
```

In addition to annotations, you can specify mapping using Yaml or plain old php.

Full documentation can be found on the [Wiki](https://github.com/kevbradwick/drift/wiki).

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

4

Last Release

3522d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/491739?v=4)[Kevin Bradwick](/maintainers/kevbradwick)[@kevbradwick](https://github.com/kevbradwick)

---

Top Contributors

[![kevbradwick](https://avatars.githubusercontent.com/u/491739?v=4)](https://github.com/kevbradwick "kevbradwick (46 commits)")

---

Tags

datamapperdata mapper

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/kevbradwick-drift/health.svg)

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

###  Alternatives

[fakerphp/faker

Faker is a PHP library that generates fake data for you.

4.0k379.0M4.3k](/packages/fakerphp-faker)[dflydev/dot-access-data

Given a deep data structure, access data by dot notation.

722381.6M104](/packages/dflydev-dot-access-data)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k11.7M153](/packages/cuyz-valinor)[mbezhanov/faker-provider-collection

A collection of custom providers for the Faker library

2139.1M25](/packages/mbezhanov-faker-provider-collection)[php-units-of-measure/php-units-of-measure

A PHP library for converting between standard units of measure.

3133.7M31](/packages/php-units-of-measure-php-units-of-measure)[eventsauce/object-hydrator

Converts structured data into strict objects.

3312.4M23](/packages/eventsauce-object-hydrator)

PHPackages © 2026

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