Install without composer

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.

Thank you for any help

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:

  • 1
  • 2
  • 3
require 'autoload.php';

use Square\SquareClient;


I’m pretty sure that is a silly error, but I cand find the problem.
This my dir structure and the autoload file

And this is the error:
Fatal error: Uncaught Error: Interface ‘CoreInterfaces\Http\HttpConfigurations’ not found in /var/www/vhosts/ Stack trace: #0 /var/www/vhosts/ require() #1 [internal function]: {closure}() #2 /var/www/vhosts/ spl_autoload_call() #3 /var/www/vhosts/ require(‘/var/www/vhosts…’) #4 [internal function]: {closure}() #5 /var/www/vhosts/ spl_autoload_call() #6 {main} thrown in /var/www/vhosts/ on line 12

I tried to reupload all the files from the repository but nothing.

Thanks again for your help.

Same exact issue here…

@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.

@antonybasta @lagarto
I believe I got it. You’ll also need to clone the files in these repos: GitHub - apimatic/core-interfaces-php: Definition of the behavior of core-lib-php, unirest-php and APIMatic's PHP SDK and GitHub - apimatic/core-lib-php: Core logic and the utilities for the APIMatic's PHP SDKs and update your autoload file accordingly.

One more set of “instructions” Square has that covers about 90% of the necessary information. Really getting annoyed with that. :roll_eyes:

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"

getting error because file does not exist’s is there any file named as HttpConfigurations.
i need this file please help. getting error :

Fatal error: Uncaught Error: Interface "src\Http\HttpConfigurations" not found in C:\xampp\htdocs\squarepg\sqare\square-php-sdk\src\ConfigurationInterface.php:15
Stack trace:
#0 C:\xampp\htdocs\squarepg\sqare\square-php-sdk\example-autoload.php(58): require()
#1 C:\xampp\htdocs\squarepg\sqare\square-php-sdk\src\SquareClient.php(57): {closure}(‘Square\Configur…’)
#2 C:\xampp\htdocs\squarepg\sqare\square-php-sdk\example-autoload.php(58): require(‘C:\xampp\htdocs…’)
#3 C:\xampp\htdocs\squarepg\process-payment3.php(19): {closure}(‘Square\SquareCl…’)
#4 {main}
thrown in C:\xampp\htdocs\squarepg\sqare\square-php-sdk\src\ConfigurationInterface.php on line 15

I see you posted in a few threads. Is this with our PHP example or just the Web Payments SDK with a PHP backend? Are you using Composer? :slightly_smiling_face:

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

Filename: vendor/autoload.php

of course its there! I can edit etc. 0644

Did you get all of this to work? Square it says it not there when it is. Tried many tings including a copy and past of the file.

If it’s still saying that its not found have you tried configuring the exact file path? :slightly_smiling_face:

Error loading: /home/adminsarrc/public_html/JEB/application/views/square4/vendor/apimatic/core-interfaces-php/src/Http/HttpConfigurations.php

A PHP Error was encountered

Severity: Warning

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"; }); ![image|677x329](upload://nlTKuStYDphcYruK8nc9J5BjaIY.png)

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. :slightly_smiling_face:

I sent the proof picture from filezilla showing the directory listing, here is the picture again.

SSH filezilla vesrion

perhaps copy the code that is required (and cannot be loaded) directly in the autoload.php file. Can you provide me with to test?

No update means no news?

We haven’t been able to replicate this on our end. Have you tried deleting and re-installing all the packages and dependencies? :slightly_smiling_face: