Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jakublech committed Sep 14, 2022
0 parents commit 9def21a
Show file tree
Hide file tree
Showing 71 changed files with 3,066 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at https://editorconfig.org

root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/PULL_REQUEST_TEMPLATE.md export-ignore
/ISSUE_TEMPLATE.md export-ignore
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
/docs export-ignore
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build

on:
push:
branches-ignore:
- 'dependabot/**'
pull_request: ~
release:
types: [created]
schedule:
-
cron: "0 1 * * 6" # Run at 1am every Saturday
workflow_dispatch: ~

jobs:
tests:
runs-on: ubuntu-22.04

name: "Spinbits Sylius Google Analytics 4 Events Dto's , PHP ${{ matrix.php }}"

strategy:
fail-fast: false
matrix:
php: ["7.4", "8.0", "8.1"]

steps:
-
uses: actions/checkout@v2

-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
extensions: intl
tools: symfony
coverage: none

-
name: Install PHP dependencies
run: composer install --no-interaction

-
name: Validate composer.json
run: composer validate --ansi --strict

-
name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon -l max src/

-
name: Run Psalm
run: vendor/bin/psalm

-
name: Run PHPUnit
run: vendor/bin/phpunit --colors=always
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
build
composer.lock
vendor
phpcs.xml
phpunit.xml
.phpunit.result.cache
.idea

22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Changelog

All notable changes to `spinbits/baselinker-sdk` will be documented in this file.

Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) principles.

## NEXT - YYYY-MM-DD

### Added
- Nothing

### Deprecated
- Nothing

### Fixed
- Nothing

### Removed
- Nothing

### Security
- Nothing
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

We accept contributions via Pull Requests on [Github](https://github.com/spinbits/baselinker-sdk).


## Pull Requests

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - Check the code style with ``$ composer check-style`` and fix it with ``$ composer fix-style``.

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.

- **Create feature branches** - Don't ask us to pull from your master branch.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.


## Running Tests

``` bash
$ composer test
```


**Happy coding**!
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright (c) 2021 spinbits.io

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
## Google Analytics 4 events dto's

[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-travis]][link-travis]
[![Total Downloads][ico-downloads]][link-downloads]

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

Via Composer

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

## Example Usage

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

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

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

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

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

## Testing

``` bash
$ composer test
```

## Contributing

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

## Security

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

## Credits

- [Jakub Lech][link-author]
- [All Contributors][link-contributors]

## License

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

[ico-version]: https://img.shields.io/packagist/v/spinbits/baselinker-sdk.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/spinbits/baselinker-sdk/master.svg?style=flat-square
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/spinbits/baselinker-sdk.svg?style=flat-square
[ico-code-quality]: https://img.shields.io/scrutinizer/g/spinbits/baselinker-sdk.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/spinbits/baselinker-sdk.svg?style=flat-square

[link-packagist]: https://packagist.org/packages/spinbits/baselinker-sdk
[link-travis]: https://travis-ci.org/spinbits/baselinker-sdk
[link-scrutinizer]: https://scrutinizer-ci.com/g/spinbits/baselinker-sdk/code-structure
[link-code-quality]: https://scrutinizer-ci.com/g/spinbits/baselinker-sdk
[link-downloads]: https://packagist.org/packages/spinbits/baselinker-sdk
[link-author]: https://github.com/spinbits
[link-contributors]: ../../contributors
36 changes: 36 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "spinbits/google-analytics-4-events-dto-s",
"description": "Google Analytics 4 Dto's",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Jakub Lech",
"email": "j.lech@spinbits.io"
}
],
"require": {
"php": "~7.4 || ^8.0"
},
"require-dev": {
"phpunit/phpunit" : ">=8.0",
"squizlabs/php_codesniffer": "^3.0",
"phpstan/phpstan": "^1.8",
"vimeo/psalm": "^4.27"
},
"autoload": {
"psr-4": {
"Spinbits\\GoogleAnalytics4EventsDtoS\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Spinbits\\BaselinkerSdk\\Tests\\": "tests"
}
},
"scripts": {
"test": "phpunit",
"check-style": "phpcs src tests",
"fix-style": "phpcbf src tests"
}
}
14 changes: 14 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<ruleset name="spinbits/baselinker-sdk">
<description>The coding standard of spinbits/baselinker-sdk package</description>
<arg value="p" />

<config name="ignore_warnings_on_exit" value="1" />
<config name="ignore_errors_on_exit" value="1" />

<arg name="colors" />
<arg value="s" />

<!-- Use the PSR2 Standard-->
<rule ref="PSR2" />
</ruleset>
14 changes: 14 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
parameters:
level: max
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
paths:
- src
- tests/Behat

excludes_analyse:
- 'tests/Unit/**.php'

ignoreErrors:
- '#Property (.*) is never read, only written.#'
28 changes: 28 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="spinbits/baselinker-sdk Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<logging>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
15 changes: 15 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
Loading

0 comments on commit 9def21a

Please sign in to comment.