Download the PHP package valter-medeiros/laravel-sharepoint without Composer
On this page you can find all versions of the php package valter-medeiros/laravel-sharepoint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download valter-medeiros/laravel-sharepoint
More information about valter-medeiros/laravel-sharepoint
Files in valter-medeiros/laravel-sharepoint
Package laravel-sharepoint
Short Description A Laravel filesystem driver for SharePoint and OneDrive using Microsoft Graph API with support for certificates.
License MIT
Homepage https://github.com/valtermedeiros/laravel-sharepoint
Informations about the package laravel-sharepoint
Laravel SharePoint Filesystem Driver
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
- Fully integrates with Laravel's
Storagefacade. - 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
.pfxfiles so they are decrypted on-the-fly in memory, keeping your server secure even if compromised.
Requirements
- PHP >= 8.1
- Laravel >= 10.0
- A Microsoft Azure Active Directory (Entra ID) App Registration with Graph API permissions (
Files.ReadWrite.All,Sites.ReadWrite.All).
Installation
You can install the package via composer:
Configuration
-
Open your
config/filesystems.phpfile and add thesharepointdisk to thedisksarray: - Add the corresponding variables to your
.envfile:
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.
- Upload your
.pfxfile to your server temporarily. -
Run the encryption command:
- This will generate a new file named
certificate.pfx.enc. - Delete the original
.pfxfile from your server. - Update your
.envfile to point to the new.encfile:
Usage
Once configured, you can use the disk just like any other Laravel storage disk:
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)
-
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
- Example:
-
Add this Site ID to your
.envfile: - Run the list-drives command:
(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:
- 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
.envfile:
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:
You can also search for a specific folder by name, or look inside a specific path:
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
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-sharepoint with dependencies
ext-openssl Version *
guzzlehttp/guzzle Version ^7.0
illuminate/cache Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/filesystem Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
league/flysystem Version ^3.0