GroupDocs supports all major platforms, such as .NET, PHP, Java, Python, etc. So with GropDocs’ SDKs you can easily create your own application to store, view, sign (and use a lot of other great features on) your documents online, using Windows or Linux with your favorite language. Today, I’ll talk about GroupDocs PHP SDK and how to get started with it. Sometimes, developers ask us how to get our PHP SDK, how to use it with Composer, or how to include it into their project. As we all know, a good beginning is a half the job. So this is how to start developing with the PHP SDK more quickly and efficiently.

Getting and Using the SDK

There are different ways to get PHP SDK. I’ll show how to get it and then include it into a PHP application.

Manual Download from GitHub

  1. Clone our PHP SDK repo from GitHub (repository is here: https://github.com/groupdocs/groupdocs-php).
  2. Copy all files from the src folder (or the entire src folder with files) into the project.
  3. Include our main API file:require_once _DIR_.’/src/APIClient.php';

After this you can use classes. Code sample:

<?php
require\_once \_\_DIR\_\_.'/src/APIClient.php';
$signer = new GroupDocsRequestSigner(12345);
$apiClient = new APIClient($signer);
echo var\_dump($signer);
echo var\_dump($apiClient);

Getting GroupDocs PHP SDK with Composer and using its Autoloader

Composer is a great tool that helps you get and use PHP libraries easily. There is only one issue for developers that are not familiar with Composer: how to get and use it. But it’s very easy! There are tons of information about this on the Internet, so I’ll provide a sample for Linux users that shows how to:

  1. Get Composer,
  2. download GroupDocs PHP SDK with it, and, finally,
  3. use the autoloader generated by Composer.

Downloading Composer and GroupDocs PHP SDK

For example, to download Composer and the PHP SDK into the sdktest folder in the user’s folder (~):

  1. cd ~

  2. mkdir sdktest

  3. cd sdktest

  4. curl -s http://getcomposer.org/installer | php

  5. gedit composer.json (This create the composer.json file, you should use your editor: vi for example.)

  6. Source for composer.json file:

    {
        "require": {
            "groupdocs/groupdocs-php": "dev-master"
        }
    }
    
  7. php composer.phar install Composer downloads the last version of the GroupDocs PHP SDK and (very important!) creates an autoloader. You can find it in the vendor folder.

  8. Copy all the files in the vendor folder (or the folder itself) and include the autoload.php file into your web app script. (For example: require_once_DIR_.’/vendor/autoload.php’;).

After this, all methods and classes are available to your script. Some frameworks can work with Composer and its autoloader and include it automatically. So now you know how to get GroupDocs PHP SDK and are ready to start coding your own web oriented Document Management solution with GroupDocs PHP SDK. Thanks for reading our Tech Blog.