PHPackages                             dealnews/data-mapper-api - 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. dealnews/data-mapper-api

ActiveLibrary[API Development](/categories/api)

dealnews/data-mapper-api
========================

API wrapper around data-mapper library

2.3.2(7mo ago)02432PHPPHP ^8.2CI passing

Since Dec 31Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/dealnews/data-mapper-api)[ Packagist](https://packagist.org/packages/dealnews/data-mapper-api)[ RSS](/packages/dealnews-data-mapper-api/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (6)Versions (7)Used By (2)

Data Mapper API
===============

[](#data-mapper-api)

A simple API that can be installed in other projects that exposes the [Data Mapper library](https://github.com/dealnews/data-mapper) in said project to other services.

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)

Requirements
------------

[](#requirements)

- [Data Mapper](https://github.com/dealnews/data-mapper)
- [DB](https://github.com/dealnews/db)

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

[](#installation)

```
composer require php-libraries/data-mapper-api
```

Usage
-----

[](#usage)

Before using this library, you will need a `\DealNews\DataMapper\Repository` object that maps your data mappers to object names if you have not already created one.

```
$repo = new \DealNews\DataMapper\Repository();
$repo->addMapper("Example", new \DealNews\Example\Mapper());
```

You will also need a router of some sort to route API requests to the appropriate code/action. For most cases, you can use the [PageMill Router](https://github.com/dealnews/pagemill-router). To help with building routes for the PageMill Router, this library comes with some pre-defined routes and a helper method to make sure input data is properly formatted for the API endpoint.

Routing for just one specific endpoint (if you're only interested in using a portion of the provided endpoints/actions from this library):

```
$api = new \DealNews\DataMapperAPI\API();

$routes = [
    $api->getRoute('get_object_route')
];

$router = new \PageMill\Router\Router($routes);

$route = $router->match();

if (!empty($route)) {
    $api->executeAction($route['action'], $route['tokens'], 'https://example.com', $repo);
}
```

Routing for all provided endpoints:

```
$api = new \DealNews\DataMapperAPI\API();

$router = new \PageMill\Router\Router($api->getAllRoutes());

$route = $router->match();

if (!empty($route)) {
    $api->executeAction($route['action'], $route['tokens'], 'https://example.com', $repo);
}
```

By default, all endpoint paths have a prefix of `/api`. However, you can change this by passing a different prefix to either `getRoute()` or `getAllRoutes()` methods. Example:

```
$api = new \DealNews\DataMapperAPI\API();

$router = new \PageMill\Router\Router($api->getAllRoutes('/different-api-path-prefix'));

$route = $router->match();

if (!empty($route)) {
    $api->executeAction($route['action'], $route['tokens'], 'https://example.com', $repo);
}
```

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

[](#contributing)

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting merge requests for this project.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance76

Regular maintenance activity

Popularity11

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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 ~108 days

Total

4

Last Release

224d ago

PHP version history (2 changes)2.2.0PHP ^8.0

2.3.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49531?v=4)[Brian Moon](/maintainers/brianlmoon)[@brianlmoon](https://github.com/brianlmoon)

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

---

Top Contributors

[![brianlmoon](https://avatars.githubusercontent.com/u/49531?v=4)](https://github.com/brianlmoon "brianlmoon (9 commits)")[![jearle-dealnews](https://avatars.githubusercontent.com/u/8784094?v=4)](https://github.com/jearle-dealnews "jearle-dealnews (3 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/dealnews-data-mapper-api/health.svg)

```
[![Health](https://phpackages.com/badges/dealnews-data-mapper-api/health.svg)](https://phpackages.com/packages/dealnews-data-mapper-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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