league/flysystem-rackspace
Flysystem adapter for Rackspace Cloud Files. Adds a Rackspace-backed filesystem driver so you can use Flysystem’s unified API to read, write, list, move, and delete files in Cloud Files containers, integrating with PHP apps via League/Flysystem.
Storage facade via Flysystem’s abstraction, enabling consistent file operations across multiple backends (e.g., S3, local, Rackspace).Filesystem contract, increasing complexity.Filesystem contract, requiring a custom adapter or bridge (e.g., league/flysystem-laravel). This adds ~30–60 minutes of setup time.rackspace/php-sdk). Risk of version conflicts or missing features..env or a secrets manager).league/flysystem-aws-s3 or Rackspace’s official SDK if critical features are missing.ibm-cos-flysystem adapter..env, secrets manager)?
Secure storage of Rackspace API keys is critical to avoid exposure.local, s3) with Rackspace for media storage, backups, or user uploads.Storage facade if wrapped in a custom adapter (see below).Filesystem contract.symfony/finder for recursive operations.Storage::disk()->put(), Storage::get()).composer require league/flysystem-laravel
Update config/filesystems.php:
'disks' => [
'rackspace' => [
'driver' => 'league-flysystem',
'adapter' => League\Flysystem\Rackspace\RackspaceAdapter::class,
'options' => [
'username' => env('RACKSPACE_USERNAME'),
'apiKey' => env('RACKSPACE_API_KEY'),
'region' => env('RACKSPACE_REGION', 'IAD'),
'container' => env('RACKSPACE_CONTAINER'),
],
],
],
Filesystem contract:
// app/Filesystem/Adapters/RackspaceAdapter.php
namespace App\Filesystem\Adapters;
use League\Flysystem\Filesystem;
use League\Flysystem\Rackspace\RackspaceAdapter as LeagueRackspaceAdapter;
use Illuminate\Contracts\Filesystem\Filesystem as LaravelFilesystem;
class RackspaceAdapter implements LaravelFilesystem {
protected $filesystem;
public function __construct(array $config) {
$adapter = new LeagueRackspaceAdapter($config);
$this->filesystem = new Filesystem($adapter);
}
// Delegate all methods to the underlying Flysystem instance
public function __call($method, $parameters) {
return call_user_func_array([$this->filesystem, $method], $parameters);
}
}
Register the adapter in AppServiceProvider:
use App\Filesystem\Adapters\RackspaceAdapter;
public function boot() {
Storage::extend('rackspace', function ($app) {
return new RackspaceAdapter([
'username' => env('RACKSPACE_USERNAME'),
'apiKey' => env('RACKSPACE_API_KEY'),
'region' => env('RACKSPACE_REGION', 'IAD'),
'container' => env('RACKSPACE_CONTAINER'),
]);
});
}
Mockery or PHPUnit).How can I help you explore Laravel packages today?