InstallationΒΆ

Using Composer is the recommended way to install the Chargely SDK for PHP. Composer is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project. In order to use the SDK with Composer, you must do the following:

  1. Add chargely/chargely-sdk-php as a dependency in your project’s composer.json file.

    {
        "require": {
            "chargely/chargely-sdk-php": "1.*"
        }
    }
    

Consider tightening your dependencies to a known version (e.g., ~1.0.0).

  1. Download and install Composer.:

    curl -sS https://getcomposer.org/installer | php
    
  2. Install your dependencies.:

    php composer.phar install
    
  3. Require Composer’s autoloader.

    Composer prepares an autoload file that’s capable of autoloading all of the classes in any of the libraries that it downloads. To use it, just add the following line to your code’s bootstrap process.

    <?php
    require_once '/path/to/project/vendor/autoload.php';
    

You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.

During your development, you can keep up with the latest changes on the master branch by setting the version requirement for the SDK to dev-master.

{
   "require": {
      "chargely/chargely-sdk-php": "dev-master"
   }
}