PHP code example of cacheful / magento2-module

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

    

cacheful / magento2-module example snippets


    $url = 'https://cacheful.app/api/projects/%s/process';

    $projectId = 'your-project-id';
    $token = 'your-api-token';
    $requestUrl = sprintf($url, $projectId);

    $request = $client->request('POST', $requestUrl, [
        'headers' => [
            'Authorization' => 'Bearer ' . $token,
            'Accept'        => 'application/json',
        ]
    ]);

    if ($request->getStatusCode() === '200') {
        // successfully queued
    }