1. Go to this page and download the library: Download juniyadi/laravel-github-api 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/ */
use JuniYadi\GitHub\Github;
public function __construct(Github $github) {
$this->github = $github;
}
public function show() {
return $this->github->user()->me();
}
use JuniYadi\GitHub\Facades\Github;
// Upload multiple files in a single commit
$files = [
[
'file' => 'path/to/file1.txt',
'content' => 'File 1 content'
],
[
'file' => 'path/to/file2.txt',
'content' => 'File 2 content'
]
];
// Upload files with a single commit
$result = Github::repo()->uploadBulkBlob('owner/repo', 'main', $files, 'Bulk upload commit message');
// Delete multiple files or directories in a single commit
$filesToDelete = [
'path/to/file1.txt',
'path/to/directory', // Will delete directory and all contents
'path/to/file2.txt'
];
$result = Github::repo()->deleteBulkBlob('owner/repo', 'main', $filesToDelete, 'Bulk delete commit message');