PHPackages                             spinbits/google-analytics-4-events-dto-s - 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. spinbits/google-analytics-4-events-dto-s

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

spinbits/google-analytics-4-events-dto-s
========================================

Google Analytics 4 Dto's

0.9(3y ago)213.6k↑66.7%2MITPHPPHP ~7.4 || ^8.0 || ^8.1

Since Sep 14Pushed 3y ago2 watchersCompare

[ Source](https://github.com/spinbits/google-analytics-4-events-dto-s)[ Packagist](https://packagist.org/packages/spinbits/google-analytics-4-events-dto-s)[ RSS](/packages/spinbits-google-analytics-4-events-dto-s/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (2)

Google Analytics 4 events DTO's
-------------------------------

[](#google-analytics-4-events-dtos)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d28f187def4da21682ab35ca8d25b648ed8077e3274b380f27769cf524bd9e57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370696e626974732f676f6f676c652d616e616c79746963732d342d6576656e74732d64746f2d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spinbits/google-analytics-4-events-dto-s)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/5877be18f91714025b83511cf2d2526b90bb41e8bf7e5410c9ef458d0fb5efbd/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7370696e626974732f676f6f676c652d616e616c79746963732d342d6576656e74732d64746f2d732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/spinbits/google-analytics-4-events-dto-s)[![Total Downloads](https://camo.githubusercontent.com/ff3315797cb082003ae8dfc1333e83221a923f133773c877904975c63d956503/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370696e626974732f676f6f676c652d616e616c79746963732d342d6576656e74732d64746f2d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spinbits/google-analytics-4-events-dto-s)

Need help ?
-----------

[](#need-help-)

Drop us a message

Description
-----------

[](#description)

This package is implementation of [Google Analytics 4](https://developers.google.com/analytics/devguides/collection/ga4), [events](https://developers.google.com/analytics/devguides/collection/ga4/reference/events).

This package provides simple interface to build and serialize objects.

Install
-------

[](#install)

Via Composer

```
$ composer require spinbits/google-analytics-4-events-dto-s
```

Example Usage
-------------

[](#example-usage)

```
$purchase = new Purchase($order->getNumber());

$purchase->setShipping($order->getShippingTotal());
$purchase->setTax($order->getTaxTotal());

$purchase->addItem(new Item('item_id', 'item_name', 1.00, 'USD'));

//get event as array
$purchase->jsonSerialize();

//get event as json
$json = (string) $purchase;
```

You can find more examples in tests directory and in this repo: [Google Analytics 4 Enhanced ecommerce Plugin](https://github.com/spinbits/sylius-google-analytics-plugin)

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

1343d ago

### Community

Maintainers

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

---

Top Contributors

[![jakublech](https://avatars.githubusercontent.com/u/3625472?v=4)](https://github.com/jakublech "jakublech (5 commits)")[![marhub](https://avatars.githubusercontent.com/u/2960432?v=4)](https://github.com/marhub "marhub (1 commits)")

---

Tags

dtoseventsgoogle-analyticsgoogle-analytics-4php

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/spinbits-google-analytics-4-events-dto-s/health.svg)

```
[![Health](https://phpackages.com/badges/spinbits-google-analytics-4-events-dto-s/health.svg)](https://phpackages.com/packages/spinbits-google-analytics-4-events-dto-s)
```

###  Alternatives

[stuttter/wp-multi-network

Provides a Network Management Interface for global administrators in WordPress Multisite installations.

23324.1k1](/packages/stuttter-wp-multi-network)[jtgrimes/less4laravel

Bringing lessphp into Laravel

183.4k](/packages/jtgrimes-less4laravel)[xandros15/slim-pagination

simple pagination for slim3

118.0k](/packages/xandros15-slim-pagination)

PHPackages © 2026

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