Skip to content

AdnanHussainTurki/Gist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Artboard 1

Gist

PHP API wrapper for Gist.

Installation

Install this package to your PHP project via composer:

composer require adnanhussainturki/gist

Manage Gists at your Backend

  • List all your Gists
  • Create Gist
  • View Gist
  • Edit Gist
  • Delete Gist
  • View Public Gists (Can be viewed using unauthenticated Gist)

<?php

use myPHPnotes\Gist;
use myPHPnotes\GistObject;

require_once "../Gist.php";
require_once "../GistObject.php";

$gist = new Gist();


$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 -->


?>

Built in India


Just a helper project by Adnan Hussain Turki.

Contributors are gratefully welcome.. :).