Video Demo

Introduction

The first step towards building any application using the Angell EYE PHP Class Library for PayPal is to actually download and install it within our project.

I will be using PHPStorm through-out this tutorial, but you can use any IDE / editor you’re comfortable with.

We will cover two methods of downloading and installing the class library:

  1. Composer Install (recommended)
  2. Manual Install

Composer

This is the recommended method of working with PHP class libraries (packages).  Of course, the first step here is to download and install Composer if you haven’t already done so. There are command line options as well as a Windows installer, so it’s no different than installing any other software, but if you get stuck there are plenty of tutorials online for this already.

With Composer installed, we can simply create a file called composer.json in the root of our project folder with the following:

{
	"require": {
		"php": ">=5.3.0",
		"ext-curl": "*",
		"angelleye/paypal-php-library": "3.0.*"
	}
}

Really…that’s all we need in our composer.json file!

This require rule will check that you have PHP 5.3.0 or greater installed and that cURL is enabled.  It will then pull the latest 3.0.* version of the class library into your project accordingly.

At this point, we now have a project directory with nothing but a composer.json file.

With our composer.json file saved, let’s load up our terminal window and run the following command from within our project’s root directory:  composer update

PayPal Composer Update

This will download the class library and set it up for us so that it’s available within our project.

angelleye PayPal Library Composer

That’s it!  Our project now includes the Angell EYE PayPal class library and is ready for use! Here’s another look at our current directory structure now that we’ve run the “composer update” command.

angelleye paypal php class library

As you can see, creating a single composer.json file and running a single “composer update” command has automatically pulled in the entire library. Woo! Composer!

Manual Install

If you’re not using Composer (you really should be) you may download the class library from our GitHub repo and install it to your project manually.

AngellEYE PayPal PHP SDK Library

Extract the contents of the zip file into your project structure and upload it to your web server accordingly.

Configuration

Steps to setup the configuration settings for the library may vary depending on what framework or platform (if any) you are using.

The library includes a sample config file located at /vendor/angelleye/paypal-php-library/samples/config/config-sample.php that is heavily commented with instructions so that you can see everything you need in your config file.

If your framework provides unique configuration you can use this sample config file as a template to build the config settings into your project.  Otherwise, you may simply open the config-sample.php and save it to your preferred location as config.php or any other name you like.

Including the Library

Now within your application script(s) all that is left to do is include the config and autoload files, which will then load up the class libraries for you.

include_once("/path/to/config.php");
include_once("/path/to/autoload.php");

Conclusion

With the class library installed and configured in your application you are now ready to integrate PayPal API’s quickly and easily!

Next, take a look at our quick lesson on how to integrate PayPal in PHP using our class library.  For additional lessons on how to accomplish specific tasks with the library you may browse our tutorials directory.

Premium support is available if you need more direct help.

Need Additional Help?

Schedule a live meeting with Drew Angell, PayPal Certified Developer, and get all of your questions or concerns answered.