CodeSleeve / stapler

ORM-based file upload package for php.
http://codesleeve.com
Other
538 stars 144 forks source link

add support for Google Cloud Storage #183

Open shcode opened 7 years ago

shcode commented 7 years ago

Add support for GCS

antongorodezkiy commented 7 years ago

Thank you for sharing your work @shcode, will try to use it

antongorodezkiy commented 7 years ago

Had to make few modifications for my case and the special one to avoid the exception

Serialization of 'Closure' is not allowed

I had to explicitly set serializable properties in GCS.php to exclude $filesystem from the serialization:

// NOTE: need to explicitly set serializable properties
        public function __sleep()
        {
            return ['attachedFile'];
        }

        public function __wakeup()
        {
            $this->filesystem = StaplerExtended::getGCSClientInstance($this->attachedFile);
        }