I am using Laravel 8.x for my new project and need support for a legacy Live web application in Zend, which uses the Rackspace CDN to store the files. So, I need to upload the files in Rackspace CDN from the new application in Laravel 8.x I can upload the files on Amazon S3 successfully, but not able to upload them on Rackspace. I tried with league/flysystem-rackspace, but it's not supported in the current Laravel version.
Controller
public function store(Request $request)
{
$uploadImage = $request->file('file');
$filename = time().str_replace(' ', '_',
$uploadImage->getClientOriginalName());
$path = $request->file('file')->storePubliclyAs(
config('app.cdn_dir'),
$filename,
'rackspace'
);
}
config/filesystem
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'rackspace' => [
'driver' => 'rackspace',
'username' => env('CDN_USERNAME'),
'key' => env('CDN_KEY'),
'container' => env('CDN_CONTAINER'),
'endpoint' => env('CDN_ENDPOINT', 'https://identity.api.rackspacecloud.com/v2.0/'),
'region' => 'IAD',
'url_type' => 'publicURL',
'url' => env('CDN_URL'),
],
],
Error
Error: Class 'Symfony\Component\EventDispatcher\Event' not found in file D:\laragon\www\crm\vendor\guzzle\guzzle\src\Guzzle\Common\Event.php on line 10
I had the same problem after upgrading to Laravel 8. I managed to get it working based on this pr comment which was when they removed it from Laravel and this draft which made a start on using the newer php-opencloud sdk.
Rackspace Provider:
And the adapter:
Rackspace config in
filesystems.phpAnd then add the provider in
app.php.This is a rough implementation as only creating, deleting, and getting the temp url have been tested.
Authentication works by using Identity v2.0 because Rackspace doesn't support v3 https://php-openstack-sdk.readthedocs.io/en/latest/services/identity/v2/authentication.html
And the temp url method was based on the function in the old repo https://github.com/rackspace/php-opencloud