PHPackages                             valter-medeiros/laravel-sharepoint - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. valter-medeiros/laravel-sharepoint

ActiveLibrary[File &amp; Storage](/categories/file-storage)

valter-medeiros/laravel-sharepoint
==================================

A Laravel filesystem driver for SharePoint and OneDrive using Microsoft Graph API with support for certificates.

v1.0.0(1mo ago)10MITPHPPHP ^8.1CI passing

Since Jul 13Pushed 1mo agoCompare

[ Source](https://github.com/valtermedeiros/laravel-sharepoint)[ Packagist](https://packagist.org/packages/valter-medeiros/laravel-sharepoint)[ Docs](https://github.com/valtermedeiros/laravel-sharepoint)[ RSS](/packages/valter-medeiros-laravel-sharepoint/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

Laravel SharePoint Filesystem Driver
====================================

[](#laravel-sharepoint-filesystem-driver)

[![Tests](https://github.com/valtermedeiros/laravel-sharepoint/actions/workflows/tests.yml/badge.svg)](https://github.com/valtermedeiros/laravel-sharepoint/actions/workflows/tests.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/4c6e4cf6f2d6eb0e10469dc03a4c69ad8683afaac249ba2790fcf1feeab52644/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76616c7465722d6d65646569726f732f6c61726176656c2d7368617265706f696e742e737667)](https://packagist.org/packages/valter-medeiros/laravel-sharepoint)[![License](https://camo.githubusercontent.com/0765e653daf57f39011d1dee85601884b1f9622a82f9e539b69fd3446ea9b670/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f76616c7465722d6d65646569726f732f6c61726176656c2d7368617265706f696e742e737667)](https://packagist.org/packages/valter-medeiros/laravel-sharepoint)

A Flysystem V3 adapter for Laravel that allows you to use Microsoft SharePoint and OneDrive as a storage disk via the Microsoft Graph API.

This package includes a unique **secure certificate handler** that allows you to encrypt your `.pfx` certificates using Laravel's built-in encryption, ensuring your private keys are never stored in plaintext on your server.

Features
--------

[](#features)

- Fully integrates with Laravel's `Storage` facade.
- Supports all standard Flysystem operations (read, write, delete, list, move, copy).
- Authenticates via Microsoft Graph API (OAuth2 Client Credentials flow).
- Supports both Client Secret and Certificate (`.pfx`) authentication.
- **Secure Certificate Storage**: Encrypt your `.pfx` files so they are decrypted on-the-fly in memory, keeping your server secure even if compromised.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Laravel &gt;= 10.0
- A Microsoft Azure Active Directory (Entra ID) App Registration with Graph API permissions (`Files.ReadWrite.All`, `Sites.ReadWrite.All`).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require valter-medeiros/laravel-sharepoint
```

Configuration
-------------

[](#configuration)

1. Open your `config/filesystems.php` file and add the `sharepoint` disk to the `disks` array:

```
'disks' => [
    // ... other disks

    'sharepoint' => [
        'driver' => 'sharepoint',
        'tenant_id' => env('SHAREPOINT_TENANT_ID'),
        'client_id' => env('SHAREPOINT_CLIENT_ID'),

        // Use EITHER client_secret OR certificate_path
        'client_secret' => env('SHAREPOINT_CLIENT_SECRET'),

        // Certificate Authentication (Recommended for production)
        'certificate_path' => env('SHAREPOINT_CERTIFICATE_PATH'), // Path to .pfx or .pfx.enc
        'certificate_password' => env('SHAREPOINT_CERTIFICATE_PASSWORD'), // Password for the .pfx

        // Optional Configuration
        'drive_id' => env('SHAREPOINT_DRIVE_ID'), // Specific drive ID. If null, uses the default drive.
        'prefix' => env('SHAREPOINT_PREFIX', ''), // Optional path prefix
    ],
],
```

2. Add the corresponding variables to your `.env` file:

```
SHAREPOINT_TENANT_ID="your-azure-tenant-id"
SHAREPOINT_CLIENT_ID="your-azure-client-id"

# If using a Client Secret:
SHAREPOINT_CLIENT_SECRET="your-client-secret"

# If using a Certificate (Recommended):
SHAREPOINT_CERTIFICATE_PATH="/absolute/path/to/your/certificate.pfx.enc"
SHAREPOINT_CERTIFICATE_PASSWORD="your-certificate-password"

# Optional
SHAREPOINT_DRIVE_ID="your-drive-id"
SHAREPOINT_PREFIX="Shared Documents"
```

Secure Certificate Authentication (Recommended)
-----------------------------------------------

[](#secure-certificate-authentication-recommended)

Storing `.pfx` certificates in plaintext on your server can be a security risk. This package provides a command to encrypt your certificate using your Laravel `APP_KEY`. The package will decrypt it on-the-fly in memory when authenticating with Microsoft Graph.

1. Upload your `.pfx` file to your server temporarily.
2. Run the encryption command:

```
php artisan sharepoint:encrypt-cert /path/to/your/certificate.pfx
```

3. This will generate a new file named `certificate.pfx.enc`.
4. **Delete the original `.pfx` file from your server.**
5. Update your `.env` file to point to the new `.enc` file:

```
SHAREPOINT_CERTIFICATE_PATH="/path/to/your/certificate.pfx.enc"
SHAREPOINT_CERTIFICATE_PASSWORD="your-certificate-password"
```

Usage
-----

[](#usage)

Once configured, you can use the disk just like any other Laravel storage disk:

```
use Illuminate\Support\Facades\Storage;

// Write a file
Storage::disk('sharepoint')->put('reports/2026/summary.pdf', $pdfContent);

// Read a file
$content = Storage::disk('sharepoint')->get('reports/2026/summary.pdf');

// Check if a file exists
if (Storage::disk('sharepoint')->exists('reports/2026/summary.pdf')) {
    // ...
}

// Delete a file
Storage::disk('sharepoint')->delete('reports/2026/summary.pdf');

// List files in a directory
$files = Storage::disk('sharepoint')->files('reports/2026');

// Create a directory
Storage::disk('sharepoint')->makeDirectory('reports/2027');
```

Finding your Drive ID
---------------------

[](#finding-your-drive-id)

If you don't specify a `SHAREPOINT_DRIVE_ID`, the package will attempt to use the default drive associated with the authenticated application.

To target a specific SharePoint Document Library, you will need its Drive ID. You can find this using the built-in artisan command or Microsoft Graph Explorer.

### Using the Artisan Command (Recommended)

[](#using-the-artisan-command-recommended)

1. First, you need your **Site ID**. You can find this by taking your SharePoint site URL and appending `/_api/site/id/` to it.

    - Example: `https://universidadedosacores.sharepoint.com/sites/MySite/_api/site/id/`
    - The Site ID usually looks like: `universidadedosacores.sharepoint.com,4252a976-98b4-48ae-b79c-abb17b10f02c`
2. Add this Site ID to your `.env` file:

```
SHAREPOINT_SITE_ID="universidadedosacores.sharepoint.com,4252a976-98b4-48ae-b79c-abb17b10f02c"
```

3. Run the list-drives command:

```
php artisan sharepoint:list-drives
```

*(You can also pass the site ID directly to the command: `php artisan sharepoint:list-drives "your-site-id"`)*

You can also search for a specific drive by name:

```
php artisan sharepoint:list-drives --search="ADSR_Cloud"
```

4. The command will output a table of all available document libraries and their Drive IDs. Copy the ID of the library you want to use and add it to your `.env` file:

```
SHAREPOINT_DRIVE_ID="b!..."
```

### Finding a Specific Folder ID (Optional)

[](#finding-a-specific-folder-id-optional)

If you need to find the ID of a specific folder *inside* a drive, you can use the `list-folders` command:

```
php artisan sharepoint:list-folders
```

You can also search for a specific folder by name, or look inside a specific path:

```
php artisan sharepoint:list-folders --search="My Folder"
php artisan sharepoint:list-folders --path="Shared Documents/2026"
```

### Using Microsoft Graph Explorer

[](#using-microsoft-graph-explorer)

Alternatively, you can find your Site ID and Drive ID manually using the Microsoft Graph Explorer. For a detailed guide on how to do this, check out this excellent tutorial: [SharePoint: Find Site ID and Drive IDs - Dave Herrell](https://www.daveherrell.com/sharepoint-find-site-id-and-drive-ids/)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

48d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/07aac12e564ca4be354918756e0ac9dd37ccf65400a33e51b38903cf1c924050?d=identicon)[valtermedeiros](/maintainers/valtermedeiros)

---

Top Contributors

[![valtermedeiros](https://avatars.githubusercontent.com/u/30486588?v=4)](https://github.com/valtermedeiros "valtermedeiros (2 commits)")

---

Tags

filesystemFlysystemlaravelstorageOneDrivesharepointMicrosoft graph

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/valter-medeiros-laravel-sharepoint/health.svg)

```
[![Health](https://phpackages.com/badges/valter-medeiros-laravel-sharepoint/health.svg)](https://phpackages.com/packages/valter-medeiros-laravel-sharepoint)
```

###  Alternatives

[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[laravel/ai

The official AI SDK for Laravel.

1.1k6.4M360](/packages/laravel-ai)[flarum/core

Delightfully simple forum software.

271.5M2.6k](/packages/flarum-core)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

1.0k2.5M152](/packages/roots-acorn)[propaganistas/laravel-disposable-email

Disposable email validator

6093.4M9](/packages/propaganistas-laravel-disposable-email)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.6k31.1M880](/packages/laravel-boost)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
