Skip to content
/ box Public
forked from Illizian/box

Wrapper in PHP for the Box.com API

Notifications You must be signed in to change notification settings

gobinathm/box

 
 

Repository files navigation

box

Scrutinizer Code Quality Build Status

Wrapper in PHP for the Box.com API

Installation via composer

Add the following lines to your composer.json:

"repositories": [  
    {
        "type": "git",
        "url": "https://github.com/henrikromby/box"
    }
],

"require": {
  "henrikromby/box": "dev-master"
}

(until it's submited to packagist)

Usage

Instantiate HTTP Client

$http = new \Romby\Box\Http\Adapters\GuzzleHttpAdapter(new \GuzzleHttp\Client())

Instantiate the required library class

$folders = new \Romby\Box\Services\Folders($http);
$files = new \Romby\Box\Services\Files($http);
$comments = new \Romby\Box\Services\Comments($http);
$collaborations = new \Romby\Box\Services\Collaborations($http);
$sharedItems = new \Romby\Box\Services\SharedItems($http);
$users = new \Romby\Box\Services\Users($http);
$tasks = new \Romby\Box\Services\Tasks($http);
$groups = new \Romby\Box\Services\Groups($http);
$search = new \Romby\Box\Services\Search($http);

Example (uploading a file in Laravel)

// Get Input
$file = Input::file('file');
// Extract data from file
$path = $file->getRealPath();
$name = $file->getClientOriginalName();
// Specify the parent_id for the folder
$parent_id = "0" // 0 = root of your box.com folder
// Insert your token here
$token = "Your API Key";

$BoxFile = new \Romby\Box\Services\Files($http);
$resp = $BoxFile->upload($token, $path, $name, $parent);

Documentation

You can refer to the documentation here

About

Wrapper in PHP for the Box.com API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 84.8%
  • Gherkin 15.2%