A simple PHP library for managing GitHub repository files using the GitHub API.
Install the library using Composer:
composer require icwr-team/githubcrud
Here's an example of how to use the library:
require 'vendor/autoload.php';
$config = [
'token' => 'YOUR_GITHUB_TOKEN',
'username' => 'YOUR_GITHUB_USERNAME',
'repository' => 'YOUR_REPOSITORY_NAME',
'branch' => 'main' // or any branch name
];
$github = new IcwrTeam\Githubcrud\Githubcrud($config);
// Create a file
$github->createFile('example.txt', 'Hello, World!');
// Edit a file
$github->editFile('example.txt', 'Updated content');
// Read a file
$content = $github->readFile('example.txt');
echo $content;
// Delete a file
$github->deleteFile('example.txt');
- PHP 7.4 or higher
- Composer
This library is open-sourced software licensed under the MIT license.