Skip to content

Commit

Permalink
added Persoo product feed
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasLudvik committed Dec 12, 2023
0 parents commit 1edf139
Show file tree
Hide file tree
Showing 22 changed files with 1,190 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/run-checks-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on: [push]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
name: "Checks and tests"
jobs:
checks-and-tests:
name: Run checks and tests
runs-on: ubuntu-22.04
steps:
- name: GIT checkout branch - ${{ github.ref }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Install PHP, extensions and tools
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: bcmath, gd, intl, pdo_pgsql, redis, pgsql, zip
tools: composer
- name: Install Composer dependencies
run: composer install --optimize-autoloader --no-interaction
- name: Run parallel-lint
run: php vendor/bin/parallel-lint ./src ./tests
- name: Run Easy Coding Standards
run: php vendor/bin/ecs check --verbose ./src ./tests
- name: Run PHPUnit
run: php vendor/bin/phpunit tests
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.idea
/.php_cs.cache
/composer.lock
/vendor
/.phpunit.result.cache
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Contributing

Thank you for your contributions to Shopsys Product Feed Persoo package.
Together we are making Shopsys Platform better.

This repository is READ-ONLY.
If you want to [report issues](https://github.com/shopsys/shopsys/issues/new) and/or send [pull requests](https://github.com/shopsys/shopsys/compare),
please use the main [Shopsys repository](https://github.com/shopsys/shopsys).

Please, check our [Contribution Guide](https://github.com/shopsys/shopsys/blob/master/CONTRIBUTING.md) before contributing.
14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
MIT License

Copyright (c) 2017-2023 Shopsys s.r.o., http://www.shopsys.com

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.
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Shopsys Product Feed Persoo

[![Downloads](https://img.shields.io/packagist/dt/shopsys/product-feed-persoo.svg)](https://packagist.org/packages/shopsys/product-feed-persoo)

Plugin for [Shopsys Platform](https://www.shopsys-framework.com) responsible for generating XML product feed for [Persoo](https://persoo.cz).

For detailed information about the feed see [official documentation](https://support.persoo.ai/technical-guide/data-tables/products/).

This repository is maintained by [shopsys/shopsys] monorepo, information about changes is in [monorepo CHANGELOG.md](https://github.com/shopsys/shopsys/blob/master/CHANGELOG.md).

## Installation

The plugin is a Symfony bundle and is installed in the same way:

### Download

First, you download the package using [Composer](https://getcomposer.org/):

```
composer require shopsys/product-feed-persoo
```

### Register

For the bundle to be loaded in your application you need to register it in the `app/AppKernel.php` file of your project:

```php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
// ...
new Shopsys\ProductFeed\PersooBundle\ShopsysProductFeedPersooBundle(),
// ...
];

// ...

return $bundles;
}

// ...
}
```

## How to use

You should see the new feed immediately after installation in the administration feed list.
All output XML files will be automatically generated by a cron module or they can be generated manually in administration when logged as superadmin.

## Contributing

Thank you for your contributions to Shopsys Product Feed Persoo package.
Together we are making Shopsys Platform better.

This repository is READ-ONLY.
If you want to [report issues](https://github.com/shopsys/shopsys/issues/new) and/or send [pull requests](https://github.com/shopsys/shopsys/compare),
please use the main [Shopsys repository](https://github.com/shopsys/shopsys).

Please, check our [Contribution Guide](https://github.com/shopsys/shopsys/blob/master/CONTRIBUTING.md) before contributing.

## Support

What to do when you are in troubles or need some help?
The best way is to join our [Slack](https://join.slack.com/t/shopsysframework/shared_invite/zt-11wx9au4g-e5pXei73UJydHRQ7nVApAQ).

If you want to [report issues](https://github.com/shopsys/shopsys/issues/new), please use the main [Shopsys repository](https://github.com/shopsys/shopsys).

[shopsys/shopsys]: (https://github.com/shopsys/shopsys)
52 changes: 52 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "shopsys/product-feed-persoo",
"type": "library",
"description": "Shopsys Platform plugin interface for Persoo XML product feed generation",
"keywords": ["Persoo", "product feed", "XML feed", "plugin", "Shopsys Platform", "SSFW"],
"license": "MIT",
"authors": [
{
"name": "Shopsys",
"homepage": "https://www.shopsys.com/"
}
],
"autoload": {
"psr-4": {
"Shopsys\\ProductFeed\\PersooBundle\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\ProductFeed\\PersooBundle\\": "tests/"
}
},
"require": {
"php": "^8.1",
"ext-json": "*",
"ext-pdo": "*",
"doctrine/dbal": "^3.3.3",
"doctrine/doctrine-bundle": "^2.5.7",
"doctrine/orm": "^2.11.2",
"doctrine/persistence": "^2.4",
"shopsys/form-types-bundle": "14.0.x-dev",
"shopsys/framework": "14.0.x-dev",
"shopsys/migrations": "14.0.x-dev",
"shopsys/plugin-interface": "14.0.x-dev",
"symfony/config": "^5.4",
"symfony/dependency-injection": "^5.4",
"symfony/form": "^5.4",
"symfony/http-kernel": "^5.4",
"symfony/translation": "^5.4"
},
"require-dev": {
"phpunit/phpunit": "^9.5.20",
"shopsys/coding-standards": "14.0.x-dev",
"twig/twig": "^3.5.0"
},
"config": {
"allow-plugins": {
"symfony/flex": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
46 changes: 46 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\FunctionNotation\PhpdocToPropertyTypeFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use Shopsys\CodingStandards\CsFixer\ForbiddenPrivateVisibilityFixer;
use Shopsys\CodingStandards\Sniffs\ForceLateStaticBindingForProtectedConstantsSniff;
use Shopsys\CodingStandards\Sniffs\ObjectIsCreatedByFactorySniff;
use SlevomatCodingStandard\Sniffs\TypeHints\PropertyTypeHintSniff;
use Symplify\EasyCodingStandard\Config\ECSConfig;

/**
* @param Symplify\EasyCodingStandard\Config\ECSConfig $ecsConfig
*/
return static function (ECSConfig $ecsConfig): void {
$ecsConfig->rule(ForceLateStaticBindingForProtectedConstantsSniff::class);

/*
* this package is meant to be extensible using class inheritance,
* so we want to avoid private visibilities in the model namespace
*/
$services = $ecsConfig->services();
$services->set('forbidden_private_visibility_fixer.product_feed_persoo', ForbiddenPrivateVisibilityFixer::class)
->call('configure', [
[
'analyzed_namespaces' => [
'Shopsys\ProductFeed\PersooBundle\Model',
],
],
]);

$ecsConfig->skip([
ObjectIsCreatedByFactorySniff::class => [
__DIR__ . '/tests/*',
],
PhpdocToPropertyTypeFixer::class => [
__DIR__ . '/src/*',
],
DeclareStrictTypesFixer::class => [
__DIR__ . '/src/*',
],
]);

$ecsConfig->import(__DIR__ . '/vendor/shopsys/coding-standards/ecs.php', null, true);
};
17 changes: 17 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
failOnWarning="true"
beStrictAboutTestsThatDoNotTestAnything="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
>
<coverage/>
</phpunit>
35 changes: 35 additions & 0 deletions src/DependencyInjection/ShopsysProductFeedPersooExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace Shopsys\ProductFeed\PersooBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

class ShopsysProductFeedPersooExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yaml');
}

/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container)
{
$container->prependExtensionConfig('doctrine_migrations', [
'migrations_paths' => [
'Shopsys\ProductFeed\PersooBundle\Migrations' => __DIR__ . '/../Migrations',
],
]);
}
}
Empty file added src/Migrations/.gitignore
Empty file.
Loading

0 comments on commit 1edf139

Please sign in to comment.