PHPackages                             saeedvir/laravel-gist-storage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. saeedvir/laravel-gist-storage

ActiveLibrary[File &amp; Storage](/categories/file-storage)

saeedvir/laravel-gist-storage
=============================

Laravel Storage driver for GitHub Gist - Store files on GitHub Gist using Laravel's Storage facade

v1.0.0(5mo ago)06MITPHPPHP ^8.1|^8.2|^8.3

Since Nov 22Pushed 5mo agoCompare

[ Source](https://github.com/saeedvir/laravel-gist-storage)[ Packagist](https://packagist.org/packages/saeedvir/laravel-gist-storage)[ RSS](/packages/saeedvir-laravel-gist-storage/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

Laravel Gist Storage
====================

[](#laravel-gist-storage)

[![PHP Version](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)](https://php.net)[![Laravel Version](https://camo.githubusercontent.com/391257e76c9420905a4f88825c9d116b09f985aa5eb286e2b062372cd66031f1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313125323025374325323031322d726564)](https://laravel.com)[![License](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](LICENSE.md)

A powerful Laravel storage driver that enables you to store and manage files on GitHub Gist using Laravel's familiar Storage facade. Turn GitHub Gist into a free, reliable cloud storage solution for your Laravel applications.

📦 Package Summary
-----------------

[](#-package-summary)

This package provides a **Flysystem v3** adapter for GitHub Gist, seamlessly integrating with Laravel's filesystem. Store files, images, JSON data, or any text-based content directly to GitHub Gist using the same Storage API you already know.

### What is GitHub Gist Storage?

[](#what-is-github-gist-storage)

GitHub Gist is a service that allows you to share code snippets and files. This package transforms Gist into a fully-functional storage backend for Laravel applications, giving you:

- **Free cloud storage** backed by GitHub's infrastructure
- **Version control** for all your stored files
- **Public or private** file storage options
- **CDN-ready URLs** for direct file access
- **No additional infrastructure** costs or setup

### Core Features

[](#core-features)

✅ **Laravel Storage Facade Integration** - Use `Storage::disk('gist')` just like any other disk
✅ **Auto-Create Gists** - Automatically create new gists without pre-configuring a GIST\_ID
✅ **Flysystem v3 Compatible** - Modern, PSR-compliant filesystem adapter
✅ **Full CRUD Operations** - Read, write, update, delete, list, and manage files
✅ **Stream Support** - Handle large files with PHP streams
✅ **Livewire Compatible** - Upload files directly from Livewire components
✅ **Zero Dependencies** - Pure PHP implementation using only cURL
✅ **Smart Caching** - Reduces API calls with intelligent metadata caching
✅ **Laravel 11 &amp; 12** - Full support for the latest Laravel versions
✅ **PHP 8.1+** - Modern PHP features and type safety

🚀 Key Benefits
--------------

[](#-key-benefits)

### 1. **Zero Infrastructure Costs**

[](#1-zero-infrastructure-costs)

No need for AWS S3, DigitalOcean Spaces, or other paid storage services. GitHub Gist is completely free and reliable.

### 2. **Instant Setup**

[](#2-instant-setup)

Just add your GitHub token, and you're ready to go. No complex configurations or third-party accounts.

### 3. **Developer-Friendly**

[](#3-developer-friendly)

Use the same Laravel Storage API you already know:

```
Storage::disk('gist')->put('file.txt', 'content');
$content = Storage::disk('gist')->get('file.txt');
```

### 4. **Version Control Built-In**

[](#4-version-control-built-in)

Every change to your files is tracked by GitHub. View file history, rollback changes, and audit modifications.

### 5. **Public URL Access**

[](#5-public-url-access)

Get direct CDN-backed URLs for your files, perfect for sharing images, JSON APIs, or configuration files.

### 6. **Automatic Gist Creation**

[](#6-automatic-gist-creation)

Don't have a Gist ID? Enable `auto_create` and the package will create one for you on first upload.

### 7. **Production-Ready**

[](#7-production-ready)

- Comprehensive error handling with Laravel exceptions
- Token format validation to catch configuration errors early
- Smart cache invalidation to keep metadata synchronized
- Stream position handling for reliable large file uploads

### 8. **Multiple Use Cases**

[](#8-multiple-use-cases)

- **Configuration Storage** - Store app configs, feature flags, or environment settings
- **Static Content** - Host JSON data, CSV files, or text documents
- **User Uploads** - Handle file uploads from Livewire or controller forms
- **Public APIs** - Share data files with public gist URLs
- **Backup Storage** - Store database dumps, logs, or backup files
- **CDN Alternative** - Serve small assets without CDN costs

📥 Installation
--------------

[](#-installation)

```
composer require saeedvir/laravel-gist-storage
```

⚡ Quick Start
-------------

[](#-quick-start)

### 1. Configure Your Environment

[](#1-configure-your-environment)

Add to your `.env` file:

```
GIST_TOKEN=ghp_your_github_personal_access_token
GIST_AUTO_CREATE=true  # Auto-create gist (no GIST_ID needed)
# OR
GIST_ID=your_existing_gist_id  # Use existing gist
```

**Get your token:**  (requires `gist` scope)

### 2. Add Disk Configuration

[](#2-add-disk-configuration)

In `config/filesystems.php`:

```
'disks' => [
    'gist' => [
        'driver' => 'gist',
        'token' => env('GIST_TOKEN'),
        'gist_id' => env('GIST_ID'),  // Optional if auto_create is true
        'auto_create' => env('GIST_AUTO_CREATE', false),
        'public' => false,
        'description' => 'Laravel Gist Storage',
    ],
],
```

### 3. Start Using It!

[](#3-start-using-it)

```
use Illuminate\Support\Facades\Storage;

// Write a file
Storage::disk('gist')->put('hello.txt', 'Hello from Laravel!');

// Read a file
$content = Storage::disk('gist')->get('hello.txt');

// Check if file exists
if (Storage::disk('gist')->exists('hello.txt')) {
    echo 'File exists!';
}

// Get file size
$size = Storage::disk('gist')->size('hello.txt');

// List all files
$files = Storage::disk('gist')->files();

// Delete a file
Storage::disk('gist')->delete('hello.txt');

// Get the auto-created gist ID
$gistId = Storage::disk('gist')->getAdapter()->getGistId();
```

📚 Documentation
---------------

[](#-documentation)

- **[INSTALLATION.md](INSTALLATION.md)** - Detailed setup and configuration guide
- **[QUICKSTART.md](QUICKSTART.md)** - 5-minute quick start tutorial
- **[PACKAGE-SUMMARY.md](PACKAGE-SUMMARY.md)** - Complete technical documentation
- **[examples/](examples/)** - Ready-to-use code examples for common scenarios

🔧 Usage Examples
----------------

[](#-usage-examples)

### Upload from Livewire Component

[](#upload-from-livewire-component)

```
use Livewire\Component;
use Livewire\WithFileUploads;

class FileUploader extends Component
{
    use WithFileUploads;

    public $file;

    public function save()
    {
        $this->validate(['file' => 'required|file|max:10240']);

        $path = $this->file->store('uploads', 'gist');

        session()->flash('message', 'File uploaded to Gist!');
    }
}
```

### Store JSON Data

[](#store-json-data)

```
$data = ['users' => 1000, 'status' => 'active'];
Storage::disk('gist')->put('stats.json', json_encode($data));

// Retrieve and decode
$stats = json_decode(Storage::disk('gist')->get('stats.json'), true);
```

### Handle Streams

[](#handle-streams)

```
$stream = fopen('large-file.txt', 'r');
Storage::disk('gist')->writeStream('backup.txt', $stream);
fclose($stream);
```

🎯 Requirements
--------------

[](#-requirements)

- **PHP:** 8.1, 8.2, or 8.3
- **Laravel:** 11.x or 12.x
- **Extensions:** `ext-curl`, `ext-json`
- **GitHub:** Personal Access Token with `gist` scope

🛡️ Security
-----------

[](#️-security)

- Store your `GIST_TOKEN` securely in `.env` - never commit it
- Use private gists for sensitive data
- Token format validation prevents invalid credentials
- All API requests use HTTPS with SSL verification

See [SECURITY.md](SECURITY.md) for security policy and reporting vulnerabilities.

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

📝 License
---------

[](#-license)

MIT License - see [LICENSE.md](LICENSE.md) for details.

👤 Author
--------

[](#-author)

**Saeedvir**
GitHub: [@saeedvir](https://github.com/saeedvir)
Email:

⭐ Support
---------

[](#-support)

If this package helps your project, please consider giving it a star on GitHub!

---

**Made with ❤️ for the Laravel community**

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance70

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

172d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fb63dbbcce86ecd5af69b654e2d4a30ec7b9a7e19985accc6510413e04627cb2?d=identicon)[saeedvir](/maintainers/saeedvir)

---

Top Contributors

[![saeedvir](https://avatars.githubusercontent.com/u/8615309?v=4)](https://github.com/saeedvir "saeedvir (12 commits)")

---

Tags

laravellaravel-filesystemphpstoragefilesystemFlysystemlaravelstoragegithublivewiregist

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/saeedvir-laravel-gist-storage/health.svg)

```
[![Health](https://phpackages.com/badges/saeedvir-laravel-gist-storage/health.svg)](https://phpackages.com/packages/saeedvir-laravel-gist-storage)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)[zing/laravel-flysystem-obs

Flysystem Adapter for OBS

1211.2k](/packages/zing-laravel-flysystem-obs)[sausin/laravel-ovh

OVH Object Storage driver for laravel

40153.5k](/packages/sausin-laravel-ovh)[jerodev/flysystem-v3-smb-adapter

SMB adapter for Flysystem v3

1289.9k1](/packages/jerodev-flysystem-v3-smb-adapter)[innoge/laravel-rclone

A sleek PHP wrapper around rclone with Laravel-style fluent API syntax

174.1k](/packages/innoge-laravel-rclone)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
