Getting 403 Forbidden in SharePoint 365 PHP Rest API

I am using PHP rest API in SharePoint 365 to upload the file, I am using SharePoint-OAuth-app-client library ( In that I got accesstoken but when I try to execute folder list code I getting 403 error.

//Working code

require 'vendor/autoload.php';

use WeAreArchitectSharePointSPException;
use WeAreArchitectSharePointSPList;
use WeAreArchitectSharePointSPSite;
use WeAreArchitectSharePointSPFile;
use WeAreArchitectSharePointSPFolder;

try {
    $settings = [
        'site' => [
            'resource'  => '00000000-0000-ffff-0000-000000000000/',
            'client_id' => '52848cad-bc13-4d69-a371-30deff17bb4d/',
            'secret'    => 'YzcZQ7N4lTeK5COin/nmNRG5kkL35gAW1scrum5mXVgE=',

    // create a SharePoint Site instance
    $site = SPSite::create('', $settings);

    // generate an Access Token (App-only Policy)

//Error From here

// get a Folder by relative URL
    $folder = SPFolder::getByRelativeUrl($site, 'myFolder');

    // get a List by title
    $folder = SPList::getByTitle($site, 'My List');

    // get all the Files from the Folder/List we just got
    $files = SPFile::getAll($folder);

    // do something with the files
    foreach ($files as $file) {

Please help me to solve this issue.
Thanks in Advanced

Source: stackoverflow-php