PHP Moip class autoloader

0

How do I make this require 'vendor / autoload.php', it does not come in the documentation.

 <?php
 require 'vendor/autoload.php';

 use Moip\Moip;
 use Moip\MoipBasicAuth;

 $endpoint = 'test.moip.com.br';
 $token = '01010101010101010101010101010101';
 $key = 'ABABABABABABABABABABABABABABABABABABABAB';

 $moip = new Moip(new MoipBasicAuth($token, $key), $endpoint);

 $customer = $moip->customers()->setOwnId('sandbox_v2_1401147277')
                          ->setFullname('Jose Silva')
                          ->setEmail('[email protected]')
                          ->setBirthDate('1988-12-30')
                          ->setTaxDocument('33333333333')
                          ->setPhone(11, 66778899)
                          ->addAddress('BILLING',
                                       'Avenida Faria Lima', 2927,
                                       'Itaim', 'Sao Paulo', 'SP',
                                       '01234000', 8);

 print_r($order = $moip->orders()->setOwnId('sandbox_v2_1401147277')
                    ->addItem('Pedido de testes Sandbox - 1401147277', 1, 'Mais info...', 10000)
                    ->setShippingAmount(100)
                    ->setCustomer($customer)
                    ->create());

Thank you.

    
asked by anonymous 24.05.2015 / 20:50

1 answer

1

The new Moip SDK uses Composer so it is enough that you install the dependencies of the project and autoload will do all the work for you.

You should install the composer in your project, see here (content in English) .

After the composer is installed and the project is cloned into a machine, execute the

composer install

Once the dependencies have been installed you can run sample.php in your browser.

The documentation for the new SDK PHP Moip is also up to date, I think it might help.

SDK Moip v2 (php): link

    
08.06.2015 / 18:49