Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jprodrigues70/laravel-ghass
Use github as storage. Upload files to GitHub with Laravel.
https://github.com/jprodrigues70/laravel-ghass
file-manager fileserver filesystem fileupload git github laravel php server serverless
Last synced: 4 days ago
JSON representation
Use github as storage. Upload files to GitHub with Laravel.
- Host: GitHub
- URL: https://github.com/jprodrigues70/laravel-ghass
- Owner: jprodrigues70
- License: mit
- Created: 2020-05-09T00:07:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-02T00:53:22.000Z (almost 4 years ago)
- Last Synced: 2024-04-19T13:21:12.238Z (7 months ago)
- Topics: file-manager, fileserver, filesystem, fileupload, git, github, laravel, php, server, serverless
- Language: PHP
- Homepage:
- Size: 19.5 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GHASS
GHASS is a PHP GitHub API client that makes it easy to manage files in a GitHub repository (privated or public).
### Getting Started
```
composer require jprodrigues70/laravel-ghass
```#### Configure your .env file
```
GHASS_REPO=organization/project
GHASS_TOKEN=yourgithubaccesstoken
GHASS_BRANCH=master
```#### Usage
```php
file('index.html');
$ghass->delete('index.html', $data['sha']);```
#### Sha
Sha is a code that identifies files, folders, etc. on Github. It is extremely necessary in PUT, DELETE and GET operations.
If you want to use Ghass to manage files larger than 1 megabyte, you will need to store the sha key for each file in some type of database. If you are going to manage files up to 1 megabyte, you can use the Ghass `file` method to get the contents of the file and also the sha.
#### File
Gets the contents of a file in a repository. This method supports files up to 1 megabyte in size.
```
$ghass->file($path);
```#### GET
Get the contents of a file in a repository. The content in the response will always be Base64 encoded. This method supports files up to 100 megabytes in size.
```
$ghass->get($sha);
```#### POST
Creates a new file in a repository. It requires a Base64 encoded data.
`$commitMessage` is optional.
```
$ghass->post($path, $data, $commitMessage);
```#### PUT
Updates an existing file in a repository. It requires a Base64 encoded data.
PUT CAN'T RENAME FILES. If you want to rename a file, you will need to delete the previous and create the newer.
`$commitMessage` is optional.
```
$ghass->put($path, $data, $sha, $commitMessage = '');
```#### DELETE
Deletes a file in a repository.
`$commitMessage` is optional.
```
$ghass->delete($path, $sah, $commitMessage = '');
```