1. Go to this page and download the library: Download appopcen/php-spo 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/ */
appopcen / php-spo example snippets
$authCtx = new AuthenticationContext($Url);
$authCtx->acquireTokenForUser($UserName,$Password); //authenticate
$ctx = new ClientContext($Url,$authCtx); //initialize REST client
$web = $ctx->getWeb();
$list = $web->getLists()->getByTitle($listTitle); //init List resource
$items = $list->getItems(); //prepare a query to retrieve from the
$ctx->load($items); //save a query to retrieve list items from the server
$ctx->executeQuery(); //submit query to SharePoint Online REST service
foreach( $items->getData() as $item ) {
print "Task: '{$item->Title}'\r\n";
}