Hello I’m trying to install the Square SDK PHP, without composer, I’m just downloading the SDK unzip the files and using the autoload.php, however I got two errors
Notice: Undefined variable: matchingPrefix in C:\wamp\www\squareapi\vendor\autoload.php on line 42
Fatal error: Interface ‘CoreInterfaces\Http\HttpConfigurations’ not found in C:\wamp\www\squareapi\square\ConfigurationInterface.php on line 12
This is in my test enviroment, however I tried on a ubuntu server, without composer and the same errors.
Sorry if this is a Newbie question. I Just need to get the customer list from square in real time. Dont know if there is any other alternative.
When you setup the SDK did you bring in all the dependencies as outlined in the manual setup. To do this, you must first clone these PHP source code packages from GitHub:
Next, you need to provide an autoload script (autoload.php) so that your application can easily access the PHP source code packages at runtime. The Square PHP SDK provides the following example autoload script:
You can download this file, rename it to autoload.php, and use it as is. You can also customize the script to suit your needs.
In your application code, add a require statement to run the autoload script. After that, you are able to use any of the Square PHP SDK classes. For example:
And this is the error:
Fatal error: Uncaught Error: Interface ‘CoreInterfaces\Http\HttpConfigurations’ not found in /var/www/vhosts/bierbath.com/httpdocs/squareapi/vendor/square-php-sdk-master/src/ConfigurationInterface.php:12 Stack trace: #0 /var/www/vhosts/bierbath.com/httpdocs/squareapi/vendor/autoload.php(58): require() #1 [internal function]: {closure}() #2 /var/www/vhosts/bierbath.com/httpdocs/squareapi/vendor/square-php-sdk-master/src/SquareClient.php(56): spl_autoload_call() #3 /var/www/vhosts/bierbath.com/httpdocs/squareapi/vendor/autoload.php(58): require(‘/var/www/vhosts…’) #4 [internal function]: {closure}() #5 /var/www/vhosts/bierbath.com/httpdocs/squareapi/index.php(9): spl_autoload_call() #6 {main} thrown in /var/www/vhosts/bierbath.com/httpdocs/squareapi/vendor/square-php-sdk-master/src/ConfigurationInterface.php on line 12
I tried to reupload all the files from the repository but nothing.
@Bryan-Square This class/file doesn’t exist in the files we are instructed to manually bring over, despite your copying the instructions for us again. I’m also having this issue - please find out where we can pull the file from and report back.
Thankyou @amanda.knickelbein after install that two repos, I got some improvement, so definitily that will help, but now I got this error
" Fatal error: Uncaught TypeError: Square\BearerAuthManager::__construct(): Argument #1 ($accessToken) must be of type string, bool given, called in C:\wamp64\www\square1\square-php-sdk\src\SquareClient.php on line 154 and defined in C:\wamp64\www\square1\square-php-sdk\src\BearerAuthManager.php on line 22"
I have tried many options over twodays but I still get this.
I have working web payment frozen from mid 2022 so I am trying to upgrade to April 2024
This has added new lines to the autoload.php which you posted but no good.
Severity: Warning
Message: require(/home/adminsarrc/public_html/JEB/application/views/square4/vendor/apimatic/core-interfaces-php/src/HttpConfigurations.php): Failed to open stream: No such file or directory
Message: require(/home/adminsarrc/public_html/JEB/application/views/square4/vendor/apimatic/core-interfaces-php/src/Http/HttpConfigurations.php): Failed to open stream: No such file or directory
Filename: vendor/autoload.php
<?php
/**
* An example of an autoload register for manual installation
*
* After registering this autoload function with SPL, the following line
* would cause the function to attempt to load the \Square\Baz class
* from /path/to/project/src/Baz.php:
*
* new \Square\Baz;
*
* @param string $class The fully-qualified class name.
* @return void
* 9 May 2024 added core and CoreInterfaces to prefix location from square3 vesrion
*
*/
spl_autoload_register(function ($class) {
/**
* An array with project-specific namespace prefix as keys and location relative to this autoloader.php file as values
* You can find this information in each of the package's composer.json file on the "autoload" field
*
* NOTE: The key of the autoload object denotes the format used.
* If the key is "psr-4" then there is no need to append the namespace to the path.
* if the key is "psr-0" then the namespace needs to be appended. Unirest is an example of the psr-0 format.
*/
$prefixToLocation = [
// "CoreInterfaces\\" => "/apimatic/core-interfaces-php/src/",
"Square\\" => "/square-php-sdk/src/",
"apimatic\\jsonmapper\\" => "/apimatic/jsonmapper/src/",
// This is the Namespace and location from Apimatic/Unirest's composer.json
"Unirest\\" => "/apimatic/unirest-php/src/",
"Core\\" => "/apimatic/core-lib-php/src/",
"CoreInterfaces\\" => "/apimatic/core-interfaces-php/src/",
];
$matchingPrefix;
foreach ($prefixToLocation as $prefix => $location) {
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// no, move to the next registered autoloader
continue;
} else {
$matchingPrefix = $prefix;
}
}
if (!$matchingPrefix) return; // ClassPrefix was not found return
// base directory for the namespace prefix
$base_dir = (__DIR__ . $prefixToLocation[$matchingPrefix]);
// get the relative class name
$relative_class = substr($class, strlen($matchingPrefix));
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it require $file;
if (file_exists(trim($file))) {
include $file;
}else {
echo("Error loading: " . $file . "\r\n");
}
require "/home/adminsarrc/public_html/JEB/application/views/square4/vendor/apimatic/core-interfaces-php/src/Http/HttpConfigurations.php";
});

Full details of message autoload and picture of directory. Note used include to get to the reuire line without stopping. Its all in Codeiginter 3 just like all other versions of the payment used since 2022.
It looks like the file /home/adminsarrc/public_html/JEB/application/views/square4/vendor/apimatic/core-interfaces-php/src/Http/HttpConfigurations.php does not exist on the server, which is causing the autoload function to fail when it tries to require the file.
To fix this issue, you should check if the file actually exists in the specified directory. If it does not, you may need to reinstall the package that provides this file or update the autoloader to point to the correct location. If the file does exist, check for any typos in the file path or permissions issues that might be preventing it from being accessed.