/PHP-Github-issues-report

Create a Github issue in a repository from PHP proyect

Primary LanguagePHPMIT LicenseMIT

GitHub repo size GitHub code size in bytes Packagist Downloads Packagist License Packagist Version Packagist PHP Version Support GitHub issues GitHub commit activity

PHP Github Issues Report

First steeps

Installation

composer require jruedaq/PHP-Github-issues-report

Basic use

Create Github personal access token

In Developer settings need create a personal access token and set repo permission

For private repositories use, set all repo permission

Create Github token

If need use only public repositories, set public_repo permission

Create Github token

Use library

In your php file call autoload.php

require 'vendor/autoload.php';

Call the function and pass the respective parameters

$issueNumber = PHPGithubIssuesReport::send($owner, $repo, $token, $title, $body);

Complete example

<?php

use jruedaq\GithubIssuesReport\PHPGithubIssuesReport;

require_once '../vendor/autoload.php';

$owner = 'Oneago';                                                          // User or company username
$repo = 'CanvasVoteSystem';                                                 // Repository name
$token = '870082df3998d104ba4164cb07217d5a734bb8fd';                        // Personal access token, get from {@link https://github.com/settings/tokens} with [repo] permission
$title = 'Testing a issue reporting from PHP';                              // Title for new issue
$body = 'This is a description text bellow title in github issues';         // Body description for new issue

try {
    $issueNumber = PHPGithubIssuesReport::send($owner, $repo, $token, $title, $body);
    echo "Created issue #$issueNumber";  // Display issue number
} catch (Exception $e) {
    echo $e->getMessage();
}