https://github.com/delaneymethod/flysystem-sharepoint
A flysystem driver for Sharepoint API built using PHP.
https://github.com/delaneymethod/flysystem-sharepoint
php
Last synced: 7 months ago
JSON representation
A flysystem driver for Sharepoint API built using PHP.
- Host: GitHub
- URL: https://github.com/delaneymethod/flysystem-sharepoint
- Owner: delaneymethod
- License: mit
- Created: 2018-04-03T11:26:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-10-18T11:14:44.000Z (over 4 years ago)
- Last Synced: 2025-11-15T06:11:13.246Z (8 months ago)
- Topics: php
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 7
- Watchers: 0
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Flysystem adapter for the Sharepoint API
[](https://packagist.org/packages/delaneymethod/flysystem-sharepoint)
[](https://packagist.org/packages/delaneymethod/flysystem-sharepoint)
This package contains a [Flysystem](https://flysystem.thephpleague.com/) adapter for Sharepoint 2013 REST API. Under the hood, the [Sharepoint 2013 REST API](https://www.dropbox.com/developers/documentation/http/overview) is used.
## Installation
You can install the package via composer:
``` bash
composer require delaneymethod/flysystem-sharepoint
```
## Usage
The first thing you need to do is get an authorisation token from Sharepoint. Sharepoint has made this very easy. You can register a new App within your Sharepoint Site that can be used to generate a client ID and Secret. You'll find more info at [Authorizing REST API calls against SharePoint Site](http://spshell.blogspot.co.uk/2015/03/sharepoint-online-o365-oauth.html).
You can read the whole article for additional knowledge but the first step is the only step you're interested in for our flysystem-sharepoint adapter to work.
With an authorisation token you can instantiate a `DelaneyMethod\Sharepoint\Client`.
``` php
use League\Flysystem\Filesystem;
use DelaneyMethod\Sharepoint\Client as SharepointClient;
use DelaneyMethod\FlysystemSharepoint\SharepointAdapter;
$siteName = 'YOUR_TEAM_SITE_NAME';
$siteUrl = 'https://YOUR_SITE.sharepoint.com';
$publicUrl = 'https://YOUR_SITE.sharepoint.com/:i:/r/sites/YOUR_TEAM_SITE_NAME/Shared%20Documents'
$clientId = 'YOUR_CLIENT_ID';
$clientSecret = 'YOUR_CLIENT_SECRET';
$verify = false; // See http://docs.guzzlephp.org/en/stable/request-options.html#verify
$accessToken = 'YOUR_ACCESS_TOKEN';
$client = new SharepointClient($siteName, $siteUrl, $publicUrl, $clientId, $clientSecret, $verify, $accessToken);
$adapter = new SharepointAdapter($client);
$filesystem = new Filesystem($adapter, ['url' => $publicUrl]);
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
```
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email hello@delaneymethod.com instead of using the issue tracker.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.