PHPackages                             reservat/customer - 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. reservat/customer

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

reservat/customer
=================

Customer component for Reservat

08[1 PRs](https://github.com/reservat/customer/pulls)PHP

Since Apr 6Pushed 11y ago1 watchersCompare

[ Source](https://github.com/reservat/customer)[ Packagist](https://packagist.org/packages/reservat/customer)[ RSS](/packages/reservat-customer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Reservat\\Customer
==================

[](#reservatcustomer)

Customer component service for Reservat application.

[![Build Status](https://camo.githubusercontent.com/46fe8b030698b971b16f5bf0146fbdb1417631bcc37b6ecfa5656b40e127b601/687474703a2f2f746573742e727372762e61743a383038302f6275696c645374617475732f69636f6e3f6a6f623d437573746f6d6572)](http://test.rsrv.at:8080/job/Customer/)

Basic Usage
-----------

[](#basic-usage)

Create a new customer object

```
$customer = new \Reservat\Customer('Luke', 'Steadman', '01234567890', 'luke@steadman.com');

```

Create an instance of `\Reservat\Datamapper\CustomerDatamapper`

```
// We assume $pdo is stored elsewhere and shared
$mapper = new \Reservat\Datamapper\CustomerDatamapper($pdo);

```

Now save your customer

```
$mapper->save($customer);

```

Mapper
------

[](#mapper)

DataMapper functionality allows you to save (insert / update) and delete customer records. First off, create a mapper instance.

```
$mapper = new \Reservat\Datamapper\CustomerDatamapper($pdo);

```

Let's create a new customer object and insert this with the mapper

```
$customer = new \Reservat\Customer('Paul', 'Westerdale', '01234567890', 'paul@westerdale.com');
$mapper->insert($customer); // same as $mapper->save($customer);

```

Let's update the customer object. We need to know the ID of the customer which might not be passed back to the customer entity object, you will have to handle this.

```
$customer->setEmail('paulo@westerdale.com');
$mapper->update($customer, 2);

```

Or use the save function to update the customer

```
$mapper->save($customer, 2);

```

Finally, remove the customer with the mapper

```
$mapper->delete($customer, 2);

```

Repository
----------

[](#repository)

The repository allows us to retrieve data stored in our persistent storage. We abide to two methods, `getById` and `getAll`.

First off, create an instance of repo.

```
$repo = \Reservat\Repository\CustomerRepository($pdo);

```

Grab all the records (default limit: 20)

```
$customers = $repo->getAll();

```

This will return an instance of `\Reservat\Repository\CustomerRepository`, but implements the Iterator interface, so you can foreach over this object.

```
foreach($customers as $customer) {
    $forename = $customer['forename'];
    ...
}

```

To get a single object, simply call the `getById` method, passing the ID of the record.

```
$customer = $repo->getById(1)->current();

```

`getById` also returns an instance of `\Reservat\Repository\CustomerRepository`.

Using current will either return NULL (if the record is not found) or an array of the customer data.

\###@todo

- Implement CustomerRepository
- Add tests
- Include RESTful API endpoints

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/42ed790bfa6e8797d507aa94cdf7875729eac0bb6d964db99e09c4a8c1477179?d=identicon)[steadweb](/maintainers/steadweb)

---

Top Contributors

[![steadweb](https://avatars.githubusercontent.com/u/667618?v=4)](https://github.com/steadweb "steadweb (39 commits)")[![PWesterdale](https://avatars.githubusercontent.com/u/1270719?v=4)](https://github.com/PWesterdale "PWesterdale (6 commits)")

### Embed Badge

![Health badge](/badges/reservat-customer/health.svg)

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

###  Alternatives

[mediawiki/semantic-cite

A Semantic MediaWiki extension to manage citation resources.

2310.2k1](/packages/mediawiki-semantic-cite)

PHPackages © 2026

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