Reputation: 15968
I'm having an issue on Mautic php api-library installation as described the docs. I download the zip as mentioned above.
Download the package from Github. Extract then include the following code in your project:
I download the lib folder, which contains a lot of php files and added it to my project, and them create a simple php file.
<?php
require_once __DIR__ . '/lib/Mautic/MauticApi.php'; // yes, the path is correct
use Mautic\Auth\ApiAuth;
session_start();
$settings = array(
'userName' => '...',
'password' => '...'
);
// Initiate the auth object specifying to use BasicAuth
$initAuth = new ApiAuth();
$auth = $initAuth->newAuth($settings, 'BasicAuth');
The MauticApi.php file was found but i got the fallowing error when executing.
Fatal error: Class 'Mautic\Auth\ApiAuth' not found in C:\xampp\htdocs\test\test.php on line 11
I thinks that all files inside the lib folder must be included recursively. but the docs tells to only include the MauticApi.php file. Is that correct? what should i do?
Server info:
PHP Version 5.6.33
cURL support enabled
cURL Information 7.56.0
Server API Apache 2.0 Handler
Upvotes: 0
Views: 1124
Reputation: 68
I would suggest using composer to install the library and just include the autoload file. Manually adding the library will force you to include all the files in your script.
Upvotes: 2