Introduction
A Laravel package for working with Box.
https://github.com/dcblogdev/laravel-box
Box API documentation can be found at: https://developer.box.com/
Import Namespace
use Dcblogdev\Box\Facades\Box;
A routes example:
Route::get('box', function() {
//if no box token exists then redirect
Box::getAccessToken();
//box authenticated now box:: can be used freely.
//example of getting the authenticated users details
return Box::get('/users/me');
});
Route::get('box/oauth', function() {
return Box::connect();
});
Calls can be made by referencing Box:: then the verb get,post,put,patch or delete followed by the end point to call. An array can be passed as a second option.
The end points are relative paths after https://api.box.com/2.0/
Example GET request
Box::get('users/me');
Example POST request
Box::post('folders', [
'name' => 'name of the folder',
'parent' => [
'id' => 0
]
]);
The formula is:
Box::get('path', $array);
Box::post('path', $array);
Box::put('path', $array);
Box::patch('path', $array);
Box::delete('path', $array);