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(5mo ago)01582PHPPHP ^8.2CI passing

Since Dec 31Pushed 5mo 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 1mo ago

READMEChangelog (4)Dependencies (6)Versions (6)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

40

—

FairBetter than 88% of packages

Maintenance70

Regular maintenance activity

Popularity14

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity54

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

Total

4

Last Release

168d 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)")

###  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

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

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