3

Is there a way to install the Shippo PHP files manually without Composer or Laravel?

I uploaded the files manually, but I get an error when I run the examples:

Warning: require_once(/var/www/html/shippo/examples../../vendor/autoload.php): failed to open stream: No such file or directory.

I'm not familiar with Composer or Laravel and have not been able to get Composer to work.

Amr Eladawy
  • 4,193
  • 7
  • 34
  • 52
jligda
  • 180
  • 3
  • 18
  • Are you using an absolute path to https://github.com/goshippo/shippo-php-client/blob/master/lib/Shippo.php? The part that is confusing is that you're still using the vendor/autoload.php as a sub-directory within shippo. If you want to require Shippo in a project, you need something like `require('/shippo-php-client/lib/Shippo.php')` which should include everything in the Shippo client. – mootrichard May 24 '17 at 18:13

2 Answers2

3

In order to manually install the library, you'd need to be sure you're including full path to shippo-php-client/lib/Shippo.php. So something like:

require('shippo-php-client/lib/Shippo.php')

If you're going this route though, you'll want to be sure that you have all of the required dependencies. The library currently depends on the following PHP extensions:

The library was designed to be most easily installed using Composer, since its fairly ubiquitous amongst PHP projects and frameworks. I would still recommend revisiting setting up and using Composer to manage installing the Shippo library.

mootrichard
  • 3,581
  • 13
  • 25
  • Shippo checks for those, as one can see here: https://stackoverflow.com/a/62136843/1572383 Adding as an answer because comments are not great when dealing with code samples. https://meta.stackexchange.com/questions/77485/code-formating-in-comments/77490#77490 – Gabriel Reguly Jun 01 '20 at 16:43
0

Shippo.php has the tests for cURL, JSON and mbstring internally so don't worry about it.

// Tested on PHP 5.2, 5.3
if (!function_exists('curl_init')) {
    throw new Exception('Shippo needs the CURL PHP extension.');
}
if (!function_exists('json_decode')) {
    throw new Exception('Shippo needs the JSON PHP extension.');
}
if (!function_exists('mb_detect_encoding')) {
    throw new Exception('Shippo needs the Multibyte String PHP extension.');
}
Gabriel Reguly
  • 340
  • 2
  • 9