Currently seeking new career opportunities in web development, particularly with Laravel, Hire Me
Laravel Box

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);
Laravel Modules Your Logo Your Logo Your Logo

Become a sponsor

Help support the blog so that I can continue creating new content!

Sponsor

My Latest Book

Modular Laravel Book - Laravel: The Modular way

Learn how to build modular applications with Laravel Find out more

Subscribe to my newsletter

Subscribe and get my books and product announcements.

Learn Laravel with Laracasts

Faster Laravel Hosting

© 2006 - 2024 DC Blog. All code MIT license. All rights reserved.