PHPackages                             frontastic/common - 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. frontastic/common

ActiveLibrary

frontastic/common
=================

2.49.2(1mo ago)4156.2k↓37%1[1 PRs](https://github.com/FrontasticGmbH/common/pulls)2NonePHPCI passing

Since Feb 10Pushed 1mo ago18 watchersCompare

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

READMEChangelogDependencies (83)Versions (162)Used By (2)

Common Libraries
================

[](#common-libraries)

**Copyright (C) Frontastic GmbH - All Rights Reserved**

These is a library which contains common domain concepts and functionality for Frontastic.

Documentation about Frontastic can be found at while the [API Documentation](docs/) can be found inside this repository.

API Design Concepts
===================

[](#api-design-concepts)

TL;DR;
------

[](#tldr)

- Plain data objects without logic
- Logic replaceable encapsulated in services from DIC or factory
- Expose the common base of all back-ends
- `dangerousInner*` for raw data
- `before*` / `after*` Decorators for customer adjustments

Domain Model
------------

[](#domain-model)

One of the core concepts we believe in in API Design is [Injectables vs Newables as described in the Qafoo blog](https://qafoo.com/blog/111_injectables_newables.html). This is why we have objects modelling the data which usually have no methods at all and objects which implement the service interactions. We call them Data Objects (Newables) and Services (Injectables) in this document.

### Data Objects

[](#data-objects)

The Domain Objects model the Data Structures. The only methods which are allowed on Data Objects are methods which nobody would ever implement in a different way. Since the APIs are the base for many different customer projects those methods basically will not exist. A popular example are mail validations in Domain Objects, while the mail validation regular expressions already differ you could even think of using external services to validate the validity of a mail address, which then obviously should not happen in Data Objects.

Our Data Objects are modeled as classes with public properties extending [a base DataObject](https://github.com/kore/DataObject) ensuring PHP throws exceptions when accessing non existent properties. We do this to simplify creation and usage – we do not consider getters and setters a must even you could implement additional type checks there. In the near future PHP might even add support for typed properties which would even solve this problem.

While we generally consider immutability of Data Objects a plus, and we should usually not modify them ourselves, our Data Objects are mutable by intention. This enables modification by customers: For examples we allow customers to map out additional properties and allow them to define, for example, additional attributes inside a variant (see Decorators).

For those customers who are allowed to modify PHP code we allow them to extend the existing Data Objects to create objects with additional properties. So no class should be `final`.

All parameters and return values of methods (except for constructors) *should*be Data Objects, while we seldomly use scalar values, while this is discouraged. Services **must not** be parameters (except for the constructor or setter injection) nor return values.

### Services

[](#services)

Services implement the actual functionality, like implementing our API interfaces for a certain endpoint. Services are **always** created by our factories (by configuration) or by the Symfony Dependency Injection Container. Services can also be overwritten by customers, but this should be the last resort to implement a certain functionality. We want to provide sensible extension points (like the decorators) to implement all functionailty.

Beside the general implementation for the API (like `ProductApi\Commercetools`) there may be any number of helper services (like the mapper, the client, …).

Code Structure
--------------

[](#code-structure)

There are mainly two types of bundles:

- API **Abstractions** `*ApiBundle` (for example the `ProductApiBundle`)

    These bundles are supposed to only contain the interfaces and the domain objects. This principle is currently violated by the Commercetools implementation which is part of the API abstractions. This is supposed to be refactored accordingly.
- API **Implementations** (for example the `ShopwareBundle`)

    These bundles implement the API for a certain backend and can be enabled if the customers uses this backend. These API Implementation bundles usually implement the interfaces from the API Abstraction bundles and may contain additional helper services. They should usually not define any Domain Objects.

Besides that there are some additional bundles and infrastructure code like the generic Http-Client-Implementation which allows us to implement, monitor and configure HTTP requests in a generic way.

Decorators
----------

[](#decorators)

The decorator structure is implemented in [Catwalk](https://github.com/FrontasticGmbH/catwalk) but still is relevant to these APIs: We allow people to hook into every API call using `before*` and `after*` decorators for all API methods. This allows people to modify queries to the API and also the return values of the API. This is the main extension point for all APIs. On top of this there might be API specific configuration handled by the API factory.

Dangerous-Inner-\*
------------------

[](#dangerous-inner-)

Many Domain Objects have a `dangerousInner*` property (for example `dangerousInnerProduct`) which is a direct reference to the unmodified return value from the respective API. This allows users of our APIs to access additional data which our own mappers do not map out to our own Domain Objects.

We understand that we do not cover all potential use cases of the mapped APIs and this allows people to access the original data inside their decorators. The `dengerousInner*` properties are usually stripped out by the Backend For Frontend, though, to not leak confidential data and to reduce data size. Also many API SDKs which might be used by certain implementations use "Domain Objects" which are not possible to serialize sensibly.

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity37

Limited adoption so far

Community33

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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

Recently: every ~172 days

Total

159

Last Release

54d ago

Major Versions

1.1.20 → 2.0.02020-11-27

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/0efbde993c12c5386754d74128e633e7195a90d423307940707e540570c87563?d=identicon)[frontastic](/maintainers/frontastic)

![](https://www.gravatar.com/avatar/80ff77c23e505855056ec82d07dafb5e1a92087e31b65d4e3038af62ae3b315e?d=identicon)[frontastic-developers](/maintainers/frontastic-developers)

---

Top Contributors

[![rioderelfte](https://avatars.githubusercontent.com/u/158208?v=4)](https://github.com/rioderelfte "rioderelfte (510 commits)")[![kore](https://avatars.githubusercontent.com/u/154398?v=4)](https://github.com/kore "kore (413 commits)")[![tobyS](https://avatars.githubusercontent.com/u/187140?v=4)](https://github.com/tobyS "tobyS (305 commits)")[![N3m1s](https://avatars.githubusercontent.com/u/7655547?v=4)](https://github.com/N3m1s "N3m1s (130 commits)")[![schaumiii](https://avatars.githubusercontent.com/u/654148?v=4)](https://github.com/schaumiii "schaumiii (89 commits)")[![codeSanja](https://avatars.githubusercontent.com/u/13676717?v=4)](https://github.com/codeSanja "codeSanja (76 commits)")[![jdworschak](https://avatars.githubusercontent.com/u/3754623?v=4)](https://github.com/jdworschak "jdworschak (61 commits)")[![SKoschnicke](https://avatars.githubusercontent.com/u/105162?v=4)](https://github.com/SKoschnicke "SKoschnicke (53 commits)")[![hco](https://avatars.githubusercontent.com/u/156839?v=4)](https://github.com/hco "hco (45 commits)")[![melaniehoek](https://avatars.githubusercontent.com/u/49396773?v=4)](https://github.com/melaniehoek "melaniehoek (30 commits)")[![cmourullo](https://avatars.githubusercontent.com/u/1929330?v=4)](https://github.com/cmourullo "cmourullo (29 commits)")[![mantiz](https://avatars.githubusercontent.com/u/838666?v=4)](https://github.com/mantiz "mantiz (26 commits)")[![chloe0592](https://avatars.githubusercontent.com/u/52276952?v=4)](https://github.com/chloe0592 "chloe0592 (22 commits)")[![jimania](https://avatars.githubusercontent.com/u/1533044?v=4)](https://github.com/jimania "jimania (22 commits)")[![IveChosenWisely](https://avatars.githubusercontent.com/u/45197876?v=4)](https://github.com/IveChosenWisely "IveChosenWisely (14 commits)")[![marcelfahle](https://avatars.githubusercontent.com/u/181004?v=4)](https://github.com/marcelfahle "marcelfahle (11 commits)")[![rubanraj54](https://avatars.githubusercontent.com/u/10024405?v=4)](https://github.com/rubanraj54 "rubanraj54 (10 commits)")[![gaboratarithnea](https://avatars.githubusercontent.com/u/48084565?v=4)](https://github.com/gaboratarithnea "gaboratarithnea (8 commits)")[![iamahless](https://avatars.githubusercontent.com/u/28005424?v=4)](https://github.com/iamahless "iamahless (7 commits)")[![hkovesdi](https://avatars.githubusercontent.com/u/53486704?v=4)](https://github.com/hkovesdi "hkovesdi (7 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/frontastic-common/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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