PHP code example of plugix / pimcore-bundle

1. Go to this page and download the library: Download plugix/pimcore-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

plugix / pimcore-bundle example snippets


use Plugix\PimcoreBundle\Service\PlugixClient;

class ProductController
{
    public function __construct(private PlugixClient $plugix) {}

    public function generateDescriptions()
    {
        $products = [
            ['id' => 1, 'name' => 'Product 1', 'attributes' => ['color' => 'red']],
        ];

        $descriptions = $this->plugix->generateDescriptions($products, [
            'tone' => 'luxury',
            'languages' => ['en', 'de'],
        ]);

        return $descriptions;
    }
}

$translations = $this->plugix->translate(
    ['Welcome to our store', 'High quality products'],
    'de',
    ['preserveTone' => true]
);

$seo = $this->plugix->generateSeo($products, [
    'metaTitle' => true,
    'metaDescription' => true,
    'keywords' => true,
]);