Laravel Developer
David Carr
Web Developer
All Posts Archives Categories Authors
About Books Packages Templates Contact
Blog
All Posts Archives Categories Authors
About Books Packages Templates Contact
Laravel Box
Laravel Packages
Laravel Microsoft Graph Laravel Xero Laravel Sent Emails Laravel Dropbox Laravel Box Laravel Companies House Laravel Countries Laravel Eventbrite Laravel Blade Components
PHP Packages
PDO Wrapper PHP find and replace JSON SQL Import IMAP Export CSV Pagination
v1
Navigation
  • Introduction
  • Install
  • Files
  • Folders
Navigation
  • Introduction
  • Install
  • Files
  • Folders

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);

DCBlog

Practical tutorials, code snippets, and in-depth guides for modern web development. Helping developers build better applications since 2009.

Subscribe to my newsletter for the latest updates on my books and digital products.

© 2009 - 2025 DC Blog. All rights reserved.

Privacy Policy • Terms of Service