Package load class 3party


I know that classes get auto loaded when you follow the concrete5 modified PSR-4 standard.

But I don't know how to load an API from a 3party. For example the Mollie payment service. I need to load the autoloader.php which loads all classes.

What is the best way to include a 3party API? I have included a zip of the package.

require_once dirname(__FILE__) . "/../src/Mollie/API/Autoloader.php";
 * Initialize the Mollie API library with your API key.
 * See:
$mollie = new Mollie_API_Client;


This is an example of how I include my own classes. They get Auto loaded by Concrete5. Adjusting the mollie class confirm these guidelines did not work.

Custom class
path: packages/test/blocks/test/models/file.php
namespace Concrete\Package\Test\Block\Test\Models;
defined('C5_EXECUTE') or die (_('Access Denied'));
class File{

Block Controller
path: packages/test/blocks/test/models/file.php
namespace Concrete\Package\Test\Block\Test;
use Concrete\Core\BLock\BlockController;
use Concrete\Package\Test\Block\Test\Models\Test; //use the custom clas
use Core;
defined('C5_EXECUTE') or die(_("Access Denied."));
class Controller extends BlockController
public function view()
      $test = new Test();


1 Attachment

View Replies: View Best Answer
JohntheFish replied on at Permalink Reply
There is currently a mollie gateway in the PRB. I expect it will be approved within the next few days.

EDIT - its a 5.6 payment gateway addon for eCommerce
rge replied on at Permalink Best Answer Reply
Thanks for your answer.

I got it working. But still I would like to know what the best practises are regarding to this topic and where to find more information about this.


I used as a reference (was posted on the forum).

I loaded mollie via composer. It is now located in the vendor folder.

In the Package Controller I load the autoloader.

use Composer\Package\Loader\InvalidPackageException;
use Illuminate\Filesystem\FileNotFoundException;
use Illuminate\Filesystem\Filesystem;
public function on_start()
      //set up namespace and composer
   public function autoload()
      //Init composer
      $filesystem = new Filesystem();
      $filesystem->getRequire(__DIR__ . '/vendor/autoload.php');

In the block controller I create a new mollie instance when the form is submitted and set the payment options. After this the user gets redirected to the Mollie gateway.
$mollie = new \Mollie_API_Client;