PHP code example of mollie / magento2-analytics

1. Go to this page and download the library: Download mollie/magento2-analytics 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/ */

    

mollie / magento2-analytics example snippets


class DoSomeStuff {
    /**
     * @var \Mollie\Analytics\Api\AnalyticsRepositoryInterface
     */
    private $repository;

    public function __construct(
        \Mollie\Analytics\Api\AnalyticsRepositoryInterface $repository
    ) {
        $this->repository = $repository;
    }

    public function getClientId(int $cartId): ?string
    {
        return $this->repository->getByCartId($cartId)->getClientId();
    }
}

php bin/magento setup:upgrade
php bin/magento cache:flush

php bin/magento setup:static-content:deploy