veiliglanceren / laravel-github-file
Laravel package to fetch and manage files from GitHub repositories.
Requires
- php: ^8.1
- ext-zip: *
- laravel/framework: ^10.0 | ^11.0 | ^12.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.0
- mockery/mockery: ^1.6
- orchestra/testbench: ^8.0 || ^9.0 || ^10.0
- pestphp/pest: ^2.0 || ^3.0
- pestphp/pest-plugin-laravel: ^2.0 || ^3.0
This package is not auto-updated.
Last update: 2025-05-19 13:09:24 UTC
README
This package is maintained by VeiligLanceren.nl, your partner in website development and everything else to power up your online company.
Laravel Github File
Laravel GitHub File
A Laravel package to fetch, download, and zip files from GitHub repositories.
Installation
Install the package via Composer:
composer require veiliglanceren/laravel-github-file
Configuration
Publish the configuration file (optional):
php artisan vendor:publish --provider="VeiligLanceren\GithubFile\GithubFileServiceProvider"
This will create a config/github-file.php
file where you can customize settings like the default disk.
Usage
Fetch File Content
Retrieve the content of a file from a GitHub repository:
use VeiligLanceren\GithubFile\Facades\GithubFile; $content = GithubFile::get('owner/repo', 'path/to/file.txt');
Download a File
Download a file and store it locally:
$path = GithubFile::download('owner/repo', 'path/to/file.txt');
This will store the file in the default disk's downloads
directory.
Create a ZIP Archive
Create a ZIP archive containing a file from a GitHub repository:
$zipPath = GithubFile::zip('owner/repo', 'path/to/file.txt');
The ZIP file will be stored in the default disk's zips
directory. Or zip multiple files at the same times.
$zipPath = GithubFile::zip('owner/repo', ['path/to/file.txt', 'path/to/file2.txt']);
Testing
Run the tests using Pest:
./vendor/bin/pest
Ensure that your environment is set up correctly and that all dependencies are installed.
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
Please ensure that your code adheres to the project's coding standards and passes all tests.
License
This package is open-source software licensed under the MIT license.