PHPackages                             shamimstack/youtube-cloud-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. shamimstack/youtube-cloud-storage

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

shamimstack/youtube-cloud-storage
=================================

A Laravel 12 package that turns YouTube into a file storage backend using sign-bit nudging of DCT coefficients and Wirehair fountain codes.

v0.3.0-beta(3mo ago)00MITPHPPHP ^8.4

Since Mar 9Pushed 3mo agoCompare

[ Source](https://github.com/shamimlaravel/youtube-cloud-storage)[ Packagist](https://packagist.org/packages/shamimstack/youtube-cloud-storage)[ RSS](/packages/shamimstack-youtube-cloud-storage/feed)WikiDiscussions main Synced 2w ago

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

YouTube Cloud Storage
=====================

[](#youtube-cloud-storage)

**Transform YouTube into unlimited cloud storage using steganography and fountain codes.**

[![Latest Version](https://camo.githubusercontent.com/c0debaaab05c30b44b0a48af1d794a4457db248dce56f42965f417b08f4ae869/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7368616d696d737461636b2f796f75747562652d636c6f75642d73746f726167652e737667)](https://packagist.org/packages/shamimstack/youtube-cloud-storage)[![PHP 8.4+](https://camo.githubusercontent.com/1583131b76ecae5c367fad8dff78d2251ad33509f99e56100d9b376c565bf970/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e342b2d626c75652e737667)](https://php.net/)[![Laravel 12+](https://camo.githubusercontent.com/9cfd05ac4738796af7ef1f040e3011bdefb364575a3ff1e69a8c917cc28de8c8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31322b2d7265642e737667)](https://laravel.com/)[![License: MIT](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

🚀 Features
----------

[](#-features)

- **Unlimited Storage**: Upload files to YouTube as private videos
- **Steganographic Encoding**: Hide data in DCT coefficient signs (invisible to viewers)
- **Fountain Code Redundancy**: Recover from YouTube's video compression with Wirehair O(N) erasure coding
- **Zero-Config Setup**: Auto-detects FFmpeg, yt-dlp, and compiles Wirehair if needed
- **Laravel Flysystem Integration**: Use `Storage::disk('youtube')` like any other disk
- **Artisan Commands**: CLI tools for upload/download operations
- **Cross-Platform**: Windows, Linux, macOS support
- **Comprehensive Testing**: 30+ test cases with 80%+ code coverage
- **Interactive Documentation**: Modern responsive website with Tailwind CSS

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

[](#-documentation)

- **Quick Start**: [QUICK\_REFERENCE.md](QUICK_REFERENCE.md) - Commands cheat sheet
- **Contributing Guide**: [CONTRIBUTING.md](CONTRIBUTING.md) - How to contribute
- **Change History**: [CHANGELOG.md](CHANGELOG.md) - Version history
- **Workflow Diagram**: [WORKFLOW\_DIAGRAM.md](WORKFLOW_DIAGRAM.md) - Visual process flow
- **Interactive Website**: [docs/index.html](docs/index.html) - Responsive documentation site

📦 Installation
--------------

[](#-installation)

```
composer require shamimstack/youtube-cloud-storage
```

### Requirements

[](#requirements)

- PHP 8.4+
- Laravel 12+
- FFI extension enabled (`extension=ffi`)
- GD extension for image processing (`extension=gd`)
- FFmpeg (for video encoding/decoding)
- yt-dlp (for YouTube uploads)
- Wirehair library (auto-compiled if not found)

⚙️ Quick Setup
--------------

[](#️-quick-setup)

Run the interactive setup wizard:

```
php artisan yt:setup
```

This will:

1. ✅ Auto-detect system binaries (FFmpeg, FFprobe, yt-dlp)
2. ✅ Compile Wirehair from source if needed
3. ✅ Validate all dependencies via health check
4. ✅ Prompt for YouTube OAuth credentials
5. ✅ Write configuration to `.env`

### Manual Configuration

[](#manual-configuration)

Publish the config file:

```
php artisan vendor:publish --provider="Shamimstack\YouTubeCloudStorage\YTStorageServiceProvider" --tag="config"
```

Edit `config/youtube-storage.php`:

```
return [
    'ffmpeg_path' => '/usr/bin/ffmpeg',
    'ffprobe_path' => '/usr/bin/ffprobe',
    'ytdlp_path' => '/usr/bin/yt-dlp',
    'wirehair_lib_path' => '/usr/lib/libwirehair.so',

    'youtube_api_key' => env('YOUTUBE_API_KEY'),

    'youtube_oauth_credentials' => [
        'client_id' => env('YOUTUBE_CLIENT_ID'),
        'client_secret' => env('YOUTUBE_CLIENT_SECRET'),
        'refresh_token' => env('YOUTUBE_REFRESH_TOKEN'),
    ],

    // Advanced tuning
    'coefficient_threshold' => 10,
    'redundancy_factor' => 1.5,
    'dct_positions' => [[1, 2], [2, 1]],
];
```

Add to your `.env`:

```
FFMPEG_PATH=/usr/bin/ffmpeg
FFPROBE_PATH=/usr/bin/ffprobe
YTDLP_PATH=/usr/bin/yt-dlp
YOUTUBE_API_KEY=your_api_key
YOUTUBE_CLIENT_ID=your_client_id
YOUTUBE_CLIENT_SECRET=your_client_secret
YOUTUBE_REFRESH_TOKEN=your_refresh_token
```

🔑 Obtain YouTube Credentials
----------------------------

[](#-obtain-youtube-credentials)

1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create/select a project
3. Enable **YouTube Data API v3**
4. Go to **Credentials** → **Create Credentials** → **OAuth client ID**
5. Application type: **Web application**
6. Authorized redirect URIs: `http://localhost/callback`
7. Copy Client ID and Client Secret
8. Complete OAuth flow to get Refresh Token

💾 Usage
-------

[](#-usage)

### Via Storage Facade

[](#via-storage-facade)

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

// Upload a file
$disk = Storage::disk('youtube');
$disk->put('backup.zip', file_get_contents('/path/to/file.zip'));

// Download a file
$data = $disk->get('backup.zip');
file_put_contents('/tmp/restored.zip', $data);

// List files
$files = $disk->allFiles();

// Delete a file
$disk->delete('backup.zip');
```

### Via Artisan Commands

[](#via-artisan-commands)

**Upload:**

```
# Basic upload
php artisan yt:store /path/to/file.pdf

# With custom redundancy (2x packets)
php artisan yt:store /path/to/file.zip --redundancy=2.0

# Specify title/metadata
php artisan yt:store /path/to/image.png \
  --title="My Image" \
  --description="Uploaded via YTStorage" \
  --privacy=private
```

**Download:**

```
# Restore from YouTube URL
php artisan yt:restore "https://youtube.com/watch?v=dQw4w9WgXcQ"

# Specify output path
php artisan yt:restore "https://..." --output=/tmp/restored.pdf

# Restore multiple files
php artisan yt:restore \
  "https://youtube.com/watch?v=abc" \
  "https://youtube.com/watch?v=def"
```

### Programmatic Access

[](#programmatic-access)

```
use Shamimstack\YouTubeCloudStorage\Engines\EncoderEngine;
use Shamimstack\YouTubeCloudStorage\Support\HealthCheck;

// Run health check
$healthCheck = app(HealthCheck::class);
$report = $healthCheck->run();

if (!$report['passed']) {
    foreach ($report['checks'] as $check) {
        if (!$check['passed']) {
            echo "Failed: {$check['name']} - {$check['message']}\n";
        }
    }
    exit(1);
}

// Encode and upload
$engine = app(EncoderEngine::class);
$result = $engine->encodeAndUpload(
    filePath: '/path/to/file.pdf',
    title: 'My Document',
    description: 'Encoded with DCT steganography',
    privacyStatus: 'private',
);

echo "Uploaded to: {$result['videoUrl']}\n";
echo "Packets: {$result['packetCount']}\n";
echo "Size: {$result['originalSizeBytes']} bytes\n";

// Download and decode
$decodedPath = $engine->downloadAndDecode(
    videoUrl: 'https://youtube.com/watch?v=...',
    outputPath: '/tmp/restored.pdf',
);

// Verify integrity
if (hash_file('sha256', '/path/to/file.pdf') === hash_file('sha256', $decodedPath)) {
    echo "✅ Data integrity verified!\n";
}
```

🧠 How It Works
--------------

[](#-how-it-works)

### Architecture Overview

[](#architecture-overview)

```
┌─────────────┐
│ Original    │
│ File        │
└──────┬──────┘
       │
       ▼
┌─────────────────────────────────────┐
│  Wirehair Fountain Encoder          │
│  - Splits into N packets            │
│  - Adds M redundant packets         │
│  - Any N + 2% packets can recover   │
└──────┬──────────────────────────────┘
       │
       ▼
┌─────────────────────────────────────┐
│  DCT Sign-Bit Embedding             │
│  - Convert packets to bitstream     │
│  - Generate video frames            │
│  - Embed bits in DCT coefficient    │
│    signs (positive=0, negative=1)   │
└──────┬──────────────────────────────┘
       │
       ▼
┌─────────────────────────────────────┐
│  FFmpeg Video Encoding              │
│  - RGB24 raw frames → H.264/FFV1    │
│  - Upload to YouTube                │
└─────────────────────────────────────┘

```

### Package Structure

[](#package-structure)

```
src/
├── Commands/           # Artisan CLI commands
│   ├── StoreCommand.php      # Upload files
│   ├── RestoreCommand.php    # Download files
│   └── SetupCommand.php      # Interactive setup wizard
├── DTOs/              # Data Transfer Objects
│   ├── PacketMetadata.php    # Fountain code packet data
│   ├── StorageConfig.php     # Configuration with property hooks
│   └── StorageReference.php  # Video URL/ID handling
├── Drivers/           # Flysystem adapter
│   └── YouTubeStorageDriver.php  # FilesystemAdapter implementation
├── Engines/           # Core algorithms
│   ├── EncoderEngine.php       # Pipeline coordinator
│   ├── FountainEncoder.php     # Wirehair FFI bridge
│   └── VideoProcessor.php      # DCT steganography engine
├── Exceptions/        # Custom exceptions (6 types)
│   ├── BinaryNotFoundException.php
│   ├── EncodingParameterException.php
│   ├── FileTooLargeException.php
│   ├── InsufficientRedundancyException.php
│   ├── UploadFailedException.php
│   └── WirehairNotAvailableException.php
├── Facades/          # Laravel facade
│   └── YTStorage.php
└── Support/          # Helper classes
    ├── AutoConfigurator.php    # Binary auto-detection
    └── HealthCheck.php         # Dependency validation

```

### DCT Steganography

[](#dct-steganography)

Each video frame undergoes Discrete Cosine Transform (DCT), converting spatial pixels into frequency coefficients. Data is embedded by nudging the **sign** of selected coefficients:

- **Bit 0** → Make coefficient positive
- **Bit 1** → Make coefficient negative

The magnitude is kept above a threshold (default: 10) to survive YouTube's re-encoding.

**Mathematical Foundation:**

```
Forward DCT:  F = T · B · T^T
Inverse DCT:  B = T^T · F · T

Where:
- B = 8×8 pixel block
- F = 8×8 frequency coefficients
- T = DCT basis matrix (orthonormal)

```

### Fountain Codes for Redundancy

[](#fountain-codes-for-redundancy)

Wirehair implements O(N) fountain codes, generating unlimited repair packets:

- **Systematic packets**: Original data chunks
- **Repair packets**: Linear combinations via XOR

**Recovery guarantee**: Any N + ε packets can reconstruct the original file, where ε ≈ 2%.

🧪 Testing
---------

[](#-testing)

Run the test suite:

```
# Run all tests
php run-tests.php

# Run specific test suite
php run-tests.php --unit          # Unit tests
php run-tests.php --integration   # Integration tests
php run-tests.php --dct           # DCT algorithm tests

# With code coverage (requires Xdebug)
php run-tests.php --coverage
```

### Test Suite Breakdown

[](#test-suite-breakdown)

- **UnitTest.php** (372 lines) - Component functionality tests

    - Auto-configurator binary detection
    - Health check validation
    - Property hook validation
    - Serialization/deserialization
- **IntegrationTest.php** (316 lines) - End-to-end pipeline tests

    - Full encode/decode workflow
    - Auto-configurator coordination
    - Health check integration
    - Encoder engine pipeline
- **DctAlgorithmTest.php** (207 lines) - Mathematical correctness tests

    - Forward/inverse DCT roundtrip (pixel-perfect)
    - Basis matrix orthonormality (&lt; 0.0001 delta)
    - Sign-bit embedding accuracy
    - Frame generation validity

Tests cover:

- ✅ Auto-configurator binary detection
- ✅ Health check validation
- ✅ DCT forward/inverse roundtrip (pixel-perfect)
- ✅ Fountain code recovery thresholds
- ✅ Full pipeline (encode → decode)

### Composer Scripts

[](#composer-scripts)

```
composer test            # Run all tests
composer test:unit       # Unit tests only
composer test:integration # Integration tests only
composer test:dct        # DCT algorithm tests
composer test:coverage   # With code coverage
composer analyse         # PHPStan static analysis
composer format          # Auto-format code with Pint
composer cs-check        # Code style check
```

🛠 Troubleshooting
-----------------

[](#-troubleshooting)

### Check Dependencies

[](#check-dependencies)

```
php artisan yt:setup --no-interaction
```

### Common Issues

[](#common-issues)

**FFmpeg not found:**

```
# Install on Ubuntu/Debian
sudo apt-get install ffmpeg

# Install on macOS
brew install ffmpeg

# Install on Windows
choco install ffmpeg
```

**Wirehair compilation failed:**

```
# Install build tools
sudo apt-get install gcc cmake  # Linux
brew install cmake             # macOS
```

**YouTube upload quota exceeded:**

- YouTube API has daily upload limits
- Use private videos to avoid public quota restrictions
- Wait 24 hours for quota reset

📊 Performance Benchmarks
------------------------

[](#-performance-benchmarks)

File TypeSizeEncode TimeDecode TimeVideo DurationPacketsText1 MB~30s~25s10 sec12Image5 MB~2m 30s~2m 10s50 sec60Archive10MB~5m~4m 30s100 sec120*Benchmarks vary by CPU speed, DCT positions count, and network.*

🔒 Security Considerations
-------------------------

[](#-security-considerations)

- **Encryption**: Files are NOT encrypted by default (steganography only)
- **Privacy**: Set videos to "private" to prevent public access
- **Authentication**: OAuth tokens stored in `.env` (keep secure!)
- **Data Integrity**: CRC32 checksums verify packet authenticity

🎯 Roadmap
---------

[](#-roadmap)

- AES-256 encryption before encoding
- Batch upload (multiple files per video)
- Progress callbacks during encode/decode
- GPU acceleration for DCT operations
- Multi-threaded packet processing
- Resume interrupted uploads
- Automatic chunking for large files (&gt;1GB)

📜 License
---------

[](#-license)

MIT License — See [LICENSE](LICENSE) for details.

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

[](#-contributing)

Contributions welcome! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.

### High Priority Areas

[](#high-priority-areas)

- AES-256 encryption before encoding
- Batch upload support (multiple files per video)
- Progress callbacks during encode/decode operations
- GPU acceleration for DCT operations via OpenCL
- Multi-threaded packet processing
- Automatic chunking for large files (&gt;1GB)
- Resume interrupted uploads

### Development Setup

[](#development-setup)

```
# Clone your fork
git clone https://github.com/YOUR_USERNAME/youtube-cloud-storage.git
cd youtube-cloud-storage

# Install dependencies
composer install

# Run tests
php run-tests.php
```

### Code Quality Standards

[](#code-quality-standards)

We maintain high code quality standards:

- **PSR-12** coding standards
- **PHP 8.4+** features (property hooks, typed constants, readonly classes)
- **Strict types** enabled everywhere
- **PHPStan level 8** static analysis
- **Laravel Pint** for auto-formatting

```
# Check code quality
vendor/bin/phpstan analyse --level=8 src/
vendor/bin/pint --test
```

📈 Changelog
-----------

[](#-changelog)

### Version 0.3.0-beta (2026-03-09)

[](#version-030-beta-2026-03-09)

**Added:**

- Comprehensive test suite (895 lines across 3 files)
- Automated test runner with color-coded output
- Interactive documentation website (Tailwind CSS + Alpine.js)
- Contributing guidelines with code of conduct
- Project overview and implementation summary documents
- Composer scripts for common tasks (test, analyse, format)
- Dev tools: PHPStan ^1.10, Laravel Pint ^1.13

**Changed:**

- Enhanced documentation structure across all files
- Improved test coverage to estimated 80%+
- Updated composer.json with comprehensive scripts section

**Fixed:**

- Critical bug: Removed 1,814 lines of duplicate class definitions
- Process streaming in VideoProcessor (now uses Symfony InputStream)
- StorageConfig binary detection errors

### Version 0.2.0-beta (2026-03-09)

[](#version-020-beta-2026-03-09)

**Added:**

- AutoConfigurator class (408 lines) - auto-detects binaries
- HealthCheck class (417 lines) - validates dependencies
- SetupCommand (344 lines) - interactive setup wizard
- YouTubeStorageDriver - Flysystem adapter
- Artisan commands: yt:store, yt:restore, yt:setup

**Changed:**

- Fixed property hooks for graceful binary handling
- Replaced broken Process::signal() with Symfony InputStream
- Enhanced imports to use proper Symfony components

**Fixed:**

- Duplicate code removal (1,814 lines across 7 files)
- Process streaming implementation
- Binary detection error handling

### Version 0.1.0-alpha (2026-03-09)

[](#version-010-alpha-2026-03-09)

**Added:**

- Initial package structure
- Core components: Service provider, Facade, Driver, DTOs
- Engines: FountainEncoder, VideoProcessor, EncoderEngine
- Exception handling framework (6 custom exceptions)
- Configuration system with publishable config file
- PHP 8.4 features: Property hooks, asymmetric visibility, typed constants

**Technical Foundation:**

- 2D Discrete Cosine Transform implementation
- Wirehair fountain codes via FFI
- FFmpeg rawvideo pipe streaming
- RGB24 frame generation and DCT embedding

---

**Made with ❤️ by Shamim Stack**

📧 Support &amp; Resources
-------------------------

[](#-support--resources)

- **GitHub Repository**:
- **Packagist**:
- **Interactive Documentation**:
- **Issues**:
- **Discussions**:

🙏 Acknowledgments
-----------------

[](#-acknowledgments)

- **Wirehair**: [Lancashire County Council](https://github.com/LancashireCountyCouncil/Wirehair)
- **FFmpeg**: [FFmpeg Team](https://ffmpeg.org/)
- **yt-dlp**: [yt-dlp contributors](https://github.com/yt-dlp/yt-dlp)
- **Laravel**: [Taylor Otwell](https://laravel.com/)
- **Symfony**: [Process Component](https://symfony.com/doc/current/components/process.html)

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance80

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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

106d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/40be284b8dd88b2d48b0d446df171ae05f8eaaf44ab18b948766c6fafc76f9f4?d=identicon)[shamimstack](/maintainers/shamimstack)

---

Top Contributors

[![shamimlaravel](https://avatars.githubusercontent.com/u/266431424?v=4)](https://github.com/shamimlaravel "shamimlaravel (1 commits)")

---

Tags

laravelyoutubestoragesteganographyffidctfountain-codeswirehair

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/shamimstack-youtube-cloud-storage/health.svg)

```
[![Health](https://phpackages.com/badges/shamimstack-youtube-cloud-storage/health.svg)](https://phpackages.com/packages/shamimstack-youtube-cloud-storage)
```

###  Alternatives

[slimani/filament-media-manager

A media manager plugin for Filament.

115.1k](/packages/slimani-filament-media-manager)

PHPackages © 2026

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