承接 dcblogdev/laravel-box 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dcblogdev/laravel-box

Composer 安装命令:

composer require dcblogdev/laravel-box

包简介

A Laravel Box package

关键字:

README 文档

README

There is a Discord community. https://discord.gg/VYau8hgwrm For quick help, ask questions in the appropriate channel.

Latest Version on Packagist Total Downloads

Logo

A Laravel package for working with box API.

Box API documentation can be found at: https://developer.box.com/

Application Register

To use Box API an application needs creating at https://app.box.com/developers/console/newapp

Select the type of application. Select custom if you need to access the API abilities.

Select the Oauth2 app type after selecting custom.

Install

Via Composer

composer require dcblogdev/laravel-box

Config

You can publish the config file with:

php artisan vendor:publish --provider="Dcblogdev\Box\BoxServiceProvider" --tag="config"

When published, the config/box.php config file contains:

return [
    'clientId'       => env('BOX_CLIENT_ID'),
    'clientSecret'   => env('BOX_SECRET_ID'),
    'redirectUri'    => env('BOX_REDIRECT_URI'),
    'boxLandingUri'  => env('BOX_LANDING_URI'),
    'urlAuthorize'   => 'https://account.box.com/api/oauth2/authorize',
    'urlAccessToken' => 'https://www.box.com/api/oauth2/token',
];

Migration

You can publish the migration with:

php artisan vendor:publish --provider="Dcblogdev\Box\BoxServiceProvider" --tag="migrations"

After the migration has been published you can create the tokens tables by running the migration:

php artisan migrate

.ENV Configuration

You should add the env variables to your .env file, this allows you to use a different box application on different servers, each box application requires a unique callback URL.

The following are required when using OAuth 2.0 credentials:

The BOX_REDIRECT_URI is where Box should redirect to for authentication with Box, upon successful authentication the BOX_LANDING_URI is used to direct a user to the desired page. > Note BOX_REDIRECT_URI needs to be the full URI ie https://domain.com/box/

BOX_CLIENT_ID=
BOX_SECRET_ID=
BOX_REDIRECT_URI=https://domain.com/box/oauth
BOX_LANDING_URI=https://domain.com/box

Usage

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

Working with Files

This package provides a clean way of working with files.

To work with files first call ->files() followed by a method.

Get file Accepts a file id, returns an array.

Box::files()->file($id);

Download file Accepts a file id Optionally a path can be used when $storeDownload is set to true. To download the file only an id is required.

Box::files()->download($id, $path = '', $storeDownload = false);

Upload file Accepts a file path and filename. Optionally specificy the parent, defaults to 0 when ommited.

Box::files()->upload($path, $name, $parent = 0);

Upload revision Accepts the file id, file path and filename. Optionally specificy a new name.

Box::files()->uploadRevision($file_id, $filepath, $name, $newname = null);

Delete file Accepts a file id, returns no output.

Box::files()->destroy($id);

Change log

Please see the changelog for more information on what has changed recently.

Contributing

Contributions are welcome and will be fully credited.

Contributions are accepted via Pull Requests on Github.

Pull Requests

  • Document any change in behaviour - Make sure the readme.md and any other relevant documentation are kept up-to-date.

  • Consider our release cycle - We try to follow SemVer v2.0.0. Randomly breaking public APIs is not an option.

  • One pull request per feature - If you want to do more than one thing, send multiple pull requests.

Security

If you discover any security related issues, please email dave@dcblog.dev email instead of using the issue tracker.

License

license. Please see the license file for more information.

dcblogdev/laravel-box 适用场景与选型建议

dcblogdev/laravel-box 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37.4k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2020 年 02 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「box」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dcblogdev/laravel-box 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dcblogdev/laravel-box 我们能提供哪些服务?
定制开发 / 二次开发

基于 dcblogdev/laravel-box 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 37.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 24
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-23