{"id":19719426,"url":"https://github.com/leapt/flysystem-onedrive","last_synced_at":"2025-09-15T09:07:20.954Z","repository":{"id":58129331,"uuid":"528904978","full_name":"leapt/flysystem-onedrive","owner":"leapt","description":"A flysystem driver for OneDrive that uses the Microsoft Graph API","archived":false,"fork":false,"pushed_at":"2025-08-31T09:36:44.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"1.x","last_synced_at":"2025-08-31T11:36:07.094Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leapt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG-1.x.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2022-08-25T15:13:33.000Z","updated_at":"2025-08-31T09:36:46.000Z","dependencies_parsed_at":"2025-02-27T17:59:39.553Z","dependency_job_id":"92bf5ed7-a21c-4a26-9b8a-8113927c7cda","html_url":"https://github.com/leapt/flysystem-onedrive","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/leapt/flysystem-onedrive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leapt%2Fflysystem-onedrive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leapt%2Fflysystem-onedrive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leapt%2Fflysystem-onedrive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leapt%2Fflysystem-onedrive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leapt","download_url":"https://codeload.github.com/leapt/flysystem-onedrive/tar.gz/refs/heads/1.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leapt%2Fflysystem-onedrive/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275232761,"owners_count":25428237,"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-09-15T02:00:09.272Z","response_time":75,"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-11-11T23:08:16.764Z","updated_at":"2025-09-15T09:07:20.936Z","avatar_url":"https://github.com/leapt.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flysystem adapter for the Microsoft OneDrive API\n\n[![Package version](https://img.shields.io/packagist/v/leapt/flysystem-onedrive.svg?style=flat-square)](https://packagist.org/packages/leapt/flysystem-onedrive)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/leapt/flysystem-onedrive/continuous-integration.yml?branch=1.x\u0026style=flat-square)](https://github.com/leapt/flysystem-onedrive/actions?query=workflow%3A%22Continuous+Integration%22)\n[![PHP Version](https://img.shields.io/packagist/php-v/leapt/flysystem-onedrive.svg?branch=1.x\u0026style=flat-square)](https://travis-ci.org/leapt/flysystem-onedrive?branch=1.x)\n[![License](https://img.shields.io/badge/license-MIT-red.svg?style=flat-square)](LICENSE)\n[![Code coverage](https://img.shields.io/codecov/c/github/leapt/flysystem-onedrive?style=flat-square)](https://codecov.io/gh/leapt/flysystem-onedrive/branch/1.x)\n\nThis package contains a [Flysystem](https://flysystem.thephpleague.com/) adapter for OneDrive. Under the hood, the [Microsoft Graph SDK](https://github.com/microsoftgraph/msgraph-sdk-php) is used.\n\n## Installation\n\nThis package requires PHP 8.3+ and Flysystem v3.\n\nYou can install the package using composer:\n\n```bash\ncomposer require leapt/flysystem-onedrive\n```\n\n## Usage\n\nThe first thing you need to do is get an authorization token for the Microsoft Graph API. \nFor that you need to create an app on the [Microsoft Azure Portal](https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/app-registration?view=odsp-graph-online).\n\n```php\nuse League\\Flysystem\\Filesystem;\nuse Leapt\\FlysystemOneDrive\\OneDriveAdapter;\nuse Microsoft\\Graph\\Graph;\n\n$graph = new Graph();\n$graph-\u003esetAccessToken('EwBIA8l6BAAU7p9QDpi...');\n\n$adapter = new OneDriveAdapter($graph);\n$filesystem = new Filesystem($adapter);\n\n// Or to use the approot endpoint:\n$adapter = new OneDriveAdapter($graph, 'special/approot');\n```\n\n### Retrieve a bearer token\n\nIf you are looking for a way to retrieve a bearer token, here are two examples:\n\n* first example using [Symfony HTTP Client](https://symfony.com/doc/current/http_client.html)\n* second example using [Guzzle](https://github.com/guzzle/guzzle), which is already included as a dependency from Microsoft Graph SDK\n\n#### Using Symfony HTTP Client\n\n```php\n$tenantId = 'your tenant id';\n$clientId = 'your client id';\n$clientSecret = 'your client secret';\n$scope = 'https://graph.microsoft.com/.default';\n$oauthUrl = sprintf('https://login.microsoftonline.com/%s/oauth2/v2.0/token', $tenantId);\n\n$client = \\Symfony\\Component\\HttpClient\\HttpClient::create();\n$response = $client-\u003erequest('GET', $oauthUrl, ['body' =\u003e [\n    'client_id'     =\u003e $clientId,\n    'scope'         =\u003e $scope,\n    'grant_type'    =\u003e 'client_credentials',\n    'client_secret' =\u003e $clientSecret,\n]]);\n$bearerToken = $response-\u003etoArray()['access_token'];\n```\n\n#### Using Guzzle\n\n```php\n$tenantId = 'your tenant id';\n$clientId = 'your client id';\n$clientSecret = 'your client secret';\n$scope = 'https://graph.microsoft.com/.default';\n$oauthUrl = sprintf('https://login.microsoftonline.com/%s/oauth2/v2.0/token', $tenantId);\n\n$client = new \\GuzzleHttp\\Client();\n$response = $client-\u003erequest('POST', $oauthUrl, ['form_params' =\u003e [\n    'client_id'     =\u003e $clientId,\n    'scope'         =\u003e $scope,\n    'grant_type'    =\u003e 'client_credentials',\n    'client_secret' =\u003e $clientSecret,\n]]);\n$bearerToken = json_decode((string) $response-\u003egetBody(), true)['access_token'];\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG-1.x.md) for more information what has changed recently.\n\n## Contributing\n\nFeel free to contribute, like sending [pull requests](https://github.com/leapt/flysystem-onedrive/pulls) to add features/tests\nor [creating issues](https://github.com/leapt/flysystem-onedrive/issues) :)\n\nNote there are a few helpers to maintain code quality, that you can run using these commands:\n\n```bash\ncomposer cs:dry # Code style check\ncomposer phpstan # Static analysis\nvendor/bin/phpunit # Run tests\n```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\nHistory\n-------\n\nThis bundle is a maintained fork of the packages [nicolasbeauvais](https://github.com/nicolasbeauvais/flysystem-onedrive) \nand [hevelius](https://github.com/hevelius/flysystem-onedrive).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleapt%2Fflysystem-onedrive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleapt%2Fflysystem-onedrive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleapt%2Fflysystem-onedrive/lists"}