PHPackages                             baja-foundry/flysystem-filecabinet - 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. baja-foundry/flysystem-filecabinet

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

baja-foundry/flysystem-filecabinet
==================================

NetSuite FileCabinet adapter for Flysystem with Laravel support

1.0.0-beta.2(11mo ago)02MITPHPPHP ^8.2

Since Jul 23Pushed 11mo agoCompare

[ Source](https://github.com/Baja-Foundry/flysystem-filecabinet)[ Packagist](https://packagist.org/packages/baja-foundry/flysystem-filecabinet)[ RSS](/packages/baja-foundry-flysystem-filecabinet/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (8)Versions (3)Used By (0)

NetSuite FileCabinet Flysystem Adapter
======================================

[](#netsuite-filecabinet-flysystem-adapter)

A Laravel-ready [Flysystem](https://flysystem.thephpleague.com/) adapter for NetSuite's FileCabinet, enabling seamless file operations through NetSuite's REST API with OAuth 1.0 authentication.

[![PHP Version](https://camo.githubusercontent.com/c9f64f714c636ba27a3bba6dfd52f98426832db1262747efa54b212d16943651/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d626c7565)](https://packagist.org/packages/baja-foundry/flysystem-filecabinet)[![Laravel](https://camo.githubusercontent.com/3020a5644b41b0a6e42c716ae0486d76e1af9fdfb5ccbce77edf26d8c4e0554e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25354531302e3025323025374325323025354531312e302d726564)](https://laravel.com)[![Flysystem](https://camo.githubusercontent.com/048df61186db600bf209471a2e4657bf150572f3f9338f92983729f5be702493/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f666c7973797374656d2d253545332e33302d677265656e)](https://flysystem.thephpleague.com)

Features
--------

[](#features)

- ✅ **Full Flysystem v3 compatibility** - All standard file operations supported
- 🔐 **OAuth 1.0 authentication** - Secure NetSuite REST API integration
- 🚀 **Laravel auto-discovery** - Zero-configuration Laravel integration
- 📁 **Complete file operations** - Read, write, delete, copy, move, list
- 🗂️ **Directory management** - Create, delete, and navigate folders
- 🔍 **Connection testing** - Built-in connectivity verification
- 🛡️ **Error handling** - Comprehensive exception handling
- 📊 **File metadata** - Size, mime type, last modified date
- ✨ **Production ready** - Thoroughly tested with PHPUnit

Quick Start
-----------

[](#quick-start)

### Installation

[](#installation)

```
composer require baja-foundry/flysystem-filecabinet:^1.0.0-beta.1
```

### Laravel Configuration

[](#laravel-configuration)

Add to `config/filesystems.php`:

```
'netsuite_filecabinet' => [
    'driver' => 'netsuite_filecabinet',
    'base_url' => env('NETSUITE_BASE_URL'),
    'consumer_key' => env('NETSUITE_CONSUMER_KEY'),
    'consumer_secret' => env('NETSUITE_CONSUMER_SECRET'),
    'token_id' => env('NETSUITE_TOKEN_ID'),
    'token_secret' => env('NETSUITE_TOKEN_SECRET'),
    'realm' => env('NETSUITE_REALM'),
],
```

### Test Connection

[](#test-connection)

```
php artisan tinker
```

```
$disk = Storage::disk('netsuite_filecabinet');
$result = $disk->getAdapter()->testConnection();
dump($result); // Should show success: true
```

Documentation
-------------

[](#documentation)

- 📋 **[Installation Guide](INSTALL.md)** - Complete Laravel setup and testing with artisan tinker
- 🔌 **[Connection Testing](CONNECTION_TESTING.md)** - Verify NetSuite connectivity and troubleshoot issues
- 🧪 **[Live Testing Guide](LIVE_TESTING.md)** - Run tests against real NetSuite environments

Requirements
------------

[](#requirements)

- **PHP**: ^8.2
- **Laravel**: ^10.0 | ^11.0 (optional, works standalone)
- **Flysystem**: ^3.30
- **NetSuite**: REST API access with valid OAuth credentials

Supported Operations
--------------------

[](#supported-operations)

OperationMethodDescription**Files**Read`get()`, `readStream()`Download file contentsWrite`put()`, `putFileAs()`Upload files to NetSuiteDelete`delete()`Remove filesCopy`copy()`Duplicate filesMove`move()`Relocate filesExists`exists()`Check file existence**Metadata**Size`size()`Get file size in bytesMIME Type`mimeType()`Detect content typeModified`lastModified()`Get modification timestamp**Directories**Create`makeDirectory()`Create foldersDelete`deleteDirectory()`Remove folders (recursive)List`files()`, `allFiles()`List directory contents**Connectivity**Test`testConnection()`Verify API accessBasic Usage
-----------

[](#basic-usage)

### Laravel

[](#laravel)

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

$disk = Storage::disk('netsuite_filecabinet');

// Upload a file
$disk->put('documents/report.pdf', $pdfContent);

// Download a file
$content = $disk->get('documents/report.pdf');

// Check if file exists
if ($disk->exists('documents/report.pdf')) {
    echo "File exists!";
}

// List files
$files = $disk->files('documents');
```

### Standalone PHP

[](#standalone-php)

```
use BajaFoundry\NetSuite\Flysystem\Adapter\NetSuiteFileCabinetAdapter;
use BajaFoundry\NetSuite\Flysystem\Client\NetSuiteClient;
use League\Flysystem\Filesystem;

$client = new NetSuiteClient([
    'base_url' => 'https://account.suitetalk.api.netsuite.com',
    'consumer_key' => 'your_consumer_key',
    'consumer_secret' => 'your_consumer_secret',
    'token_id' => 'your_token_id',
    'token_secret' => 'your_token_secret',
    'realm' => 'your_account_id',
]);

$adapter = new NetSuiteFileCabinetAdapter($client);
$filesystem = new Filesystem($adapter);

// Test connection
$result = $adapter->testConnection();
if ($result['success']) {
    $filesystem->write('hello.txt', 'Hello NetSuite!');
}
```

NetSuite Setup Requirements
---------------------------

[](#netsuite-setup-requirements)

You'll need the following from your NetSuite account:

1. **Integration Record** with Consumer Key &amp; Secret
2. **Access Token Record** with Token ID &amp; Secret
3. **Account ID** for realm parameter
4. **Proper permissions** for FileCabinet and SuiteQL access

*See [INSTALL.md](INSTALL.md) for detailed setup instructions.*

Advanced Usage
--------------

[](#advanced-usage)

### Custom Root Folder

[](#custom-root-folder)

Restrict operations to a specific NetSuite folder:

```
$adapter = new NetSuiteFileCabinetAdapter($client, 'folder-id-123');
```

### Path Prefixing

[](#path-prefixing)

Add automatic path prefixes:

```
$adapter = new NetSuiteFileCabinetAdapter($client, '', 'uploads/');
// All operations will be prefixed with 'uploads/'
```

### Error Handling

[](#error-handling)

```
use NetSuite\Flysystem\Exceptions\NetSuiteException;
use League\Flysystem\UnableToReadFile;

try {
    $content = $disk->get('nonexistent.txt');
} catch (UnableToReadFile $e) {
    echo "File not found: " . $e->getMessage();
} catch (NetSuiteException $e) {
    echo "NetSuite API error: " . $e->getMessage();
}
```

Testing
-------

[](#testing)

The package includes comprehensive testing at multiple levels:

### Mock-Based Tests (Fast, No NetSuite Required)

[](#mock-based-tests-fast-no-netsuite-required)

```
# Run all mock-based tests
composer test

# Run specific test suites
composer test-unit           # Unit tests only
composer test-integration    # Integration tests only

# With coverage
composer test-coverage
```

### Live NetSuite Tests (Requires Real NetSuite Access)

[](#live-netsuite-tests-requires-real-netsuite-access)

```
# Run live tests against real NetSuite
composer test-live

# Live tests with coverage
composer test-live-coverage

# Run all tests (mock + live)
composer test-all
```

### Code Quality

[](#code-quality)

```
# Static analysis
composer phpstan

# Code style checks
composer phpcs

# Fix code style
composer phpcbf
```

### Test Statistics

[](#test-statistics)

- **31 Mock-Based Tests** - Fast execution, no credentials required
- **28 Live Tests** - Real NetSuite environment validation
- **96.7% Success Rate** - Reliable and thoroughly tested
- **Automatic Cleanup** - Live tests clean up after themselves

See [LIVE\_TESTING.md](LIVE_TESTING.md) for detailed live testing setup and configuration.

Development
-----------

[](#development)

### Local Setup

[](#local-setup)

```
git clone https://github.com/your-repo/netsuite-flysystem-filecabinet.git
cd netsuite-flysystem-filecabinet
composer install
```

### Architecture

[](#architecture)

```
src/
├── Adapter/
│   └── NetSuiteFileCabinetAdapter.php    # Main Flysystem adapter
├── Client/
│   └── NetSuiteClient.php                # OAuth HTTP client
├── Exceptions/
│   ├── NetSuiteException.php             # Base exception
│   └── FileNotFoundException.php         # File-specific errors
└── Laravel/
    └── NetSuiteFileCabinetServiceProvider.php # Laravel integration

```

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

IssueSolutionAuthentication failedVerify OAuth credentials and NetSuite permissionsDriver not foundCheck Laravel service provider registrationConnection timeoutIncrease timeout in configurationPermission deniedEnsure NetSuite role has FileCabinet access*See [CONNECTION\_TESTING.md](CONNECTION_TESTING.md) for detailed troubleshooting.*

Contributing
------------

[](#contributing)

We welcome contributions! Please:

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Write tests for new features
4. Ensure all tests pass
5. Submit a Pull Request

### Development Guidelines

[](#development-guidelines)

- Follow PSR-12 coding standards
- Add PHPDoc comments
- Write tests for new features
- Update documentation as needed

Security
--------

[](#security)

- Never commit NetSuite credentials to version control
- Use environment variables for sensitive configuration
- Regularly rotate OAuth tokens
- Monitor API usage for unauthorized access

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Credits
-------

[](#credits)

- Built on [Flysystem](https://flysystem.thephpleague.com/) by The League of Extraordinary Packages
- Inspired by the Laravel ecosystem and NetSuite's FileCabinet system
- OAuth 1.0 implementation following NetSuite's SuiteTalk specifications

Support
-------

[](#support)

- **Documentation**: [INSTALL.md](INSTALL.md) | [CONNECTION\_TESTING.md](CONNECTION_TESTING.md) | [LIVE\_TESTING.md](LIVE_TESTING.md)
- **Issues**: GitHub Issues
- **NetSuite Docs**: [SuiteTalk REST Web Services](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/chapter_1540391670.html)

---

Made with ❤️ for the Laravel and NetSuite communities.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance52

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

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

Every ~12 days

Total

2

Last Release

334d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/222318007?v=4)[Baja Foundry](/maintainers/BajaFoundry)[@BajaFoundry](https://github.com/BajaFoundry)

---

Top Contributors

[![BajaFoundry](https://avatars.githubusercontent.com/u/222318007?v=4)](https://github.com/BajaFoundry "BajaFoundry (7 commits)")

---

Tags

filesystemFlysystemlaravelnetsuiteFileCabinet

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/baja-foundry-flysystem-filecabinet/health.svg)

```
[![Health](https://phpackages.com/badges/baja-foundry-flysystem-filecabinet/health.svg)](https://phpackages.com/packages/baja-foundry-flysystem-filecabinet)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.7k285.7M1.0k](/packages/league-flysystem-aws-s3-v3)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[masbug/flysystem-google-drive-ext

Flysystem adapter for Google Drive with seamless virtual&lt;=&gt;display path translation

2682.2M18](/packages/masbug-flysystem-google-drive-ext)

PHPackages © 2026

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