PHP code example of jakub-klapka / laravel-sharepoint-upload-client

1. Go to this page and download the library: Download jakub-klapka/laravel-sharepoint-upload-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jakub-klapka / laravel-sharepoint-upload-client example snippets


\JakubKlapka\LaravelSharepointUploadClient\LaravelSharepointUploadProvider::class

class Controller {

	protected $sharepointClient;

	public function __construct( \JakubKlapka\LaravelSharepointUploadClient\Factories\ClientFactory $sharepointClient ) {
		$this->sharepointClient = $sharepointClient;
	}
	
	public function upload() {
		$client = $this->sharepointClient->makeClient( $site_url, $app_id, $app_secret, $redirect_uri );
	}

}

$url = $client->getUserConsentUri()

$auth_code = $_REQUEST['code'];
$refreshToken = $client->getRefreshTokenFromAuthCode( $auth_code );

$upload_result = $client->uploadFile(
	$refresh_token,
	'/sites/mySite/myLibrary/',
	'file.txt',
	$this->transfer_storage->readStream( 'file.txt' )
);