{"id":13773768,"url":"https://github.com/dcblogdev/laravel-dropbox","last_synced_at":"2025-10-07T02:06:41.753Z","repository":{"id":49758154,"uuid":"189828582","full_name":"dcblogdev/laravel-dropbox","owner":"dcblogdev","description":"A Laravel package for working with Dropbox API v2.","archived":false,"fork":false,"pushed_at":"2025-02-24T22:43:38.000Z","size":29,"stargazers_count":29,"open_issues_count":13,"forks_count":18,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T02:04:46.206Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcblogdev.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":".github/FUNDING.yml","license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["dcblogdev"]}},"created_at":"2019-06-02T09:37:44.000Z","updated_at":"2025-08-31T11:24:00.000Z","dependencies_parsed_at":"2023-02-19T00:15:45.098Z","dependency_job_id":"ec2ea32b-f179-419b-85d1-1c7bc69101a3","html_url":"https://github.com/dcblogdev/laravel-dropbox","commit_stats":{"total_commits":35,"total_committers":4,"mean_commits":8.75,"dds":0.2571428571428571,"last_synced_commit":"d7f364873be364203191dd21634af58350de77cb"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/dcblogdev/laravel-dropbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Flaravel-dropbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Flaravel-dropbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Flaravel-dropbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Flaravel-dropbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcblogdev","download_url":"https://codeload.github.com/dcblogdev/laravel-dropbox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Flaravel-dropbox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278708004,"owners_count":26031932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:01:19.978Z","updated_at":"2025-10-07T02:06:41.733Z","avatar_url":"https://github.com/dcblogdev.png","language":"PHP","readme":"[![Latest Version on Packagist](https://img.shields.io/packagist/v/dcblogdev/laravel-dropbox.svg?style=flat-square)](https://packagist.org/packages/dcblogdev/laravel-dropbox)\n[![Total Downloads](https://img.shields.io/packagist/dt/dcblogdev/laravel-dropbox.svg?style=flat-square)](https://packagist.org/packages/dcblogdev/laravel-dropbox)\n\n![Logo](https://repository-images.githubusercontent.com/189828582/4defa980-49c1-11eb-9668-76f985726c80)\n\n## Community\n\nThere is a Discord community. https://discord.gg/VYau8hgwrm For quick help, ask questions in the appropriate channel.\n\n## Introduction\n\nA Laravel package for working with Dropbox v2 API.\n\nDropbox API documentation can be found at:\nhttps://www.dropbox.com/developers/documentation/http/documentation\n\n## Application Register\nTo use Dropbox API an application needs creating at https://www.dropbox.com/developers/apps\n\nCreate a new application, select either Dropbox API or Dropbox Business API\nNext select the type of access needed either the app folder (useful for isolating to a single folder), or full Dropbox.\n\nNext copy and paste the APP Key and App Secret into your .env file:\n\n```\nDROPBOX_CLIENT_ID=\nDROPBOX_SECRET_ID=\n```\n    \nNow enter your desired redirect URL. This is the URL your application will use to connect to Dropbox API.\n\nA common URL is https://domain.com/dropbox/connect\n\n## Install\n\nVia Composer\n\n```\ncomposer require dcblogdev/laravel-dropbox\n```\n \n## Config\n\nYou can publish the config file with:\n\n```\nphp artisan vendor:publish --provider=\"Dcblogdev\\Dropbox\\DropboxServiceProvider\" --tag=\"config\"\n```\n\nWhen published, the config/dropbox.php config file contains, make sure to publish this file and change the scopes to match the scopes of your Dropbox app, inside Dropbox app console.\n\n```php\n\u003c?php\n\nreturn [\n\n    /*\n    * set the client id\n    */\n    'clientId' =\u003e env('DROPBOX_CLIENT_ID'),\n\n    /*\n    * set the client secret\n    */\n    'clientSecret' =\u003e env('DROPBOX_SECRET_ID'),\n\n    /*\n    * Set the url to trigger the oauth process this url should call return Dropbox::connect();\n    */\n    'redirectUri' =\u003e env('DROPBOX_OAUTH_URL'),\n\n    /*\n    * Set the url to redirecto once authenticated;\n    */\n    'landingUri' =\u003e env('DROPBOX_LANDING_URL', '/'),\n\n    /**\n     * Set access token, when set will bypass the oauth2 process\n     */\n    'accessToken' =\u003e env('DROPBOX_ACCESS_TOKEN', ''),\n\n    /**\n     * Set access type, options are offline and online\n     * Offline - will return a short-lived access_token and a long-lived refresh_token that can be used to request a new short-lived access token as long as a user's approval remains valid.\n     *\n     * Online - will return a short-lived access_token\n     */\n    'accessType' =\u003e env('DROPBOX_ACCESS_TYPE', 'offline'),\n\n    /*\n    set the scopes to be used\n    */\n    'scopes' =\u003e 'account_info.read files.metadata.write files.metadata.read files.content.write files.content.read',\n];\n```\n\n## Migration\nYou can publish the migration with:\n\nphp artisan vendor:publish --provider=\"Dcblogdev\\Dropbox\\DropboxServiceProvider\" --tag=\"migrations\"\nAfter the migration has been published you can create the tokens tables by running the migration:\n\n```\nphp artisan migrate\n```\n\n.ENV Configuration\nEnsure you've set the following in your .env file:\n\n```\nDROPBOX_CLIENT_ID=\nDROPBOX_SECRET_ID=\nDROPBOX_OAUTH_URL=https://domain.com/dropbox/connect\nDROPBOX_LANDING_URL=https://domain.com/dropbox\nDROPBOX_ACCESS_TYPE=offline\n```\n\nBypass Oauth2\nYou can bypass the oauth2 process by generating an access token in your dropbox app and entering it on the .env file:\n\n```\nDROPBOX_ACCESS_TOKEN=\n```\n\n## Usage\nNote this package expects a user to be logged in.\n\nNote: these examples assume the authentication is using the oauth2 and not setting the access token in the .env directly.\n\nIf setting the access code directly don't rely on Dropbox::getAccessToken()\n\nA routes example:\n\n```php\nRoute::group(['middleware' =\u003e ['web', 'auth']], function(){\n    Route::get('dropbox', function(){\n\n        if (! Dropbox::isConnected()) {\n            return redirect(env('DROPBOX_OAUTH_URL'));\n        } else {\n            //display your details\n            return Dropbox::post('users/get_current_account');\n        }\n\n    });\n\n    Route::get('dropbox/connect', function(){\n        return Dropbox::connect();\n    });\n\n    Route::get('dropbox/disconnect', function(){\n        return Dropbox::disconnect('app/dropbox');\n    });\n\n});\n```\n\nOr using a middleware route, if the user does not have a graph token then automatically redirect to get authenticated:\n\n```php\nRoute::group(['middleware' =\u003e ['web', 'DropboxAuthenticated']], function(){\n    Route::get('dropbox', function(){\n        return Dropbox::post('users/get_current_account');\n    });\n});\n\nRoute::get('dropbox/connect', function(){\n    return Dropbox::connect();\n});\n\nRoute::get('dropbox/disconnect', function(){\n    return Dropbox::disconnect('app/dropbox');\n});\n```\n\nOnce authenticated you can call Dropbox:: with the following verbs:\n\n```php\nDropbox::get($endpoint, $array = [], $headers = [], $useToken = true)\nDropbox::post($endpoint, $array = [], $headers = [], $useToken = true)\nDropbox::put($endpoint, $array = [], $headers = [], $useToken = true)\nDropbox::patch($endpoint, $array = [], $headers = [], $useToken = true)\nDropbox::delete($endpoint, $array = [], $headers = [], $useToken = true)\n```\n\nThe $array is not always required, its requirement is determined from the endpoint being called, see the API documentation for more details.\n\nThe $headers are optional when used can pass in additional headers.\n\nThe $useToken is optional when set to true will use the authorisation header, defaults to true.\n\nThese expect the API endpoints to be passed, the URL https://api.dropboxapi.com/2/ is provided, only endpoints after this should be used ie:\n\n```php\nDropbox::post('users/get_current_account')\n```\n\n## Middleware\nTo restrict access to routes only to authenticated users there is a middleware route called DropboxAuthenticated\n\nAdd DropboxAuthenticated to routes to ensure the user is authenticated:\n\n```php\nRoute::group(['middleware' =\u003e ['web', 'DropboxAuthenticated'], function()\n```\n\nTo access the token model reference this ORM model:\n\n```php\nuse Dcblogdev\\Dropbox\\Models\\DropboxToken;\n```\n\n## Files\n\nThis package provides a clean way of working with files.\n\nTo work with files first call -\u003efiles() followed by a method.\n\nImport Namespace\n\n```php\nuse Dcblogdev\\Dropbox\\Facades\\Dropbox;\n```\n\nList Content\n\nlist files and folders of a given path\n\n```php\nDropbox::files()-\u003elistContents($path = '')\n```\n\nList Content Continue\n\nUsing a cursor from the previous listContents call to paginate over the next set of folders/files.\n\n```php\nDropbox::files()-\u003elistContentsContinue($cursor = '')\n```\n\nDelete folder/file\nPass the path to the file/folder, When delting a folder all child items will be deleted.\n\n```php\nDropbox::files()-\u003edelete($path)\n```\n\nCreate Folder\nPass the path to the folder to be created.\n\n```php\nDropbox::files()-\u003ecreateFolder($path)\n```\n\nSearch Files\nEach word will used to search for files.\n\n```php\nDropbox::files()-\u003esearch($query)\n```\n\nUpload File\nUpload files to Dropbox by passing the folder path followed by the filename. Note this method supports uploads up to 150MB only.\n\n```php\nDropbox::files()-\u003eupload($path, $file)\n```\n\nDownload File\nDownload file from Dropbox by passing the folder path including the file.\n\n```php\nDropbox::files()-\u003edownload($path)\n```\n\nMove Folder/File\nMove accepts 4 params:\n\n$fromPath - provide the path for the existing folder/file\n$toPath - provide the new path for the existing golder/file must start with a /\n$autoRename - If there's a conflict, have the Dropbox server try to autorename the file to avoid the conflict. The default for this field is false.\n$allowOwnershipTransfer - Allow moves by owner even if it would result in an ownership transfer for the content being moved. This does not apply to copies. The default for this field is false.\n\n```php\nDropbox::files()-\u003emove($fromPath, $toPath, $autoRename = false, $allowOwnershipTransfer = false);\n```\n\n## Change log\n\nPlease see the [changelog][3] for more information on what has changed recently.\n\n## Contributing\n\nContributions are welcome and will be fully credited.\n\nContributions are accepted via Pull Requests on [Github][4].\n\n## Pull Requests\n\n- **Document any change in behaviour** - Make sure the `readme.md` and any other relevant documentation are kept up-to-date.\n\n- **Consider our release cycle** - We try to follow [SemVer v2.0.0][5]. Randomly breaking public APIs is not an option.\n\n- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.\n\n## Security\n\nIf you discover any security related issues, please email dave@dcblog.dev email instead of using the issue tracker.\n\n## License\n\nlicense. Please see the [license file][6] for more information.\n\n[3]:    changelog.md\n[4]:    https://github.com/dcblogdev/laravel-dropbox\n[5]:    http://semver.org/\n[6]:    license.md\n","funding_links":["https://github.com/sponsors/dcblogdev"],"categories":["Popular Packages"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcblogdev%2Flaravel-dropbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcblogdev%2Flaravel-dropbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcblogdev%2Flaravel-dropbox/lists"}