PHP code example of adnanhussainturki / gist

1. Go to this page and download the library: Download adnanhussainturki/gist 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/ */

    

adnanhussainturki / gist example snippets




use myPHPnotes\Gist;
use myPHPnotes\GistObject;



$authorisedGist = new Gist("AdnanHussainTurki", "ddbfd0fb1c955cc3aa7a539cff359ed43d5185ba");


<!-- List All Public Gists -->
$page = 1;
$perPage = 100;
$gist->getPublicGists($page, $perPage);
<!-- All Public Gists Pulled as JSON -->


<!-- Creating Gist -->
$GistObject = new GistObject("TEST", true);
$GistObject->addContent("test.txt", "This is a dfdasf test");
$GistObject->addContent("test2.txt", "This is a dasfdasf test");
$GistObject->addContent("test.txt", "This is a adsfewwe test");
$authorisedGist->create($GistObject); // ID of the Gist will be returned in JSON
<!-- Gist Created -->

<!-- Editing Gist -->
$GistObject = new GistObject("TEST", true);
$GistObject->addContent("test.txt", "This is a edited dfdasf test");
$GistObject->addContent("test2.txt", "This is a edited dasfdasf test");
$GistObject->addContent("test.txt", "This is a edited adsfewwe test");
$authorisedGist->edit( "<--ID_OF_GIST_TO_BE_EDITED-->", $GistObject); // ID of the Gist will be returned in JSON
<!-- Gist Edited -->

<!-- Deleting Gist -->
$authorisedGistObject->delete("ID_OF_THE_GIST");
<!-- Gist Deleted -->

<!-- My Gists -->
$page = 1;
$perPage = 100;
$gist->myGists($page, $perPage); 
<!-- My Gist Pulled as JSON -->